x86-64 syscall ABI conventions

Marco van de Voort marcov at stack.nl
Wed May 12 04:29:13 PDT 2004


To start with the FPC port for x86-64, I've objdumped an empty C prg on an
x86-64, and read the abi document on x86-64.org, but don't understand the
move rcx,r10 before each syscall.

Why is this done? What is exactly saved? If it is a save, where is it
restored from r10?

E.g. 
0000000000402094 <__sys_sigaction>:
  402094:       48 c7 c0 a0 01 00 00    mov    $0x1a0,%rax
  40209b:       49 89 ca                mov    %rcx,%r10	<- This one
  40209e:       0f 05                   syscall
  4020a0:       72 01                   jb     4020a3 <__sys_sigaction+0xf>
  4020a2:       c3                      retq


I did notice that the x86-64 linux abi mentions rcx as being destroyed by
the kernel.



More information about the freebsd-hackers mailing list