#Why this matters
When a compiled binary has no source code or symbol names, a disassembler still shows every instruction the processor executes. To read that output, you must know where the CPU keeps working values and how functions pass arguments. Tracking registers, memory addresses, and stack frames turns an unfamiliar function into clear inputs and logic checks.
#Registers: the CPU's workbench
A CPU register is a small, fast storage slot inside the processor core. On x86-64, general-purpose registers are 64 bits wide, and instructions can address smaller slices of the same hardware register: RAX (64 bits), EAX (lower 32 bits), AX (16 bits), and AL (8 bits). Writing to a 32-bit register such as EAX automatically zeroes the upper 32 bits of RAX, whereas writing to AX or AL leaves the upper bits untouched.
| Register | Typical role in x86-64 |
|---|---|
RAX |
Function return value, arithmetic accumulator |
RDI, RSI, RDX, RCX |
Integer arguments (order depends on OS ABI) |
RSP |
Stack pointer (top of stack) |
RBP |
Frame pointer for local variables |
RIP |
Instruction pointer (next instruction address) |
RFLAGS |
Condition flags: ZF (zero), CF (carry), SF (sign), OF (overflow) |
On 64-bit ARM (AArch64), general-purpose registers are X0-X30 (32-bit aliases W0-W30), SP is the stack pointer, PC is the program counter, and NZCV holds status flags.
#Memory addressing and little-endian order
Arrays and structures live in RAM rather than registers. On x86, x86-64, and standard Linux/Windows ARM64 systems, multi-byte integers use little-endian byte order: the least significant byte sits at the lowest address. Thus, 0x12345678 at 0x1000 appears in a hex dump as 78 56 34 12.
In Intel-syntax assembly, square brackets [...] dereference a memory address using [base + index*scale + displacement] (scale is 1, 2, 4, or 8):
mov eax, [rbp - 0x10]loads 4 bytes from stack addressrbp - 0x10.mov edx, [rdi + rcx*4]loads elementrcxfrom a 32-bit array atrdi.lea rax, [rdi + rcx*4 + 8](Load Effective Address) computes the address itself and stores that number inraxwithout reading RAM.
The call stack grows downward toward lower addresses: push subtracts 8 from RSP and writes [RSP]; pop reads [RSP] and adds 8.
#Calling conventions across platforms
A calling convention (part of the platform ABI) defines how functions pass arguments, return results, and preserve registers.
| Feature | System V AMD64 (Linux, macOS x64) | Microsoft x64 (Windows) | AArch64 AAPCS64 (ARM64) |
|---|---|---|---|
| First 4 integer args | RDI, RSI, RDX, RCX |
RCX, RDX, R8, R9 |
X0, X1, X2, X3 |
| Extra register args | R8, R9 (then stack) |
Stack (after 4th arg) | X4-X7 (then stack) |
| Return value | RAX |
RAX |
X0 |
| Callee-saved regs | RBX, RBP, R12-R15 |
RBX, RBP, RDI, RSI, R12-R15 |
X19-X29 |
| Stack rule | 16-byte alignment before call |
32-byte shadow space by caller | X30 (LR) holds return address |
$ objdump -d -M intel ./starter_crackme | grep -A 9 "<check_pin>:"
0000000000001149 <check_pin>:
1149: 55 push rbp
114a: 48 89 e5 mov rbp,rsp
114d: 89 7d fc mov DWORD PTR [rbp-0x4],edi
1150: 81 7d fc 39 05 00 00 cmp DWORD PTR [rbp-0x4],0x539
1157: 0f 94 c0 sete al
115a: 0f b6 c0 movzx eax,al
115d: 5d pop rbp
115e: c3 retHere check_pin copies its first argument (edi) to [rbp-0x4], compares it to 0x539, sets al to 1 on equality (sete al), zero-extends al into eax, and returns.
#Common mistakes
- Reading memory bytes as big-endian. Reverse multi-byte values from little-endian dumps (
39 05 00 00equals0x00000539, not0x39050000). - Confusing
leawithmov.lea rax, [rdi + 8]adds8tordiwithout reading RAM. - Forgetting zero-extension on 32-bit writes.
mov eax, 1clears bits 32-63 ofRAX, whilemov al, 1preserves bits 8-63. - Mixing up System V and Windows x64 arguments. Linux passes arg1 in
RDI; Windows usesRCXwith 32-byte shadow space.
#Summary
Registers hold active operands, with 32-bit aliases like EAX zero-extending into RAX. Multi-byte integers in RAM use little-endian order, and [base + index*scale + disp] expressions calculate addresses for mov or lea. Platform calling conventions tell you which registers carry arguments and return values in any disassembly listing.