This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Custom calling convention


Hello all,

Is it possible to modify the calling convention used by gcc ?

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 ?

-- 
      Best Regards,
        Vladimir


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]