refactor: organize all arch related files together.
[lunaix-os.git] / lunaix-os / scripts / templates / i386 / i386_intrhnds.S.j2
diff --git a/lunaix-os/scripts/templates/i386/i386_intrhnds.S.j2 b/lunaix-os/scripts/templates/i386/i386_intrhnds.S.j2
new file mode 100644 (file)
index 0000000..3f9b585
--- /dev/null
@@ -0,0 +1,19 @@
+#define __ASM__
+.macro isr_template vector, no_error_code=1
+    .global _asm_isr\vector
+    .type _asm_isr\vector, @function
+    _asm_isr\vector:
+        .if \no_error_code
+            pushl $0x0
+        .endif
+        pushl $\vector
+        jmp interrupt_wrapper
+.endm
+.section .text
+{% for isrdef in data["exception"] %}
+{% if isrdef["has_errcode"] %}
+    isr_template {{ isrdef["index"] }}, no_error_code=0
+{% else %}
+    isr_template {{ isrdef["index"] }}, no_error_code=1
+{% endif %}
+{% endfor %}