feat: vmm_vmap/ioremap/iounmap to make MMIO more flexible and easy
[lunaix-os.git] / lunaix-os / kernel / asm / x86 / intr_routines.c
index 8cc3ff558d3c338c7bf6a05ae4d46ae971774e89..807dbe421e22ad2fe708e86ba40f69c776b82ef8 100644 (file)
@@ -1,4 +1,5 @@
 #include <arch/x86/interrupts.h>
+#include <lunaix/lxconsole.h>
 #include <lunaix/process.h>
 #include <lunaix/spike.h>
 #include <lunaix/syslog.h>
@@ -29,6 +30,7 @@ __print_panic_msg(const char* msg, const isr_param* param)
 void
 intr_routine_divide_zero(const isr_param* param)
 {
+    console_flush();
     __print_panic_msg("Divide by zero!", param);
     spin();
 }
@@ -36,8 +38,10 @@ intr_routine_divide_zero(const isr_param* param)
 void
 intr_routine_general_protection(const isr_param* param)
 {
+    kprintf(KERROR "Pid: %d\n", __current->pid);
     kprintf(KERROR "Addr: %p\n", (&debug_resv)[0]);
-    kprintf(KERROR "Expected: %p\n", __current->intr_ctx.eip);
+    kprintf(KERROR "Expected: %p\n", (&debug_resv)[1]);
+    console_flush();
     __print_panic_msg("General Protection", param);
     spin();
 }
@@ -45,6 +49,7 @@ intr_routine_general_protection(const isr_param* param)
 void
 intr_routine_sys_panic(const isr_param* param)
 {
+    console_flush();
     __print_panic_msg((char*)(param->registers.edi), param);
     spin();
 }
@@ -52,6 +57,7 @@ intr_routine_sys_panic(const isr_param* param)
 void
 intr_routine_fallback(const isr_param* param)
 {
+    console_flush();
     __print_panic_msg("Unknown Interrupt", param);
     spin();
 }
@@ -73,6 +79,7 @@ intr_routine_apic_error(const isr_param* param)
     uint32_t error_reg = apic_read_reg(APIC_ESR);
     char buf[32];
     sprintf(buf, "APIC error, ESR=0x%x", error_reg);
+    console_flush();
     __print_panic_msg(buf, param);
     spin();
 }