Table of Contents

IronForgeCyber

Courses

Resources

Blog

Log In



IronForgeCyber

AboutPrivacyTerms

© 2026 IronForgeCyber. All rights reserved.

  1. courses
  2. asm-101
  3. i386
3 min read

32-bit x86 (i386)

This is a diff against the x86-64 you just learned, not a re-teach. It covers only what changes when you drop to 32-bit.

Before x86-64 there was plain 32-bit x86 — i386. Everything conceptual carries over: registers, the stack, instructions, flags, jumps. What changes is a handful of concrete details, and knowing them lets you read 32-bit code (and the older exploitation material built on it) without relearning anything.

Registers

The registers are 32 bits wide and there are only eight general-purpose ones: eax, ebx, ecx, edx, esi, edi, esp, ebp. The sub-register names still work downward — ax, al — but there is no 64-bit r?x layer above them, and no r8–r15 at all. With half as many registers, 32-bit code spills far more often to the stack. There is also no REX prefix (that byte exists only to reach 64-bit operands and the extended registers, neither of which exist here).

The cdecl Calling Convention

This is the biggest change. Where x86-64 passes the first six arguments in registers, 32-bit Linux uses cdecl: arguments are pushed onto the stack, right to left, and the caller cleans them up afterward. The return value still comes back in eax.

nasm
1push dword 2        ; second argument
2push dword 1        ; first argument
3call add_two
4add  esp, 8         ; caller removes the two arguments

So the stack-and-calls picture you built is even more central in 32-bit: arguments, locals, and the return address all live there.

Syscalls via int 0x80

32-bit code enters the kernel the old way, with the int 0x80 software interrupt from System Calls. Three things differ from syscall: the registers are the 32-bit set (number in eax, arguments in ebx, ecx, edx, esi, edi), the instruction is int 0x80, and the syscall numbers are different — write is 4 and exit is 1, not 1 and 60. Here is a 32-bit "hello" disassembled:

objdump
$ objdump -d -M intel hello3208049000 <_start>: 8049000:       b8 04 00 00 00          mov    eax,0x4 8049005:       bb 01 00 00 00          mov    ebx,0x1 804900a:       b9 00 a0 04 08          mov    ecx,0x804a000 804900f:       ba 13 00 00 00          mov    edx,0x13 8049014:       cd 80                   int    0x80 8049016:       b8 01 00 00 00          mov    eax,0x1 804901b:       31 db                   xor    ebx,ebx 804901d:       cd 80                   int    0x80
shell
$ ./hello32Hello from 32-bit!

Everything a 64-bit reader expects is shifted: eax = 4 (write, not 1), the arguments in ebx/ecx/edx, and cd 80 (int 0x80) in place of syscall. Notice too the addresses — _start sits at 0x8049000, because a non-PIE 32-bit executable loads at base 0x08048000, the 32-bit counterpart to 64-bit's 0x400000.

No RIP-relative Addressing

x86-64 can address data as an offset from rip, which is what makes modern position-independent code cheap. 32-bit has no eip-relative addressing — an instruction that touches memory names an absolute address, which you can see baked into the disassembly above (mov ecx, 0x804a000 points straight at the string). Position-independent 32-bit code therefore has to do an awkward dance (call a thunk to read eip, then index a GOT through ebx), which is one reason 32-bit PIE is clumsier and rarer than its 64-bit form.

Where You'll Actually Meet 32-bit

Legacy software, embedded targets, and — most relevant here — a great deal of CTF and exploitation material. Many foundational techniques were developed on 32-bit, where the stack-based calling convention puts arguments and return addresses in especially convenient places; the Binary Exploitation course uses 32-bit targets for several lessons precisely for that clarity.

The int 0x80 path and its distinct syscall numbers are introduced in System Calls; this lesson is where they actually come up.