diff options
author | dzwdz | 2021-10-05 20:57:01 +0200 |
---|---|---|
committer | dzwdz | 2021-10-05 20:57:01 +0200 |
commit | 8d3ef773f8daea3a0c2b110ab48f235f5d2bf22d (patch) | |
tree | 7e21974cf6eb51439ac402902f92c418e72d3863 /src/kernel/arch/i386/interrupts | |
parent | bb2c65663dd03aaf1948c36c7e6006af7e3840a6 (diff) |
kill the process that caused an exception instead of panicking
Diffstat (limited to 'src/kernel/arch/i386/interrupts')
-rw-r--r-- | src/kernel/arch/i386/interrupts/isr.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/kernel/arch/i386/interrupts/isr.c b/src/kernel/arch/i386/interrupts/isr.c index dacecba..6701d58 100644 --- a/src/kernel/arch/i386/interrupts/isr.c +++ b/src/kernel/arch/i386/interrupts/isr.c @@ -1,29 +1,40 @@ #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; +/** Kills the process that caused the exception */ +_Noreturn static void exception_finish(void) { + // TODO check if the exception was in the kernel + process_kill(process_current, 0); // TODO make the return code mean something + process_switch_any(); +} + 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 0x08: // double fault + tty_const("#DF"); + panic_invalid_state(); + case 0x0D: // general protection fault + exception_finish(); case 0x0E: { // page fault - int cr2; + /*int cr2; tty_const("#PF at "); asm ("mov %%cr2, %0;" : "=r"(cr2) ::); - _tty_var(cr2); - panic_unimplemented(); + _tty_var(cr2);*/ + exception_finish(); } case 0x34: isr_test_interrupt_called = true; return; - default: log_n_panic("unknown interrupt"); + default: + tty_const("unknown interrupt"); + panic_unimplemented(); } } |