x86 calling conventions
=======================
x86-64
------
Arguments:
Integer: rdi, rsi, rdx, rcx, r8, r9
Float: xmm0-xmm7
Return:
Integer: rax
Float: xmm0, xmm1
Callee saved:
rbp, rbx, r12, r13, r14, r15
Notes:
- For variadic arguments, al contains the number of vector registers
used
- rdx is the "second return register"
- Vector type argument (
__m128
, __m256
or __m512
) goes in Float
registers (xmm, ymm or zmm respectively)
i386
----
Arguments:
__mm64
: mm0-mm2
__mm128
: xmm0-xmm2
Return:
Integer: eax
Float: st0
__mm64
: mm0
__mm128
: xmm0
Callee saved:
ebp, ebx, esi, edi
Linux syscall convention
------------------------
Arch | Syscall | Arguments: | return |
| number | 1 | 2 | 3 | 4 | 5 | 6 | value |
-------|---------|-----|-----|-----|-----|-----|-----|--------|
x86-64 | rax | rdi | rsi | rdx | r10 | r8 | r9 | rax |
i386 | eax | ebx | ecx | edx | esi | edi | ebp | eax |
Notes:
- x86-64 lose the content of rcx and r11, as they are overwritten with
the
syscall
instruction