Interrupt Vector Table

From OSDev.wiki
Revision as of 21:27, 22 March 2009 by osdev>Troy martin (Changed as per the talk page, please do not revert without a valid approved reason :))
Jump to navigation Jump to search

On the x86 architecture, the Interrupt Vector Table (IVT) is a table that specifies the addresses of all the 256 interrupt handlers used in real mode.

The IVT is typically located at 0000:0000H, and is 400H bytes in size (4 bytes for each interrupt). Although the default address can be changed using the LIDT instruction on newer CPUs, this is usually not done because it is both inconvenient and incompatible with other implementations and/or older software (e.g. MS-DOS programs). However, note that the code must remain in the first MiB of RAM.

Structure

The entries are consecutive, meaning the first entry pointed by the IDTR is interrupt handler 0, and the others follow in succession. The format of an entry is:

 +-----------+-----------+
 |  Segment  |  Offset   |
 +-----------+-----------+
 4           2           0

We can therefore see that it's really easy to get the address of the interrupt handler we're looking for: IDTR * 4. In order to change an interrupt handler, all that needs to be done is to change its address in the table.

See also