Quiz Entry - updated: 2026.07.14
How are Linux system calls invoked on IA32 (32-bit), and how does it differ from x86_64?
Put the syscall number in %eax and arguments in %ebx, %ecx, %edx, %esi, %edi, %ebp, then execute the software interrupt int $0x80 (not syscall).
The legacy 32-bit mechanism traps into the kernel with a software interrupt rather than a dedicated instruction:
| Register | Purpose |
|---|---|
%eax |
System-call number |
%ebx |
Argument 1 |
%ecx |
Argument 2 |
%edx |
Argument 3 |
%esi |
Argument 4 |
%edi |
Argument 5 |
%ebp |
Argument 6 |
mov $1, %eax # syscall 1 = exit (on IA32!)
mov $0, %ebx # status = 0
int $0x80 # trap into the kernel
Differences from x86_64 — three things change at once:
- Instruction:
int $0x80instead ofsyscall. - Registers: a completely different set (
%ebx,%ecx,…). - Numbers: the syscall numbers themselves differ — e.g.
exitis 1 on IA32 but 60 on x86_64;writeis 4 on IA32 but 1 on x86_64.
Gotcha: %esp can't carry an argument — the CPU overwrites it when switching to kernel mode.
Go deeper:
System call (Wikipedia) — system calls overview.
syscall(2) — Linux manual page — int 0x80 vs syscall and the per-arch register sets.