1 /* Generated from {{ data["template"] }}. Do NOT modify */
3 #include <lunaix/types.h>
4 #include <sys/i386_intr.h>
6 #define IDT_INTERRUPT 0x70
8 #define IDT_ATTR(dpl, type) (((type) << 5) | ((dpl & 3) << 13) | (1 << 15))
11 #define DECLARE_ISR(iv) extern void _asm_isr##iv();
13 #define ISR_INSTALL(idt, iv, isr, dpl) \
14 _idt[iv] = ((ptr_t)isr & 0xffff0000) | IDT_ATTR(dpl, IDT_INTERRUPT); \
16 _idt[iv] |= (KERNEL_CS << 16) | ((ptr_t)isr & 0x0000ffff); \
18 u64_t _idt[IDT_ENTRY];
19 u16_t _idt_limit = sizeof(_idt) - 1;
21 {% for isrdef in data["exception"]["ivdefs"] -%}
22 DECLARE_ISR({{ isrdef["iv"] }})
26 exception_install_handler()
28 {% for isrdef in data["exception"]["ivdefs"] %}
29 ISR_INSTALL(_idt, {{ isrdef["iv"] }}, _asm_isr{{ isrdef["iv"] }}, {{ isrdef["dpl"] }})