[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: basic system call question
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 ?
john
--
"The path you specified contains too many directories. Delete one or more
directories or clear the Include Subdirectories checkbox."
- Microsoft Office
-
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/