Master the fundamental concepts of x86 assembly (intel syntax) through this focused micro-challenge.
Each call pushes a return address; each function builds a frame below that. rsp points at the stack top; rbp anchors locals at fixed negative offsets. GDB backtraces, stack overflows, and ROP gadgets all read this layout.
nasmLoading…
[rbp-8], [rbp-16], etc.mov rsp, rbp; pop rbpcall for SSEStep through nested calls and watch rbp chain to older frames:
For this exercise, you will write functions with a standard prologue/epilogue and address locals through rbp. This task asks you to maintain 16-byte alignment across calls, because misaligned stacks surface as mysterious crashes inside libc printf on the next call.
Keep the relevant man page, ABI doc, or Rust reference chapter open while you work. When your output disagrees with the reference implementation on the same machine, the mismatch is usually an alignment rule, an off-by-one terminator, or a register slot you misread in GDB. Skim the official documentation for the tool or ABI named in the exercise; the prose changes, but register roles, syscall numbers, and ownership rules stay stable across releases.
Write functions demonstrating proper stack frame management.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Githubx86-64 Stack Frame Layout — Step 1 of 8
Program starts. The stack is empty. RSP points to the top of the stack (highest address).