Re: Calling syscalls from x86-64 kernel results in a crash on Opteron machines

William Lee Irwin III
2004-09-14T02:07:38Z

Christoph Hellwig wrote:
>> Which you shouldn't do in the first place.

On Mon, Sep 13, 2004 at 06:05:52PM +0300, Constantine Gavrilov wrote:
> Function kernel_thread() on i386 is implemented by putting the args to
> appropriate regs and calling int 0x80, resulting in a system call
> clone() on i386.
> I have also found the "syscall" instruction in x86-64 kernel specific
> code (it does not call _syscall() macros directly, though). So,
> "shouldn't do" is a bit too strong.
> What I am writing is an application, and not interface. As such, it is
> not much different from its requierements from a user-space application.
> If user-space application may call system calls, why a kernel space
> application cannot?
> And BTW, kernel-space applications have their own place even if the
> concept seems foreign to you.

This is not something we particularly endorse, but when making syscalls
the function calls sys_foo() suffice. Also, ia32 does not use syscall
traps for kernel_thread() in current 2.6.x

-- wli