Fact-checked by Grok 2 weeks ago

Vectored interrupt

A vectored interrupt is a type of hardware mechanism in where an interrupting device or event supplies the with a unique number or that directly points to the of the corresponding service routine (), stored in an . This approach contrasts with non-vectored interrupts, which require the to execute a common handler that polls multiple devices to identify the source, introducing and inefficiency. Vectored interrupts enable faster response times by automating source identification through dedicated hardware connections or vector provision, making them essential in modern microprocessors for handling asynchronous events like I/O requests or timers. In operation, when an interrupt occurs, the device's controller sends its assigned vector number to the , which uses this to index the —an array of pointers or addresses typically located in or system memory—and loads the associated handler's starting address into the (PC). The vector table is initialized during system startup, either manually by assigning fixed vectors to devices or automatically through hardware polling to detect and configure sources. For the interrupt to be serviced, several conditions must be satisfied, including the device being armed, the interrupt controller (e.g., NVIC in ARM-based systems) enabled, global interrupts active, and the interrupt's exceeding the current level. Upon handler execution, the saves the current (e.g., PC and status registers) to allow resumption after handling. The concept of vectored interrupts has roots in early computer designs, with proposals for priority-based vectoring appearing as early as in discussions of multiprogramming systems like the Stretch. Modern implementations vary: in architectures like , vectors are fixed in a table starting at 0x0000.0000, with examples including the SysTick_Handler at 0x0000.003C for periodic timing or GPIOPortF_Handler at 0x0000.00B8 for GPIO events. In x86 systems, the vector (IDT) supports up to 256 entries, while uses a base configurable at runtime. These systems often incorporate levels to resolve simultaneous interrupts, queuing lower- ones until higher ones are resolved. Vectored interrupts remain a cornerstone of efficient processing in embedded systems, operating systems, and general-purpose .

Fundamentals

Definition

A vectored interrupt is a type of hardware in which the interrupting device supplies a to the , which is either a direct pointing to the interrupt service routine () or an index used to locate the ISR via a lookup, enabling efficient dispatch to the appropriate handler. This mechanism supports direct or indirect jumping to the ISR, distinguishing it from simpler interrupt schemes by allowing the hardware to identify the specific source and routine without additional software intervention. Unlike polling-based methods, where the repeatedly queries statuses, vectored interrupts provide asynchronous notifications that enhance efficiency in multi-device environments by minimizing CPU overhead and enabling rapid response to .

Basic Mechanism

In a vectored system, begins when a peripheral asserts an signal to notify the of an requiring attention, simultaneously providing a unique vector number that identifies the specific source. The acknowledges this signal, typically by halting the current execution at an appropriate boundary, and receives the vector from the through dedicated signaling. This vector directly determines the address of the corresponding interrupt service routine (ISR), enabling rapid dispatch without additional identification steps. Upon receiving the vector, the processor automatically saves the current execution context to preserve the state of the interrupted program. This hardware-managed step typically involves pushing essential registers—such as the (PC), which holds the address of the next instruction, and status flags or registers indicating the processor's mode and condition—onto the system stack. The processor then uses the vector to compute or retrieve the starting address of the ISR and jumps to it, initiating the handler's execution. The performs the necessary actions to service the , such as reading device status or transferring data, after which it signals completion. To return control to the original program, the executes a dedicated return-from- , often abbreviated as RTI, which restores the saved by popping the PC and status registers from the , thereby resuming execution from the point of interruption. This enhances efficiency by eliminating the need for software polling or sequential querying of to identify the source, thereby minimizing and overhead in handling compared to non-vectored approaches.

Comparison to Other Interrupts

Non-Vectored Interrupts

Non-vectored are a type of in which the responds to an signal by jumping to a single, fixed in , without receiving a specific from the interrupting ; instead, the must then identify the source through additional steps such as polling the or using a daisy-chain arrangement. This approach contrasts with more advanced systems by relying on software or simple logic to resolve the source after the initial signal. Historically, non-vectored interrupts were predominant in early computer systems during the , such as the 1103 introduced in 1953, where interrupts served as basic signals to halt normal processing, allowing overlapped execution of programs and device activities. These early implementations marked the initial adoption of interrupts to improve system efficiency over purely sequential processing, though they were limited to simple signaling without prioritization or direct routing. The primary operational drawbacks of non-vectored interrupts arise from the need for a polling loop, in which the sequentially queries each potential to determine the interrupt , or a daisy-chain resolution, where are wired in series to pass the interrupt acknowledgment signal until the requesting claims it, both of which introduce significant in environments with multiple . Polling wastes cycles on non-interrupting , while daisy-chaining imposes a fixed based on physical wiring, potentially delaying lower- and complicating as the number of peripherals grows. These limitations highlight the evolution toward vectored interrupts for faster, more direct handling in multi- setups. Examples of non-vectored interrupts include simple single-device systems like early controllers, where only one peripheral can interrupt and no source identification is needed, or software-polled I/O in systems such as the PDP-8 , which uses a fixed for all interrupts followed by polling to check registers. In such cases, the mechanism suffices for low-complexity environments but becomes inefficient as system demands increase.

Autovectored Interrupts

Autovectored interrupts represent a hybrid form of vectored interrupt handling in which the —typically the CPU or an external interrupt controller—automatically generates the interrupt corresponding to the active input line, eliminating the need for the interrupting device to provide the vector itself. This approach relies on predefined mappings within the to direct the to the appropriate interrupt service routine (). Such interrupts are commonly implemented in early microprocessors to simplify while providing some level of beyond basic non-vectored schemes. The mechanism of autovectored interrupts generally involves priority resolution logic, such as priority encoders or daisy-chained controllers, that identifies the highest-priority interrupting input among multiple lines and selects a fixed vector associated with that line. In the microprocessor, for example, the maskable interrupts RST 5.5, RST 6.5, and RST 7.5 are autovectored, automatically branching the to hardcoded addresses: 002CH for RST 5.5, 0034H for RST 6.5, and 003CH for RST 7.5. Similarly, the Intel 8259 (PIC) employs internal priority encoding to resolve interrupts from its eight input lines (IR0–IR7) and generates an 8-bit vector during the interrupt acknowledge cycle; in early x86 real-mode configurations such as the IBM PC, the master PIC assigns vectors 08H through 0FH, while a cascaded slave PIC uses 70H through 77H for its lines. This hardware automation allows for efficient handling without software intervention to determine the source, though it requires initialization to set the vector base and spacing. Despite their efficiency, autovectored interrupts have notable limitations, including reduced flexibility compared to systems where devices supply , as the predefined vectors per line prevent fine-grained for multiple devices sharing the same input. The number of supported interrupt lines is also constrained by the design—typically eight per controller in devices like the 8259—necessitating cascading for larger systems, which adds complexity and potential latency. Additionally, since vectors are fixed or base-offset based, reconfiguring priorities or adding new interrupt types often requires modifications or , limiting adaptability in dynamic environments.

Implementation

Hardware Components

The hardware components enabling vectored interrupts primarily consist of (IRQ) lines that connect peripheral devices to the (CPU), allowing devices to signal conditions. These lines transmit electrical signals indicating the need for CPU attention, often encoded with levels to facilitate handling multiple requests. For instance, in the MC68000 , three dedicated input pins—IPL0, IPL1, and IPL2—form a 3-bit IRQ interface that encodes seven levels (1–7), with level 7 being non-maskable. Similarly, the uses a single active-low INT pin (pin 18) for maskable IRQ requests, sampled at the end of each if enabled. The data bus serves as the pathway for vector transmission, carrying the from the interrupting device to the CPU during a dedicated acknowledge . This bus enables the device to supply an address or offset that directs the CPU to the appropriate service routine. In early systems, support was typically provided for 8-bit or 16-bit vectors; the Z80's 8-bit bidirectional data bus (D7–D0, pins 1–8) allows a peripheral to place the lower 8 bits of the vector during the interrupt acknowledge phase, when the IORQ signal (pin 20) activates. The MC68000 employs a 16-bit data bus (D15–D0), where an external device asserts an 8-bit vector on D7–D0 during the 4-clock interrupt acknowledge , signaled by the code bus (FC2–FC0) and upper address lines (A19–A16) going high. An interrupt controller, often implemented as external circuitry or integrated logic, manages prioritization, buffering, and vector generation to resolve conflicts among multiple IRQ sources. This component arbitrates requests and ensures only the highest-priority vector proceeds, using daisy-chain or mechanisms. In the Z80 ecosystem, peripherals like the Z80 PIO or SIO form a daisy-chain structure to serially resolve priorities and supply the vector without a central controller on the CPU itself. For the MC68000, external devices or a (e.g., using a 74LS148 ) buffer and prioritize the seven IRQ levels before asserting the IPL pins, with the CPU fetching the vector if a device responds during acknowledgment. Masking and enabling of specific vectors occur through interrupt enable flags in the CPU's status registers, allowing selective disabling to prevent lower-priority interruptions during critical operations. These flags provide granular control at the level, typically set or cleared via software but reflected in registers. The Z80's interrupt enable flip-flops (IFF1 and IFF2) in its internal state logic mask all maskable s when reset by a DI instruction, while the NMI input (pin ) bypasses this for non-maskable events. In the MC68000, the status register's 3-bit interrupt mask (I2–I0) inhibits interrupts at or below the set level (0–7), adjustable only in supervisor mode, ensuring -level enforcement of priorities. Representative examples of these components appear in classic microprocessors like the Z80 and MC68000, which feature dedicated vectored interrupt pins and buses for efficient vector handling. The Z80's INT and NMI pins, combined with its data bus and daisy-chain support, enable Mode 2 vectored interrupts where devices directly contribute to address formation. The MC68000's IPL pins, data bus, and address strobe (AS) integrate with external controllers to support user-vectored modes, providing 256 possible vectors via an 8-bit field.

Vector Table and Processing

The vector table, often referred to as the Interrupt Vector Table (IVT), is a contiguous array stored in system memory that maps interrupt vectors to the starting addresses of corresponding Interrupt Service Routines (ISRs). Each entry in the table typically consists of a 32-bit address or an offset pointing to the ISR, with the structure designed for efficient indirect addressing by the processor. In early microprocessor designs, such as those in the Intel 8086 family, the IVT was fixed at memory address 0x0000, occupying 1 KB to accommodate up to 256 possible interrupts, where each entry spans 4 bytes (a 16-bit offset followed by a 16-bit segment selector). In modern architectures like ARM Cortex-M, the table begins at a configurable base address (defaulting to 0x00000000) and uses 4-byte entries for exception and interrupt handlers, with the offset calculated as base + (vector number × 4). Upon receiving a vector number from the interrupt controller, the performs the following steps to handle the : first, it computes the table entry address by adding the vector number, scaled by the entry size (e.g., multiplied by 4 for 32-bit in systems like the x86 real-mode IVT), to the table's base ; next, it fetches the ISR from that entry; then, the processor saves the current program state (such as the and ) to the ; finally, it loads the ISR into the program counter and transfers control to the routine. This indirect addressing mechanism ensures rapid dispatch without software polling, typically completing in a few clock cycles after vector reception. The vector table is configured during system initialization, where the operating system or populates each entry with the appropriate address based on the hardware configuration. This setup occurs at time, often as part of the or sequence, ensuring all supported s are mapped before enabling the interrupt system. The table's is determined by the maximum number of vectored s supported by the architecture; for instance, processors allocate space for up to 256 entries (16 fixed exceptions plus up to 240 interrupts), scalable via the Nested Vectored Interrupt Controller (NVIC) registers. For error handling, if an invalid is received—such as one exceeding the table's bounds or referencing an uninitialized entry—the processor typically traps to a default handler or invokes a fault exception to prevent erratic behavior. In architectures, an invalid address (e.g., one with the least significant bit set to 0, indicating a non-thumb ) triggers a UsageFault, while out-of-range vectors lead to a HardFault escalation if unhandled. This mechanism ensures system integrity by routing anomalies to a recovery routine or diagnostic code, often configured as the final entry in the table.

Historical Development

Early Origins

The origins of interrupts trace back to 1953, when the 1103 became the first computer system to implement them, allowing devices to signal the processor asynchronously rather than relying solely on programmed polling in batch-oriented environments. This innovation addressed the inefficiencies of constant device checking, enabling more responsive I/O handling in early scientific applications. Vectored interrupts, which allow the interrupting device to supply a specific address or code directing the to the appropriate routine, emerged in the late as an advancement over basic signaling. The Stretch, designed in the mid-1950s and delivered in 1961, featured one of the earliest vectored systems, supporting multiple vectors per to facilitate prioritized handling in multiprogrammed setups. Similarly, the Electrologica X1, developed in the between 1957 and 1958, incorporated a vectored mechanism credited to E. W. Dijkstra, using up to seven distinct interrupt channels for efficient device coordination without extensive software polling. These designs marked a shift toward hardware-assisted vectoring, reducing in systems with growing numbers of peripherals. By the mid-1960s, vectored interrupts gained prominence in the transition to and processing, driven by the need to manage multiple devices efficiently in environments. The , announced in 1964, introduced channel-based interrupts that provided detailed status words upon completion of I/O operations, enabling software to branch to device-specific handlers much like a vectored , though reliant on fixed interruption codes in the for classification. This approach supported the demands of emerging interactive systems, where polling proved inadequate for concurrent user tasks and I/O events. The term "vectored interrupt" became formalized in technical literature during this period, reflecting its adoption in architectures for streamlined responsiveness.

Evolution in Modern Systems

In the 1970s and 1980s, vectored interrupts were integrated into early microprocessors with fixed vector schemes to support efficient handler dispatching. The , introduced in 1978, employed a fixed (IVT) consisting of 256 entries, each pointing to a 4-byte :offset address for interrupt service routines, enabling direct hardware mapping without dynamic reconfiguration. This approach, while simple, limited flexibility in protected-mode environments. By the mid-1980s, the Intel 80386 processor marked a significant evolution by introducing the (IDT), a dynamic structure supporting up to 256 descriptors that include types (, , or task) and privilege levels, allowing programmable vector assignment and enhanced security through selectors. Modern architectures have scaled vectored interrupts to handle complex, multi-core systems with expansive vector spaces. The ARM Generic Interrupt Controller (GIC), standardized since the early 2000s and refined in versions like GICv3, supports over 1,000 interrupt sources—typically 16 software-generated interrupts (SGIs), 16 private peripheral interrupts (PPIs), and up to 1,024 shared peripheral interrupts (SPIs)—enabling prioritized routing across multi-core processors via distributor and redistributor components. In x86 systems, the (APIC), integrated since the Pentium era, facilitates vector routing in multi-core setups through its local APIC per core and I/O APIC for device interrupts, supporting up to 255 vectors (excluding reserved exceptions) with features like logical destination modes for targeted delivery to specific cores or clusters. Operating systems have adapted vectored interrupts by mapping vectors to software handlers, incorporating virtualization layers for . In , the uses the /proc/interrupts to expose mappings of hardware IRQs to vector numbers and handler counts, allowing dynamic affinity adjustments via irqbalance for multi-core load distribution. Windows kernels similarly abstract vectors through the Layer (HAL), routing interrupts to drivers via IoConnectInterrupt and supporting affinity policies for . extensions, such as VT-x, introduce layers where interrupts cause VM exits to the host, with posted interrupts enabling direct guest delivery to minimize latency in nested environments.

References

  1. [1]
    Chapter 12: Interrupts
    A vectored interrupt system employs separate connections for each device so that the computer can give automatic resolution. You can recognize a vectored system ...
  2. [2]
    [PDF] 3.11 Vectored Interrupts - CS@Purdue
    Vectored interrupts use a vector of pointers to find interrupt code. Exceptions use a similar approach, but the program counter doesn't advance during an ...Missing: definition | Show results with:definition
  3. [3]
    Interrupts - Mark Smotherman - Clemson University
    The interrupt vector was structured to hold one instruction for each interrupt cause. This instruction could be an immediate fix-up, such as clearing a register ...
  4. [4]
    Interrupt Vector - an overview | ScienceDirect Topics
    An interrupt vector is a register or address that peripherals use to identify which device caused an interrupt, informing the processor of the interrupt source.<|control11|><|separator|>
  5. [5]
    Types of Interrupts
    Vectored Interrupts. Devices that use vectored interrupts are assigned an interrupt vector. This is a number that identifies a particular interrupt handler.
  6. [6]
    None
    No readable text found in the HTML.<|separator|>
  7. [7]
    Interrupts
    Once we've decided we will process the interrupt, and we've decided which interrupt to process, we take the following steps: All of the registers get pushed ...Interrupt Handling · Interrupts · Interrupt Service Routines
  8. [8]
    [PDF] EECS 373 Design of Microprocessor-Based Systems
    Used in 68000, SPARC. • Can be built on top of vectored or nonvectored interrupts. • Multiple CPU interrupt inputs, one for each priority level.Missing: non- drawbacks
  9. [9]
    [PDF] INPUT/OUTPUT ORGANIZATION - CSE IITM
    The disadvantage of polling is that it can waste a lot of processor time because processors are so much faster than. I/O devices. I/O devices. The processor may ...
  10. [10]
    Input-Output Devices and Interfacing
    Vectored interrupts are the most sophisticated scheme and are available on ... In this case, a daisy chain can be used to prioritize devices on the same level.
  11. [11]
    [PDF] I/O Data Transfer Interrupts
    An interrupt (also known as an exception or trap) is an event that causes the CPU to stop executing the current program and start executing a special piece ...
  12. [12]
    [PDF] Chapter 12 8085 Interrupts
    RST 5.5, RST 6.5, RST 7.5 are all automatically vectored. • RST 5.5, RST 6.5, and RST 7.5 are all maskable. –. TRAP is the ...
  13. [13]
    [PDF] 8259A PROGRAMMABLE INTERRUPT CONTROLLER ... - PDOS-MIT
    The Intel 8259A Programmable Interrupt Controller handles up to eight vectored priority interrupts for the CPU. It is cascadable for up to 64 vectored priority ...
  14. [14]
    [PDF] M68000 8-/16-/32-bit microprocessors user's manual
    M68000 8-/16-/32-BIT MICROPROCESSORS USER'S MANUAL. MOTOROLA. 1.1 MC68000 ... An interrupting device provides an M68000 interrupt vector number and asserts data.
  15. [15]
    [PDF] Z80 CPU User Manual - Zilog, Inc.
    Interrupt Response. Z80 CPU. User Manual. 17. Interrupt Response. An interrupt allows peripheral devices to suspend CPU operation and force the CPU to start a ...
  16. [16]
  17. [17]
    The vector table - Arm Developer
    The vector table contains the addresses of handlers for each type of exception. The handler for exception number n is held at ( vectorbaseaddress + 4 * n ).Missing: structure | Show results with:structure
  18. [18]
    Processor response to an initial interrupt - Arm Developer
    The processor receives the interrupt, branches to the interrupt vector, reads ICCIAR, and then jumps to the Interrupt Service Routine (ISR).
  19. [19]
    Interrupt - Texas Instruments
    The primary function of the interrupt controller API is to manage the interrupt vector table used by the NVIC to dispatch interrupt requests. Registering an ...
  20. [20]
    NVIC register descriptions - Arm Developer
    Use the Interrupt Priority Registers to assign a priority from 0 to 255 to each of the available interrupts. 0 is the highest priority, and 255 is the lowest.
  21. [21]
    Armv8-M: Fault Reports - Arm Developer
    Stacked PSR corrupted during exception or interrupt handling. Vector table contains a vector address with LSB=0. INVPC, Invalid PC load UsageFault, caused by ...
  22. [22]
  23. [23]
    [PDF] Architecture of the IBM System / 360
    When the channel program ends, the CPU program is interrupted, and complete channel and device status information are available. ... 393-396 (1961). Received ...Missing: vectored | Show results with:vectored
  24. [24]
    [PDF] Intel® 64 and IA-32 Architectures Software Developer's Manual
    NOTE: The Intel® 64 and IA-32 Architectures Software Developer's Manual consists of ten volumes: Basic Architecture, Order Number 253665; Instruction Set ...