LOGBOOK

HELP

Quiz Entry - updated: 2026.07.14

What are the x86_64 argument-passing registers and which are caller-saved vs callee-saved?

The first six integer/pointer arguments go in %rdi, %rsi, %rdx, %rcx, %r8, %r9; the return value comes back in %rax. %rbx, %rbp, %r12-%r15 are callee-saved, the rest caller-saved.

First six integer/pointer args go in %rdi,%rsi,%rdx,%rcx,%r8,%r9 (return in %rax); caller-saved set is %rax,%rcx,%rdx,%rsi,%rdi,%r8-r11; callee-saved is %rbx,%rbp,%r12-r15.

* System V AMD64 ABI: args in %rdi,%rsi,%rdx,%rcx,%r8,%r9; return in %rax. Argument registers are caller-saved (volatile); a push %rbx at entry signals a callee-saved register. *

Argument Register
1st %rdi
2nd %rsi
3rd %rdx
4th %rcx
5th %r8
6th %r9
Return %rax

Caller-saved (function may clobber — save before call if needed): %rax, %rcx, %rdx, %rsi, %rdi, %r8-%r11

Callee-saved (function must preserve — save at entry, restore before ret): %rbx, %rbp, %r12-%r15

Tip: If you see push %rbx at the start of a function and pop %rbx at the end, the function uses %rbx internally and must preserve it (callee-saved).

Go deeper:

From Quiz: REVE1 / Assembly Patterns & GDB | Updated: Jul 14, 2026