From: ron@ramsey.cs.laurentian.ca (Ron Prediger [Velociraptor]) Subject: A question about Kernel system call mechanism Date: Wed, 19 Aug 1992 17:41:17 GMT
I am relatively new to Linux and have been examining the kernel source.
1) Does anyone know how linux passes parameters from the user process to the
kernel service routine ? Below is what I think is happening and where I
am confused.
It appears that system calls are handled using interrupt or trap gates
resident in the Interrupt descriptor table (IDT). From reading the Intel
386 ref. manual I understand that a stack switch occurs automatically when
a less privileged process accesses a gate for a more privileged subroutine.
What I can't see is how the kernel service routine gets the system call
parameters (ie. addresses, etc) from the user process. Is there code
somewhere which copies these parameters from the original (level 3) stack to
the more privileged (level 0) stack ? If linux had used call gates to
implement system calls, the parameters would automatically be copied to the
privileged routine's stack by the 386. (This automatic
copy of parameters does not occur when referencing interrupt/trap gates.)
2) It appears that Linux is making use of segment registers (FS,GS) and the
LDT/GDT to transfer the actual data (ie. from a read system call) between
user and kernel address spaces. Is this observation correct ?
Thank you.
Ron Prediger (ron@ramsey.cs.laurentian.ca)