+/* Registers interrupt VEC_NO to invoke HANDLER with descriptor
+ privilege level DPL. Names the interrupt NAME for debugging
+ purposes. The interrupt handler will be invoked with
+ interrupt status set to LEVEL. */
+static void
+register_handler (uint8_t vec_no, int dpl, enum intr_level level,
+ intr_handler_func *handler, const char *name)
+{
+ ASSERT (intr_handlers[vec_no] == NULL);
+ if (level == INTR_ON)
+ idt[vec_no] = make_trap_gate (intr_stubs[vec_no], dpl);
+ else
+ idt[vec_no] = make_intr_gate (intr_stubs[vec_no], dpl);
+ intr_handlers[vec_no] = handler;
+ intr_names[vec_no] = name;
+}
+
+/* Registers external interrupt VEC_NO to invoke HANDLER, which
+ is named NAME for debugging purposes. The handler will
+ execute with interrupts disabled. */
+void
+intr_register_ext (uint8_t vec_no, intr_handler_func *handler,
+ const char *name)
+{
+ ASSERT (vec_no >= 0x20 && vec_no <= 0x2f);
+ register_handler (vec_no, 0, INTR_OFF, handler, name);
+}
+
+/* Registers internal interrupt VEC_NO to invoke HANDLER, which
+ is named NAME for debugging purposes. The interrupt handler
+ will be invoked with interrupt status LEVEL.