LOGBOOK

HELP

Quiz Entry - updated: 2026.07.14

What do push and pop actually do internally?

push subtracts 8 from %rsp then writes the value there; pop reads from %rsp then adds 8 back.

push decrements rsp by 8 then writes the value; pop reads the value then adds 8 back; the stack grows downward toward lower addresses

* push = rsp minus 8 then store; pop = load then rsp plus 8, because the stack grows toward lower addresses. *

push %rbx

is equivalent to:

sub $8, %rsp
mov %rbx, (%rsp)
pop %rbx

is equivalent to:

mov (%rsp), %rbx
add $8, %rsp

Key detail: The stack grows downward (toward lower addresses). So push subtracts and pop adds.

On x86_64, push/pop always move 8 bytes. On 32-bit x86, they move 4 bytes.

Go deeper:

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