- /* Install default handlers. */
- for (i = 0; i < 256; i++)
- intr_register (i, 0, INTR_OFF, panic, NULL);
-
- /* Most exceptions require ring 0.
- Exceptions 3, 4, and 5 can be caused by ring 3 directly. */
- intr_register (0, 0, INTR_ON, kill, "#DE Divide Error");
- intr_register (1, 0, INTR_ON, kill, "#DB Debug Exception");
- intr_register (2, 0, INTR_ON, panic, "NMI Interrupt");
- intr_register (3, 3, INTR_ON, kill, "#BP Breakpoint Exception");
- intr_register (4, 3, INTR_ON, kill, "#OF Overflow Exception");
- intr_register (5, 3, INTR_ON, kill, "#BR BOUND Range Exceeded Exception");
- intr_register (6, 0, INTR_ON, kill, "#UD Invalid Opcode Exception");
- intr_register (7, 0, INTR_ON, kill, "#NM Device Not Available Exception");
- intr_register (8, 0, INTR_ON, panic, "#DF Double Fault Exception");
- intr_register (9, 0, INTR_ON, panic, "Coprocessor Segment Overrun");
- intr_register (10, 0, INTR_ON, panic, "#TS Invalid TSS Exception");
- intr_register (11, 0, INTR_ON, kill, "#NP Segment Not Present");
- intr_register (12, 0, INTR_ON, kill, "#SS Stack Fault Exception");
- intr_register (13, 0, INTR_ON, kill, "#GP General Protection Exception");
- intr_register (16, 0, INTR_ON, kill, "#MF x87 FPU Floating-Point Error");
- intr_register (17, 0, INTR_ON, panic, "#AC Alignment Check Exception");
- intr_register (18, 0, INTR_ON, panic, "#MC Machine-Check Exception");
- intr_register (19, 0, INTR_ON, kill, "#XF SIMD Floating-Point Exception");
-
- /* Most exceptions can be handled with interrupts turned on.
- We need to disable interrupts for page faults because the
- fault address is stored in CR2 and needs to be preserved. */
- intr_register (14, 0, INTR_OFF, kill, "#PF Page-Fault Exception");
-
- idtr_operand = make_dtr_operand (sizeof idt - 1, idt);
- asm volatile ("lidt %0" :: "m" (idtr_operand));