INT (x86 instruction)

INT (x86 instruction)

INT is an assembly language instruction for x86 processors for generating a software interrupt. It takes one argument that must be a constant byte value. [cite web |url=http://developer.intel.com/design/pentiumii/manuals/243191.htm|title=Intel Architecture Software Developer's Manual, Volume 2: Instruction Set Reference Manual|accessdate=2007-07-13] (This should not be confused with the concept of a hardware interrupt.) Depending on the writer and the context, a software interrupt is usually referred to in hexadecimal, either with a prefix "0x" or the suffix "h" (i.e. interrupt 0x21, interrupt 21h).

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

:INT "X"

Where "X" is the software interrupt that should be generated. For example:

:INT 0x40

Will generate interrupt 0x40. (See hexadecimal)

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 (See Interrupt vector). It is therefore entirely possible to use an x86-call instruction to call the interrupt-function manually.

One of the most useful DOS software interrupts 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. A common computer virus behavior for computers running DOS was to hook the 0x21 interrupt by modifying the interrupt address table so that the virus code would be called before the interrupt. Then, an unsuspecting program would call the 0x21 interrupt and request for a file to be opened. The virus would check if the requested file was an executable, and then insert its code into it.

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.

INT 3

The INT 3 instruction is defined for use by debuggers to temporarily replacean instruction in a running program, in order to set a breakpoint. Other INT instructionsare encoded using two bytes. This makes them unsuitable for use in patching instructions (which can be one byte long).

The opcode for INT 3 is 0xCC, as opposite from the opcode for INT "immediate"', which is 0xCD imm8. According to Intel documentation: "Intel and Microsoft assemblers will not generate the CD03 opcode from any mnemonic" and 0xCC has some special features, which are not shared by "the "normal" 2-byte opcode for INT 3 (CD03)" [IA-32 Arch. Software Developer’s Manual. Vol. 2A]

See also

*INT 10
*INT 13
*Interrupt
*BIOS interrupt call
*Ralf Brown's Interrupt List

References


Wikimedia Foundation. 2010.

Игры ⚽ Нужно решить контрольную?

Look at other dictionaries:

  • INT 13 — is shorthand for interrupt 0x13, the 20th interrupt vector in an x86 based computer system. (Interrupts start at zero, and are labeled with hexadecimal values.) INT is an x86 instruction that triggers a software interrupt, and 0x13 is the vector… …   Wikipedia

  • INT — may refer to: * Isaac Newton Telescope, an optical telescope in the Canary Islands * International, will effect globally * Institut National des Télécommunications, a French higher education institute * INT Management, a French Grande Ecole,… …   Wikipedia

  • X86 assembly language — is the assembly language for the x86 class of processors, which includes Intel s Pentium series and AMD s Athlon series. Like all assembly languages, it uses short mnemonics to represent the fundamental operations that the CPU in a computer can… …   Wikipedia

  • X86-64 — is a superset of the x86 instruction set architecture. x86 64 processors can run existing 32 bit or 16 bit x86 programs at full speed, but also support new programs written with a 64 bit address space and other additional capabilities.The x86 64… …   Wikipedia

  • X86 memory segmentation — refers to the implementation of memory segmentation on the x86 architecture. Memory is divided into portions that may be addressed by a single index register without changing a 16 bit segment selector. In real mode or V86 mode, a segment is… …   Wikipedia

  • X86 calling conventions — This article describes the calling conventions used on the x86 architecture.Calling conventions describe the interface of called code: * The order in which parameters are allocated * Where parameters are placed (pushed on the stack or placed in… …   Wikipedia

  • Jeu d'instruction x86 — Article détaillé : Jeu d instructions. Le jeu d instructions du x86 a subi de nombreux changements au cours du temps. La plupart d entre eux ne sont que des ajouts au jeu d instruction initial afin d apporter de nouvelles fonctionnalités.… …   Wikipédia en Français

  • Lenguaje ensamblador x86 — El lenguaje ensamblador x86 es la familia de los lenguajes ensambladores para los procesadores de la familia x86, que incluye desde los procesadores Intel 8086 y 8088, pasando por los Pentium de Intel y los Athlon de AMD y llegando hasta los… …   Wikipedia Español

  • Jeu D'instruction X86 — Article détaillé : Jeu d instructions. Le jeu d instructions du x86 a subi de nombreux changements au cours du temps. La plupart d entre eux ne sont que des ajouts au jeu d instruction initial afin d apporter de nouvelles fonctionnalités.… …   Wikipédia en Français

  • IF (x86 flag) — IF (Interrupt Flag) is a system flag bit in the x86 architecture s FLAGS register, which determines whether or not the CPU will handle maskable hardware interrupts.cite web |url=http://download.intel.com/design/PentiumII/manuals/24319102.PDF|forma… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”