What is the Stack?
- The stack is a region of process memory used for:
- Function call bookkeeping (return addresses)
- Local variables
- Saved registers and spilled temporaries
- Passing extra function arguments
- It is a LIFO structure: Last In, First Out.
- On x86-64 the stack grows toward lower addresses.
- Two registers govern it:
RSP— the stack pointer, always points to the top of the stack.RBP— the base pointer (frame pointer), a stable anchor for the current frame.
Key Takeaway
The stack is the scratchpad of every running function. Master it and disassembly stops looking like noise.