diff options
Diffstat (limited to 'src/kernel/arch/i386/interrupts')
-rw-r--r-- | src/kernel/arch/i386/interrupts/isr.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/kernel/arch/i386/interrupts/isr.c b/src/kernel/arch/i386/interrupts/isr.c index dacecba..9d8bb6c 100644 --- a/src/kernel/arch/i386/interrupts/isr.c +++ b/src/kernel/arch/i386/interrupts/isr.c @@ -1,29 +1,24 @@ #include <kernel/arch/i386/interrupts/isr.h> #include <kernel/arch/io.h> #include <kernel/panic.h> +#include <kernel/proc.h> #include <stdbool.h> #include <stdint.h> -#define log_n_panic(x) {tty_const(x); panic_unimplemented();} // TODO kill the current process instead of panicking - bool isr_test_interrupt_called = false; void isr_stage3(int interrupt) { switch (interrupt) { - case 0x08: log_n_panic("#DF"); // double fault - case 0x0D: log_n_panic("#GP"); // general protection fault - case 0x0E: { // page fault - int cr2; - tty_const("#PF at "); - asm ("mov %%cr2, %0;" : "=r"(cr2) ::); - _tty_var(cr2); - panic_unimplemented(); - } - + case 0x08: // double fault + tty_const("#DF"); + panic_invalid_state(); case 0x34: isr_test_interrupt_called = true; return; - default: log_n_panic("unknown interrupt"); + default: + // TODO check if the exception was in the kernel + process_kill(process_current, interrupt); + process_switch_any(); } } |