Interrupts
| The INT instruction | |
| int 0x80: the 32-bit path | |
| Interrupt handlers |
The INT instruction
INT n triggers software interrupt n: the CPU saves state and jumps to the handler the interrupt table names. DOS programs used INT 21h for every service, and 32-bit Linux used INT 80h for syscalls:
mov eax, 4 ; sys_write (32-bit)
int 0x80 ; old 32-bit Linux syscall
int 0x80: the 32-bit path
On 64-bit Linux, int 0x80 still works but truncates arguments to 32 bits. The SYSCALL instruction is the 64-bit path: faster, and with a different register assignment (RAX, RDI, RSI, RDX, R10, R8, R9).
Interrupt handlers
Hardware interrupts (keyboard, timer, disk) arrive through the same mechanism. Writing a handler means filling an interrupt descriptor table entry and preserving every register the caller expects intact - which is why user-space programs almost never install their own.
Next: Sockets
Article author: Arthur Isaev