What is each x86-64 register's conventional role and who saves it?
Every general-purpose register has a fixed role under the System V calling convention — argument slot, return value, or general-purpose — and is designated either caller-saved or callee-saved.
This table is the master reference that ties together arguments, return values, and the save responsibilities from the previous cards:
| Register | Role | Saved by |
|---|---|---|
| %rax | return value | caller |
| %rbx | general purpose | callee |
| %rdi, %rsi, %rdx, %rcx | args 1–4 | caller |
| %r8, %r9 | args 5–6 | caller |
| %r10, %r11 | temporaries | caller |
| %r12–%r15 | general purpose | callee |
| %rbp | frame pointer (optional) | callee |
| %rsp | stack pointer | special |
Mnemonic for the argument order: the first four integer args go in rdi, rsi, rdx, rcx — read as "Destination, Source, Data, Count," echoing the old 8086 string-instruction roles of those registers.
Tip: when reverse engineering, a value parked in a callee-saved register (%rbx, %r12–%r15) is almost always an important local the function preserves across calls; caller-saved registers tend to hold short-lived temporaries.
Go deeper:
x86 calling conventions (Wikipedia) — the master reference for register roles and save responsibility.