Re: Custom calling convention

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

 



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"?  There are no
command line options to make gcc generate that kind of code.  It would
not be particularly difficult to modify gcc to do it.

Ian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux