- /* Install default handlers. */
- for (i = 0; i < 256; i++)
- intr_register (i, 0, IF_OFF, intr_panic, NULL);
-
- /* Most exceptions require ring 0.
- Exceptions 3, 4, and 5 can be caused by ring 3 directly. */
- intr_register (0, 0, IF_ON, intr_kill, "#DE Divide Error");
- intr_register (1, 0, IF_ON, intr_kill, "#DB Debug Exception");
- intr_register (2, 0, IF_ON, intr_panic, "NMI Interrupt");
- intr_register (3, 3, IF_ON, intr_kill, "#BP Breakpoint Exception");
- intr_register (4, 3, IF_ON, intr_kill, "#OF Overflow Exception");
- intr_register (5, 3, IF_ON, intr_kill, "#BR BOUND Range Exceeded Exception");
- intr_register (6, 0, IF_ON, intr_kill, "#UD Invalid Opcode Exception");
- intr_register (7, 0, IF_ON, intr_kill, "#NM Device Not Available Exception");
- intr_register (8, 0, IF_ON, intr_panic, "#DF Double Fault Exception");
- intr_register (9, 0, IF_ON, intr_panic, "Coprocessor Segment Overrun");
- intr_register (10, 0, IF_ON, intr_panic, "#TS Invalid TSS Exception");
- intr_register (11, 0, IF_ON, intr_kill, "#NP Segment Not Present");
- intr_register (12, 0, IF_ON, intr_kill, "#SS Stack Fault Exception");
- intr_register (13, 0, IF_ON, intr_kill, "#GP General Protection Exception");
- intr_register (16, 0, IF_ON, intr_kill, "#MF x87 FPU Floating-Point Error");
- intr_register (17, 0, IF_ON, intr_panic, "#AC Alignment Check Exception");
- intr_register (18, 0, IF_ON, intr_panic, "#MC Machine-Check Exception");
- intr_register (19, 0, IF_ON, intr_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, IF_OFF, intr_kill, "#PF Page-Fault Exception");
-
- idtr_operand = make_dtr_operand (sizeof idt - 1, idt);
- asm volatile ("lidt %0" :: "m" (idtr_operand));
+ /* Invoke the interrupt's handler. */
+ handler = intr_handlers[frame->vec_no];
+ if (handler != NULL)
+ handler (frame);
+ else if (frame->vec_no == 0x27 || frame->vec_no == 0x2f)
+ {
+ /* There is no handler, but this interrupt can trigger
+ spuriously due to a hardware fault or hardware race
+ condition. Ignore it. */
+ }
+ else
+ unexpected_interrupt (frame);
+
+ /* Complete the processing of an external interrupt. */
+ if (external)
+ {
+ ASSERT (intr_get_level () == INTR_OFF);
+ ASSERT (intr_context ());
+
+ in_external_intr = false;
+ pic_end_of_interrupt (frame->vec_no);
+
+ if (yield_on_return)
+ thread_yield ();
+ }