Re: Differences between FreeBSD and Linux system call mechanism

Brandon S. Allbery KF8NH (allbery@kf8nh.apk.net)
Thu, 03 Sep 1998 18:47:06 -0300


In message <35EEAE7A.2DBD8809@darmstadt.gmd.de>, Joerg Pommnitz writes:
+-----
| Alexander Kjeldaas wrote:
| > Doesn't this mean that it would be a good idea to let the kernel
| > implement system calls by mapping a page into user-space containing
| > the appropriate assembly instructions to most efficiently do the
| > system calls?
|
| Probably not. In this case all you would effectively do
| is change the syscall interface from:
| move parameters into registers
| int 0x80
| to
| move parameters into registers
| jump to kernel entry instruction
| execute int 0x80 or sysenter
+--->8

IIRC SCO (used to?) implemented the syscalls that merely return process
information by read-mapping the appropriate part of the ublock (think
"struct task_struct", for those unfamiliar with AT&T-derived (including BSD)
*ix, although task_struct combines both proc and ublock) within the
process's address space during process creation. Thus, getpid(), getppid(),
getpgrp(), etc. were nothing more than

return ((struct user *) PROCESS_UBLOCK_MAP_ADDR)->u_pid;

(or other structure fields as appropriate).

(This also introduced a security hole at one point, though, IIRC.)

-- 
brandon s. allbery	[os/2][linux][solaris][japh]	 allbery@kf8nh.apk.net
system administrator	     [WAY too many hats]	   allbery@ece.cmu.edu
electrical and computer engineering					 KF8NH
carnegie mellon university

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html