This articleneeds additional citations forverification. Please helpimprove this article byadding citations to reliable sources. Unsourced material may be challenged and removed. Find sources: "INT" x86 instruction – news ·newspapers ·books ·scholar ·JSTOR(May 2024) (Learn how and when to remove this message) |
INT is anassembly language instruction forx86processors that generates asoftware interrupt. It takes the interrupt number formatted as abyte value.[1]
When written in assembly language, theinstruction is written like this:
INTX
whereX
is thesoftware interrupt that should be generated (0-255).
As is customary with machine binary arithmetic, interrupt numbers are often written inhexadecimal form, which can be indicated with a prefix0x or with the suffixh. For example,INT 13H
will generate the 20thsoftware interrupt (0x13 is nineteen (19) in hexadecimal notation, and the count starts at 0), causing the function pointed to by the 20th vector in theinterrupt table to be executed.
INT is widely used inreal mode. Inprotected mode,INT is aprivileged instruction.[1]
When generating asoftware 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 inreal mode (seeinterrupt vector). It is therefore entirely possible to use a far-call instruction to start the interrupt-function manually after pushing the flag register.
An example of a useful DOSsoftware 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.[2]
MostUnix systems and derivatives do not usesoftware interrupts, with the exception of interrupt 0x80, used to makesystem 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.
TheINT3 instruction is a one-byte-instruction defined for use bydebuggers to temporarily replace an instruction in a running program in order to set a codebreakpoint. The more generalINT XXh instructions are encoded using two bytes. This makes them unsuitable for use in patching instructions (which can be one byte long); seeSIGTRAP.
The opcode for INT3 is0xCC
, as opposed to the opcode for INTimmediate8, which is0xCDimmediate8
. Since the dedicated0xCC
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 generic0xCD 0x03
opcode from mnemonics.[1]
TheINTO instruction is another one-byte-instruction. It is a conditionalinterrupt 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 is0xCE
, however it is unavailable in x86-64 mode.