Skip to content

Calling Conventions

x86-64

x64 Calling Conventions

How arguments, return values and registers are passed across function calls in the System V (Linux/macOS) and Microsoft x64 ABIs.

Knowing the calling convention lets you recover function signatures from raw disassembly — which register holds argument 1, where the return value lands, and which registers a callee must preserve.

Integer/pointer argument registers

PositionSystem V (Linux/macOS)Microsoft x64
1rdircx
2rsirdx
3rdxr8
4rcxr9
5r8stack
6r9stack

Return value is in rax (and rdx for 128-bit) in both ABIs.

Callee-saved registers

  • System V: rbx, rbp, r12r15 must be preserved.
  • Microsoft x64: rbx, rbp, rdi, rsi, r12r15, plus a 32-byte shadow space the caller reserves on the stack.

Why it matters

When a decompiler mislabels arguments, check which ABI the binary targets: seeing rcx/rdx/r8/r9 set before a call strongly implies the Microsoft convention (Windows), while rdi/rsi/rdx implies System V.