Master the fundamental concepts of instruction set architecture through this focused micro-challenge.
On Linux and macOS, compiled C functions follow the System V AMD64 ABI. The first six integer or pointer arguments arrive in registers; additional args sit on the stack. Return values land in RAX (integer) or XMM0 (float).
| Arg | Register |
|---|---|
| 1st | RDI |
| 2nd | RSI |
| 3rd | RDX |
| 4th | RCX |
| 5th | R8 |
| 6th | R9 |
cLoading…
For this exercise, you will trace a function call in assembly and label which registers hold arguments and return values. This task asks you to read the ABI the way Ghidra does when it recovers main's parameters from a stripped binary.
Keep the relevant datasheet, ISA manual, or architecture textbook chapter open while you implement. When your output disagrees with the reference trace on the same program, the bug is usually a mis-decoded opcode, a stale register read, or a flag bit left unchanged after arithmetic.
For this exercise, you will use those habits while implementing the requirement in the starter code. Microarchitectural product names change across CPU generations, but the control ideas (fetch, bypass, cache lines, vector lanes) stay stable enough to debug from first principles.
Read and summarize x86-64 System V ABI calling conventions.
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 Github