wire / wire-format / system-v-amd64-abi

System V AMD64 ABI (calling convention)

The System V AMD64 ABI is the standard calling convention for x86-64 on Linux, macOS, and most Unix systems. Integer/pointer arguments: RDI, RSI, RDX, RCX, R8, R9 (first 6), then stack. Floating-point arguments: XMM0-XMM7 (first 8), then stack. Return value: RAX (integer), XMM0 (float). Caller-saved: RAX, RCX, RDX, RSI, RDI, R8-R11. Callee-saved: RBX, RBP, R12-R15. Stack: 16-byte aligned before CALL. Red zone: 128 bytes below RSP (not clobbered by signal handlers).

wire-format kind wire-format status standard verification verified tier B wire-format@1

aka: System V AMD64 ABI (calling convention)

wire format

spec: System V Application Binary Interface (AMD64)

The System V AMD64 ABI is the standard calling convention for x86-64 on Linux, macOS, and most Unix systems. Integer/pointer arguments: RDI, RSI, RDX, RCX, R8, R9 (first 6), then stack. Floating-point arguments: XMM0-XMM7 (first 8), then stack. Return value: RAX (integer), XMM0 (float). Caller-saved: RAX, RCX, RDX, RSI, RDI, R8-R11. Callee-saved: RBX, RBP, R12-R15. Stack: 16-byte aligned before CALL. Red zone: 128 bytes below RSP (not clobbered by signal handlers).

fieldsizemeaning
Integer args6 registersRDI, RSI, RDX, RCX, R8, R9 (in order). Additional args on stack (right-to-left).
Float args8 registersXMM0-XMM7. Additional args on stack.
Integer returnRAXReturn value in RAX (and RDX for 128-bit).
Float returnXMM0Return value in XMM0 (and XMM1 for complex/long double).
Caller-savedregistersRAX, RCX, RDX, RSI, RDI, R8-R11. Caller must save if needed across calls.
Callee-savedregistersRBX, RBP, R12-R15. Callee must save/restore if used.
Stack alignment16 bytesRSP must be 16-byte aligned before a CALL instruction.
Red zone128 bytes128 bytes below RSP are not clobbered by signal handlers or interrupt handlers. Leaf functions can use this without adjusting RSP.
VarargsAL registerFor variadic functions, AL = number of XMM registers used (0-8).

example:

55 48 89 e5

Function prologue: PUSH rbp; MOV rbp, rsp


provenance

agent: curl -H 'accept: application/json' wire.phall.io/wire-format/system-v-amd64-abi or /wire-format/system-v-amd64-abi.json