From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 16053 invoked from network); 3 Jun 1999 03:01:16 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 3 Jun 1999 03:01:16 -0000 Received: from earth.terran.org (bryan@earth.terran.org [216.39.144.215]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id WAA26133 for ; Wed, 2 Jun 1999 22:15:42 -0400 Received: from localhost (bryan@localhost) by earth.terran.org (8.8.7/8.8.8) with ESMTP id TAA08733; Wed, 2 Jun 1999 19:15:40 -0700 Date: Wed, 2 Jun 1999 19:15:39 -0700 (PDT) From: "B. James Phillippe" To: Uncle George cc: AXP list Subject: Re: Understanding Alpha syscalls In-Reply-To: <3755D3D2.7AA140BE@voicenet.com> Message-ID: Organization: terran.org/darkforest.org X-Subliminal-Message: Use Linux MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 . ? 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