System V ABI Quick Reference

Parameters rdi
rsi
rdx
rcx
r8
r9
Caller-saved r10
r11
Return rax
rdx
Callee-saved rbx
rsp
rbp
r12
r13
r14
r15

The System V Application Binary Interface is the calling convention used almost universally on x86_64. This is a quick reference of the registers used in function calls, since the official table is a bit messy.

Before call, the stack must be 16-byte aligned. The direction flag DF must also be clear. The 128-byte “red zone” below the current stack frame can be used for temporary data not preserved across function calls.

Linux system calls

Syscall number rax
Parameters rdi
rsi
rdx
r10
r8
r9
Caller-saved rcx
r11
Return rax
Callee-saved rbx
rsp
rbp
r12
r13
r14
r15

For some reason the roles of rcx and r10 are swapped. Calls are made using the syscall instruction.