Re: system calls-(query)

From: Jan-Benedict Glaw
Date: Tue Jul 06 2004 - 04:26:19 EST


On Tue, 2004-07-06 09:00:30 +0100, Susheel Raj <susheel_nuguru@xxxxxxxxxxx>
wrote in message <20040706080030.35778.qmail@xxxxxxxxxxxxxxxxxxxxxxxxx>:
> i have been trying to understand how the system calls
> are being made by applications and how the kernel
> reacts to them...this is what i got into my brain....
> when an application makes a system call ( for i386)
> %eax register is filled with the system call number
> and some other registers are to be given some
> appropriate values..for example ..if i amke an exit ()
> system call.. then its system call number "1" is
> filled in %eax and the status code is filled in
> %ebx...
>
> so i want to know what are the requirements for other
> systems calls to execute ...what all registers they
> access..any documentation would be a great help....

Userland has to place arguments where the kernel expects them. Have a
look at ./linux/asm-$ARCH/unistd.h to see how syscalls can be made. You
can think of the _syscallX() macros as the lowest-level "function" to
get access to a system call slot. From there, the syscall is usually
dispatched from entry.S.

Syscalls trigger some kind of interrupt or exception; an exception
handler then gets the system call number and dispatches it through the
syscall function pointer's addresses in sys_call_table (in entry.S).

MfG, JBG


--
Jan-Benedict Glaw jbglaw@xxxxxxxxxx . +49-172-7608481
"Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg
fuer einen Freien Staat voll Freier Bürger" | im Internet! | im Irak!
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));

Attachment: signature.asc
Description: Digital signature