refactor: striped more arch-related code from the kernel code base
[lunaix-os.git] / lunaix-os / scripts / templates / i386 / i386_isrdef.c.j2
index 01ab6391bd47d60d6cc26cc08a214da6b768c675..936263f4285758479b1cb05b9b40b92f8b2cf477 100644 (file)
@@ -1,3 +1,5 @@
+/* Generated from {{ data["template"] }}. Do NOT modify */
+
 #include "i386_intr.h"
 #include <lunaix/types.h>
 
 
 #define DECLARE_ISR(iv) extern void _asm_isr##iv();
 
-#define ISR_INSTALL(idt, iv, isr)                                        \
-    _idt[iv] = ((ptr_t)isr & 0xffff0000) | IDT_ATTR(0, IDT_INTERRUPT);   \
+#define ISR_INSTALL(idt, iv, isr, dpl)                                   \
+    _idt[iv] = ((ptr_t)isr & 0xffff0000) | IDT_ATTR(dpl, IDT_INTERRUPT); \
     _idt[iv] <<= 32;                                                     \
     _idt[iv] |= (KERNEL_CS << 16) | ((ptr_t)isr & 0x0000ffff);           \
 
 u64_t _idt[IDT_ENTRY];
 u16_t _idt_limit = sizeof(_idt) - 1;
 
-{% for isrdef in data["exception"] -%}
-    DECLARE_ISR({{ isrdef["index"] }})
+{% for isrdef in data["exception"]["ivdefs"] -%}
+    DECLARE_ISR({{ isrdef["iv"] }})
 {% endfor %}
 
 void
 exception_install_handler()
 {
-{% for isrdef in data["exception"] %}
-    ISR_INSTALL(_idt, {{ isrdef["index"] }}, _asm_isr{{ isrdef["index"] }})
+{% for isrdef in data["exception"]["ivdefs"] %}
+    ISR_INSTALL(_idt, {{ isrdef["iv"] }}, _asm_isr{{ isrdef["iv"] }}, {{ isrdef["dpl"] }})
 {% endfor %}
 }
\ No newline at end of file