[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Understanding Alpha syscalls



On Wed, 2 Jun 1999, Uncle George wrote:

> u mean u cant  "find /usr/src/linux -type f -exec grep -l sys_open {} \;"
> for sys_open in fs/open.c ?
> gat

I did find it there, but I didn't understand the mapping between the
assembly and the C... maybe you can help me.  Confirm if I understand it
correctly now:

1.) "open" called from user-space program.

2.) "open" defined in some way within libc such that it uses the syscall2
(or 3) macro defined by <asm/unistd.h>. ?

3.) syscallx expands to an assembly function which calls the PALcode with
"callsys" with the appropriate __NR_sycallname and arguments (I am an
assembly newbie and I know nothing of PAL).

4.) kernel has registered (at bootup, in trap_init()) that the routine
"entSys" is to be called by the PALcode for system calls. ?

5.) PALcode traps into kernel to execute the asm routine entSys. ?

6.) entSys runs the function in the sys_call_table at the offset X, where X
was the name of the __NR_syscallname (which is actuallly a number). ?

7.) the function in the sys_call_table can be a straight C-code routine,
such as the one you pointed out is in fs/open.c for sys_open.

8.) when the function returns, the stack is unwound and the rest of the
entSys stuff is done, including passing the return value back up to
user-space. ?

Is this right?

thanks for the help,
-bp
--
# Software Development, WatchGuard Inc.
# Projects, PGP key at http://www.terran.org/~bryan



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []