The 386 has support for 256 interrupts (or exceptions) just as in the 8086. The Interrupt Descriptor table (IDT) contains the definition for each of these interrupts. The IDT can have 8192 entries. But if more than 256 of these entries are present, they simply remain unused. The IDT may contain trap gates, interrupt gates or task gates. A trap gate is one that does not clear interrupts before entering the exception handler. However, an interrupt gates disables all interrupts before entering the handler. Details about task gates have been given elsewhere in this document. See Multitasking.
Interrupts may be caused due to external hardware (which comes through the PIC. See Hardware Interrupts.), may be caused by the processor itself, or may be a software interrupt. Carefully handling processor generated and hardware interrupts is one of the major tasks of an operating system. Slightest errors in these interrupt handlers may result in disasters and blue screens ;-).
The processor generated 386 exceptions can be classified into faults, traps and aborts.
A fault is a correctable error. Most invalid operations result in faults. When a fault occurs, the CS:EIP points to the instruction that caused the fault. Faults are considered to be the least serious exceptions. The most common of these faults is the "General Protection Fault (GPF)".
Traps accur whenever a software interrupt occurs. Software interrupts are caused due to the execution of INT and INTO instructions. When a trap occurs, the CS:EIP points to the instruction following the actual instruction that caused the trap.5 The system cannot restart traps.
Aborts are serious errors that indicate that there may be a severe problem with the operating system itself. The Double Fault and FPU Overrun are considered as aborts.
The table below shows the various exceptions with their classifications:
| Exception (#num) Type
|
| Divide Error (0) Fault
|
| Debug (1) F/Trap
|
| Breakpoint (3) Trap
|
| Overflow (4) Trap
|
| Bounds Check (5) Fault
|
| Bad Opcode (6) Fault
|
| No Coprocessor (7) Fault
|
| Double Fault (8) Abort
|
| Coprocessor Overrun (9) Abort
|
| Invalid TSS Segment (0A) Fault
|
| Segment not Present (0B) Fault
|
| Stack Fault (0C) Fault
|
| General Protection Fault (0D) Fault
|
| Page Fault (0E) Fault
|
| Coprocessor Error (10) Fault
|
|
|