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

Re: basic system call question



John Levon wrote:
> 
> On Tue, 15 May 2001, Joseph A. Knapka wrote:
> 
> > Which reminds me of a question I had some time ago, but wasn't
> > able to investigate at the time. The kernel_thread() function,
> > called to spawn kernel threads, seems to invoke int0x80 with
> > the contents of EAX undefined. Am I insane, or what? I suppose
> > something about the calling convention used in the kernel
> > must gaurantee the EAX value is something useful, but is that
> > documented anywhere? I have not been able to figure out why
> > this code works.
> >
> > <http://lxr.linux.no/source/arch/i386/kernel/process.c#L439>
> 
> I imagine it is relying on gcc to always allocate the "anonymous" IN
> parameter for the inline asm to eax, namely this :
> 
> 458                 :"" (__NR_clone), "i" (__NR_exit),
> 
> will make sure eax will contain the __NR_clone value.
> 
> I suppose you can look at process.s (cd /usr/src/linux && make kernel/process.s)
> to confirm this.
> 
> Can anyone quote the relevant part from the gcc inline asm manual ?

Thanks, John.

I just read the "Extended Asm" section of the GCC info
pages, but didn't find anything about "anonymous" parameters. There
must be some machine-dependent docs somewhere. The "i386 Dependencies"
section of the "gas" info was not helpful either :-(

Oh well. Where do people find out this stuff???

-- Joe
 

-- Joseph A Knapka
"If I ever get reincarnated... let me make certain I don't come back
 as a paperclip." -- protagonist, H Murakami's "Hard-boiled Wonderland"
// Linux MM Documentation in progress:
// http://home.earthlink.net/~jknapka/linux-mm/vmoutline.html
* Evolution is an "unproven theory" in the same sense that gravity is. *
-
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/