Interrupt vector table

Also known as: IVT

On this page 7

An interrupt vector table (IVT) is a table in memory that maps interrupt numbers to handler addresses, so that the processor knows exactly which code to run when a hardware interrupt, exception or software trap occurs. In the area of drivers & devices, it is the first link in the chain that connects a device signal to the interrupt service routine inside a driver.

Each entry is called a vector, and the index of the entry is the vector number. The term originates from the fixed table of the original Intel 8086, but it is widely used for the equivalent structure on any architecture, including the Interrupt Descriptor Table on modern x86 processors and the vector tables of ARM cores.

How the processor uses the interrupt vector table

When an interrupt arrives, the processor performs a hardware-defined dispatch sequence without any help from software. It finishes or abandons the current instruction, saves the minimal state needed to resume, obtains the vector number, reads the matching table entry and jumps to the stored handler address, usually after switching to a privileged mode.

The vector number comes from different sources depending on the event. Exceptions such as division by zero or a page fault have fixed numbers defined by the architecture, software traps carry the number in the instruction itself, and external device interrupts receive their number from an interrupt controller such as the APIC on x86 or the GIC on ARM.

The following table shows where the vector number originates for each class of event.

Event classExampleSource of the vector number
Processor exceptionPage fault, invalid opcodeFixed by the CPU architecture
Software interrupt or trapint 0x80, svcEncoded in the instruction
External device interruptNetwork card, disk controllerProgrammed into the interrupt controller
Message signaled interruptPCI Express deviceWritten in the message data by the device
Inter-processor interruptTLB shootdown, rescheduleChosen by the sending kernel
Sources of vector numbers

Real-mode IVT versus protected-mode IDT

On x86, the term has a narrow historical meaning and a broader general one. The original real-mode IVT is a fixed array at physical address 0x00000 to 0x003FF, holding 256 entries of 4 bytes, each a segment and offset pair. BIOS services such as int 0x10 for video and int 0x13 for disk access relied on it.

Protected-mode and 64-bit x86 systems replace it with the Interrupt Descriptor Table (IDT), whose location is set by the lidt instruction and whose entries also carry privilege levels and stack-switching information. The comparison below summarizes the differences.

PropertyReal-mode IVT64-bit IDT
LocationFixed at address 0Anywhere, set by lidt
Entry size4 bytes16 bytes
Number of entries256256
Entry contentsSegment and offset onlyHandler address, privilege, gate type, stack index
Access controlNoneDescriptor privilege level per gate
Typical usersBIOS, DOS, boot codeWindows, Linux, macOS kernels
Comparison of x86 interrupt tables

Vector tables on other architectures

The idea of a lookup table for interrupt entry points appears on nearly every processor family, but its layout varies. Some designs store addresses, while others store short blocks of executable code at fixed offsets.

The table below compares common implementations that operating system and firmware developers encounter.

ArchitectureTable formLocation controlNotes
ARMv8-A (AArch64)16 code slots of 128 bytesVBAR_ELx register per exception levelSlots split by exception type and origin
ARM Cortex-MArray of handler addressesVTOR registerEntry 0 holds the initial stack pointer
RISC-VSingle handler or vectored jumpsmtvec and stvec registersMode bit selects direct or vectored
x86-64Array of 16-byte gate descriptorsIDTR registerCalled IDT rather than IVT
Vector table designs by architecture

How drivers connect to the vector table

Device drivers in modern operating systems never write vector table entries directly. The kernel owns the table and installs small, generic entry stubs in every slot; a driver then registers its handler through an API such as request_irq() on Linux or IoConnectInterrupt and the newer IoConnectInterruptEx on Windows.

When the interrupt fires, the stub saves registers, identifies the interrupt line and calls every handler registered for it, which allows shared interrupt lines among several devices. This two-level design keeps the table under kernel control and lets the kernel add accounting, interrupt latency measurement and deferred processing in one place.

  • Top half: the short handler reached from the vector, which acknowledges the device and schedules further work.
  • Bottom half: deferred work such as softirqs, tasklets, workqueues or Windows DPCs that runs with interrupts enabled.
  • MSI and MSI-X: give each device queue its own vector, reducing the need to share lines.

Security and reliability risks

Because every interrupt passes through it, the vector table is a high-value target for attackers and a frequent cause of hard-to-diagnose crashes. Rootkits once hooked IDT entries to intercept system calls, which led Windows to protect the table with Kernel Patch Protection on 64-bit editions. Modern kernels also map the table read-only after initialization, and hypervisor-based protections can block any later change to the table base register.

The table below lists typical failures and the defenses that kernel developers apply against them.

ProblemEffectMitigation
Overwritten entryJump to attacker code or crashRead-only mapping and integrity checks
Missing handler for a vectorDouble fault or triple fault resetInstall default handlers for all entries
Exhausted vectors on large systemsDevices cannot receive interruptsPer-CPU tables and MSI-X allocation
Wrong table base after bootImmediate system hangSet the base register early in startup
Vector table problems and their mitigation

The simple explanation

An interrupt vector table is like the emergency contact list on a hospital wall. When an alarm goes off, the staff do not search for help; they look up the alarm number and call the listed person at once.

The processor does the same thing. Each kind of interruption has a number, and the table tells the processor exactly which piece of code to run for that number, without any delay or guesswork.

How it is used in practice

An embedded engineer builds firmware for a motor controller based on an ARM Cortex-M4 microcontroller. The linker places the vector table at the start of flash memory: entry 0 holds the initial stack pointer, entry 1 the reset handler, and further entries point to handlers for the timer, the UART and an encoder input.

To support field updates, the engineer adds a bootloader that occupies the first 32 KiB of flash. After verifying the application image, the bootloader writes the application’s table address into the VTOR register and jumps to its reset handler. From then on, every timer tick reaches the application’s own handler, and firmware updates no longer require a programmer cable.