35 #include "gdt-layout.h"
39 struct interrupt_context {
68 #define ISR_STUB(label_str, has_error_code, handler_str, exc) \
73 PROT_DOMAINS_ENTER_ISR(exc) \
74 " call " handler_str "\n\t" \
75 PROT_DOMAINS_LEAVE_ISR(exc) \
77 " .if " #has_error_code "\n\t" \
78 " add $4, %%esp\n\t" \
111 #define SET_INT_EXC_HANDLER(num, has_error_code, handler, exc, dpl) \
113 __asm__ __volatile__ ( \
114 "pushl %[_dpl_]\n\t" \
115 "pushl %[_cs_]\n\t" \
117 "pushl %[_isr_num_]\n\t" \
118 "call idt_set_intr_gate_desc\n\t" \
119 "add $16, %%esp\n\t" \
120 ISR_STUB("1", has_error_code, "%P[_handler_]", exc) \
122 : [_isr_num_] "g" (num), \
123 [_handler_] "i" (handler), \
124 [_cs_] "i" (exc ? GDT_SEL_CODE_EXC : GDT_SEL_CODE_INT), \
128 : "eax", "ecx", "edx" \
131 #define SET_INTERRUPT_HANDLER(num, has_error_code, handler) \
132 SET_INT_EXC_HANDLER(num, has_error_code, handler, 0, PRIV_LVL_INT)
133 #define SET_EXCEPTION_HANDLER(num, has_error_code, handler) \
134 SET_INT_EXC_HANDLER(num, has_error_code, handler, 1, PRIV_LVL_EXC)
137 #define DISABLE_IRQ() \
143 #define ENABLE_IRQ() \