{{Short description|Computer assembly language instruction}} {{More citations needed |date=May 2024}} '''INT''' is an assembly language instruction for x86 processors that generates a software interrupt. It takes the interrupt number formatted as a byte value.<ref name="intel-ref"> {{cite book |url=https://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf |access-date=2024-05-23 |title=Intel® 64 and IA-32 Architectures Software Developer's Manual |volume=2 |date=March 2024 |publisher=Intel Corporation |page=3-520}}</ref>

When written in assembly language, the '''instruction''' is written like this:

:<code>INT ''X''</code>

where <code>''X''</code> is the '''''software interrupt''''' that should be generated (0-255).

As is customary with machine binary arithmetic, interrupt numbers are often written in hexadecimal form, which can be indicated with a prefix ''0x'' or with the suffix ''h''. For example, <code>INT 13H</code> will generate the 20th '''''software interrupt''''' (hexadecimal 0x13 is nineteen (19) in decimal notation; the count starts at 0), causing the function pointed to by the 20th vector in the interrupt table to be executed.

'''INT''' is widely used in real mode. In protected mode, '''INT''' is a privileged instruction.<ref name="intel-ref"></ref>

== Real mode == A ''software interrupt'' is a long call that also saves the processor status. All interrupts have an 8-bit interrupt number associated with them. This number is used to look up a segment:offset in a 256 element interrupt vector table stored at addresses 0-3FFH. When a software interrupt is encountered in real mode, the processor status is pushed, CS and IP are pushed, and the interrupt number is multiplied by four to index a new execution address which is loaded from the vector table. It is entirely possible to use a far-call instruction to start the interrupt-function manually after pushing the flag register. Interrupt routines typically end with a <code>IRET</code> instruction.

An example of a useful DOS ''software interrupt'' was interrupt 0x21. By calling it with different parameters in the registers (mostly ah and al) you could access various IO operations, string output and more.<ref>[https://www.pcmag.com/encyclopedia/term/int-21 Definition of: int 21]</ref>

Most Unix systems and derivatives do not use ''software interrupts'', with the exception of interrupt 0x80, used to make system calls before the mid-2000s. 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'''&nbsp;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&nbsp;XXh''' instructions are encoded using two bytes. This makes them unsuitable for use in patching instructions (which can be one byte long); see SIGTRAP.

The opcode for INT3 is <code>0xCC</code>, as opposed to the opcode for INT <var>immediate8</var>, which is <code>0xCD <var>immediate8</var></code>. Since the dedicated <code>0xCC</code> 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 <code>0xCD&nbsp;0x03</code> opcode from mnemonics.<ref name="intel-ref" />

== INTO == The '''INTO'''&nbsp;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. This implicitly indicates interrupt #4.

The opcode for INTO is <code>0xCE</code>, however it is unavailable in x86-64 mode.

== INT1 == The '''INT1'''&nbsp;instruction is a one-byte-instruction defined for as a hardware debug trap.

The opcode for INT1 is <code>0xF1</code>, as opposed to the opcode for INT 1, which is <code>0xCD 0x01</code>. INT1 generates a debug exception (#DB) without setting any bits in DR6. Hardware vendors may use the INT1 instruction for hardware debug. Intel recommends software vendors continue to use the INT3 instruction for software breakpoints.<ref name="intel-ref" /> Not implemented in processors before the 80386.

== See also == *INT 10H *INT 13H *DOS API *Interrupt *BIOS interrupt call *Ralf Brown's Interrupt List

==References== {{reflist}}

Category:X86 instructions Category:Interrupts