adding a system call
A message that is not in the archive (sent off-list or not yet received): [email protected]
Alle 05:42, venerdì 5 marzo 2004, Nick Weber ha scritto:
Quoted 17 lines
I've been having some trouble getting a system call to work in uml. I've gotten it to work on my host kernel. Here's my setup:
system: Debian
host: 2.6.3 tried with and without patch from www.user-mode-linux.org/~blaisorblade/
uml: 2.6.3I first tried a simple printk just to see if I could get a system call to work. The test program calls the sytem call and exits normally with no indication of an error. On the host system the printk shows up in
/var/log/syslog. Doesn't show up anywhere in uml. Then I tried a system call that uses aput_userandget_userto modify a number I give it in a test program. Part of the test code looks like this:
Quoted 7 lines
int ret =
new_sys1(&user_space_int);
if (ret != 0) print error information.The system call does a printk to let you know it worked and modifies the number you give it and returns 0 on success
-EFAULTon error. The value of ret is -1. Anyone have any ideas as to what is going wrong?
That is correct behaviour if you passed a wrong address. Notice in man open that it returns -1 on error while sys_open returns -errno, read include/asm-i386/unistd.h, understand that any negative return value is moved onto errno and that -1 is returned instead, understand you must print errno in your test case and you'll have got the clue.
If you did already understand what I said (it did not seem anyway), post actual code that someone can understand; if you got the exact code working on the host, in means that your syscall does not get the correct address because it is not reading the correct registers - print &user_space_int in the test case and printk the arg in the syscall - they possibly do not match.
Signature · 14 lines
Paolo Giarrusso, aka Blaisorblade Linux registered user n. 292729 ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id70&alloc_id638&opÌk _______________________________________________ User-mode-linux-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel