From 1ee734761a3eecbdaf9631a653dee668d2de26ef Mon Sep 17 00:00:00 2001
From: dzwdz
Date: Tue, 5 Oct 2021 21:00:02 +0200
Subject: isr: simplify the exception handler

---
 src/kernel/arch/i386/interrupts/isr.c | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)

(limited to 'src')

diff --git a/src/kernel/arch/i386/interrupts/isr.c b/src/kernel/arch/i386/interrupts/isr.c
index 6701d58..9d8bb6c 100644
--- a/src/kernel/arch/i386/interrupts/isr.c
+++ b/src/kernel/arch/i386/interrupts/isr.c
@@ -7,34 +7,18 @@
 
 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: // double fault
 			tty_const("#DF");
 			panic_invalid_state();
-		case 0x0D: // general protection fault
-			exception_finish();
-		case 0x0E: { // page fault
-			/*int cr2;
-			tty_const("#PF at ");
-			asm ("mov %%cr2, %0;" : "=r"(cr2) ::);
-			_tty_var(cr2);*/
-			exception_finish();
-		}
-
 		case 0x34:
 			isr_test_interrupt_called = true;
 			return;
 
 		default:
-			tty_const("unknown interrupt");
-			panic_unimplemented();
+			// TODO check if the exception was in the kernel
+			process_kill(process_current, interrupt);
+			process_switch_any();
 	}
 }
-- 
cgit v1.2.3