INT (x86 instruction)


INT is an assembly language instruction for x86 processors that generates a software interrupt. It takes the interrupt number formatted as a byte value.
When written in assembly language, the instruction is written like this:
where X is the software interrupt that should be generated.
Depending on the context, compiler, or assembler, a software interrupt number is often given as a hexadecimal value, sometimes with a prefix 0x or the suffix h. For example, INT 13H will generate the software interrupt 0x13, causing the function pointed to by the 20th vector in the interrupt table to be executed, which is typically a DOS API call.

Real mode

When generating a software interrupt, the processor calls one of the 256 functions pointed to by the interrupt address table, which is located in the first 1024 bytes of memory while in real mode. It is therefore entirely possible to use a far-call instruction to start the interrupt-function manually after pushing the flag register.
One of the most useful DOS software interrupts was interrupt 0x21. By calling it with different parameters in the registers you could access various IO operations, string output and more.
Most Unix systems and derivatives do not use software interrupts, with the exception of interrupt 0x80, used to make system calls. This is accomplished by entering a 32-bit value corresponding to a kernel function into the EAX register of the processor and then executing INT 0x80.

INT3

The INT3 instruction is a one-byte-instruction defined for use by debuggers to temporarily replace an instruction in a running program in order to set a code breakpoint. The more general INT XXh instructions are encoded using two bytes. This makes them unsuitable for use in patching instructions ; see SIGTRAP.
The opcode for INT3 is 0xCC, as opposed to the opcode for INT immediate8, which is 0xCD immediate8. Since the dedicated 0xCC opcode has some desired special properties for debugging, which are not shared by the normal two-byte opcode for an INT3, assemblers do not normally generate the generic 0xCD 0x03 opcode from mnemonics.

INTO

The INTO instruction is another one-byte-instruction. It is a conditional interrupt which is triggered when the overflow flag is set at the time of executing this opcode.
The opcode for INTO is 0xCE.