Vladimir Kuznetsov <ks.vladimir@xxxxxxxxx> writes: > On Wednesday 13 May 2009 04:58:25 Ian Lance Taylor wrote: >> Vladimir Kuznetsov <ks.vladimir@xxxxxxxxx> writes: >> > I have a very small embedded kernel that uses a slightly modified calling >> > conventions than normal ones on x86-64: it uses r10 instead or rcx to >> > pass 4th argument and "syscall" instruction instead of normal "call". I >> > am using a thin wrapper like this: >> > >> > error_t __do_syscall(SyscallParams params, ...) __asm__("__do_syscall"); >> > __asm__( >> > "__do_syscall:\n" >> > " movq %rcx, %r10\n" >> > " syscall\n" >> > " ret\n" >> > ); >> > >> > but it requires an additional function call (and so uses an additional >> > cache line and, possibly, a TLB entry). Are there any way to do it inline >> > ? >> >> You always want to use "syscall" instead of "call"? > No, "syscall" is used only for system calls. I still have a normal functions > that are called using standard calling convention. If you only need it for system calls then I recommend writing an inline asm statement for each system call, and wrap that inline asm up in an inline function in a header file somewhere. If you mark the function with the always_inline attribute then you should get the results you want. Ian