The CPU can detect signals generated by itself, or by external
hardware. These signals cause an interrupt or exception that requires
a handler routine.
Interrupts are generated externally to the CPU.
Peripherals generate interrupts when they require attention;
for example, when data is ready to be read.
These events are signaled on the INTR (Interrupt Request) pin of the
processor and may be temporarily ignored (masked). Non-maskable interrupts
are signaled on the NMI pin by events such as memory
parity errors, and cannot be ignored.
Exceptions are generated by the CPU when it detects abnormal
internal conditions, or by certain machine instructions. There are three
types of internal exception detected by the processor:
reported due to severe error, such as hardware failure or a corrupt system
table. It is not possible to determine which instruction caused the error.
An example would be failure of the internal cache.
reported either before or during the execution of an
instruction. An example is a page fault generated when a process requires a
page of memory.
reported immediately after the execution of a
machine instruction. An example is overflow on divide.
Programmed exceptions are traps that are
reported when certain machine instructions (BOUND,
INT n, and INTO) cause an error
condition. For example,
BOUND is used by software when checking that an array index
lies within given limits. These exceptions are sometimes referred to as
The hexadecimal identification number or vector for each type of
interrupt or exception is listed in the following table.
The names of the vectors are defined in /usr/include/sys/trap.h.
The description indicates the circumstances under which the vector might be
reported in a kernel or device driver message.
overflow; programmed exception detected by INTO instruction
array range exceeded; programmed exception
detected by BOUND instruction
invalid opcode; illegal instruction possibly due to an error in the cache,
bad hardware, or bad memory
coprocessor not available; usually caused by the device not being present
double fault (causes a DOUBLE PANIC);
caused by an illegal instruction
from a third-party device driver, or bad memory
coprocessor extension overrun; reserved on the Pentium
invalid TSS (Task State Segment);
usually occurs when performing i8086 emulation
segment not present; caused by an addressing problem due to bad memory, or
conflict with a third-party device driver
stack fault (system mode only); fixed stack size is being overflowed,
perhaps caused by a third party device driver
general protection; caused by invalid address, or parity error from bad
page fault; page could not be brought into memory due to bad memory, or
a bug in a third party device driver
floating point error; caused by bad coprocessor hardware
alignment check on 486 and Pentium only; otherwise reserved
machine check on Pentium only; otherwise reserved
external interrupts on the INTR pin
On single CPU machines, interrupt vectors 0x40-0x4F are
assigned to interrupts from the PICs
(8259 Programmable Interrupt Controllers).
When output in diagnostic messages, all external interrupt vectors
are given relative to 0x40 (PIC_VECTBASE). This value
corresponds to the IRQ (interrupt request line)
on the PICs. For example, the clock is always at IRQ 0,
the first serial port at IRQ 4, and the ST506 hard disk
controller at IRQ 14.