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

Constantine Gavrilov
2004-09-13T15:53:19Z

Brian Gerst wrote:

>
> You should never use the unistd.h macros from kernel space. Call
> sys_foo() directly. This may mean you have to export it. The reason
> it crashes is that the "syscall" opcode used by the x86-64 macros
> (unlike the "int $0x80" for i386) causes a fault when already running
> in kernel space.
>
> --
> Brian Gerst

I can see from the crash report that the fault happens. I want to
understand why.

I can use workarounds. (Calling sys_foo() directly from module can be a
problem -- I would have to know the "versioned" function name or the
address of the function within the kernel space. Calling an entry from
the syscall table is much easier.)

--
----------------------------------------
Constantine Gavrilov
Kernel Developer
Qlusters Software Ltd
1 Azrieli Center, Tel-Aviv
Phone: +972-3-6081977
Fax: +972-3-6081841
----------------------------------------