Intuition The one core idea
A CPU only knows registers (tiny named boxes inside the chip) and memory (a huge numbered strip outside it) — it has no idea what a "function argument" or a "return value" is. A calling convention is a pretend rulebook that two pieces of separately-compiled code both obey, so that "put the argument here, find the answer there" becomes true by mutual agreement rather than by hardware.
This page builds every word, register name, and symbol the parent note throws at you, starting from a reader who has never seen assembly. Nothing below assumes anything above it.
A register is a tiny, extremely fast storage slot inside the CPU. It holds one machine word (on x86-64 that's 64 bits = 8 bytes). There are only a handful of them, each with a fixed name like rax, rdi, rbx.
Look at the figure: the CPU is the box on the left, holding a small row of labelled cells. That's all the registers there are. Memory is the long strip on the right.
Intuition Why registers matter to calling conventions
Because there are so few of them and they are shared by everyone, the moment you call another function it might overwrite the very box you were using. The whole "who saves what" problem exists only because registers are few and shared . Everything the parent note calls "caller-saved / callee-saved" is a fight over these boxes.
The name r in rax, rdi, rsp just means "register, 64-bit". The letters after it are historical (a = accumulator, di = destination index, sp = stack pointer). Treat them as names of boxes , nothing more. See Registers and Register File for the full set.
Definition Memory and address
Memory is a long line of byte-sized cells, each with a number called its address . Address 0 is one end; addresses grow larger toward the other end. When we write [ rsp ] we mean "the memory cell whose address is the number currently in the box rsp".
The square brackets [ ⋅ ] are the single most important notation the parent uses without defining it:
Without brackets = the box's own value. With brackets = follow the box like an arrow into memory.
Reveal-test:
The value in rsp a number that is an address (a location in memory)
[rsp]the actual data stored at that location
The stack is a region of memory used as a pile of temporary values. A special register, rsp (stack pointer) , always holds the address of the top of the pile. On x86-64 the stack grows toward smaller addresses: push subtracts from rsp, pop adds to it.
This "grows downward" fact explains why the parent writes rsp ← rsp − ( frame size ) : making room means moving down .
Intuition Why a stack and not just more registers?
Functions call functions call functions (see Recursion and Activation Records ). Each needs its own private scratch space, and they must nest perfectly — the last one to start is the first to finish. A stack (last-in-first-out) is the exact shape of "nested calls", so it is the natural home for each function's local variables and saved values. The chunk one function owns is its stack frame .
Common mistake "The stack grows up, like a stack of plates."
Why it feels right: a physical stack of plates gets taller.
The fix: on x86-64 the addresses get smaller as the stack grows. The top of the stack is the lowest address in use. Push = subtract, pop = add. Draw memory with address 0 at the top and you'll see it grows down the page.
Definition rip and the four core instructions
rip (instruction pointer) : the box holding the address of the next instruction the CPU will run. Advancing through code = incrementing rip.
push X ::= subtract 8 from rsp, then store X at [rsp].
pop X ::= load X from [rsp], then add 8 to rsp.
call f ::= push the address after the call (the return address ) onto the stack, then set rip = f.
ret ::= pop a value off the stack into rip (jump back to the return address).
The symbol ≡ (or ::=) the parent uses just means "is defined to be exactly the same as ". So call f ≡ push rip_next; jmp f reads: "the call instruction is nothing but a push followed by a jump." Nothing magical — it is built from the pieces above.
Intuition Why the return address goes on the stack
When f finishes it must resume the caller. The caller's location must be recorded somewhere f can find it without prior arrangement . The stack works because f's own frame sits right on top of it — the return address is the boundary between caller and callee. This is exactly why the parent's Example 2 reads the 7th argument at [rsp+8]: [rsp] is the return address, and the argument sits just above it.
Definition Argument / return value (as a convention)
An argument is a value the caller wants to hand to the callee. A return value is the answer handed back. Neither exists in hardware — a convention invents them by declaring: "the 1st integer argument lives in rdi, the answer comes back in rax," and so on.
Definition The alignment symbol
rsp ≡ 8 ( mod 16 )
reads "rsp leaves a remainder of 8 when divided by 16 ". The notation a ≡ b ( mod m ) means a and b have the same remainder after dividing by m . Concretely: at function entry rsp should be a number like … , 8 , 24 , 40 — 8 more than a multiple of 16. This is a rule so that 16-byte-wide SSE loads land on aligned addresses.
Reveal-test:
40 ≡ 8 ( mod 16 ) ?yes — 40 = 2 × 16 + 8 , remainder 8
32 ≡ 8 ( mod 16 ) ?no — 32 is a multiple of 16, remainder 0
What is a register? A tiny fast named storage box inside the CPU, holding one 64-bit word; there are only a few.
What does rsp hold? The address of the current top of the stack.
What does [rsp+8] mean? The memory contents at the address (value in rsp) + 8.
Which direction does the stack grow on x86-64? Downward — toward smaller addresses; push subtracts from rsp, pop adds.
What does call f do, in terms of simpler pieces? Push the return address onto the stack, then jump to f (set rip = f).
What does ret do? Pop the return address off the stack into rip, resuming the caller.
Why do arguments and return values need a convention at all? The CPU has no concept of them; only agreement on fixed registers/slots makes "argument" and "return value" meaningful.
What does rsp ≡ 8 (mod 16) mean at function entry? rsp divided by 16 leaves remainder 8, so the stack was 16-aligned before the call pushed the 8-byte return address.
What does ⊂ mean in "calling convention ⊂ ABI"? "Is a part of / subset of" — the convention is one chapter of the larger ABI rulebook.