summaryrefslogtreecommitdiff
path: root/kernel/exceptions.c
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-09-14 23:10:16 +0200
committerMiguel <m.i@gmx.at>2018-09-14 23:10:16 +0200
commitc4b20a0ebbde1348e1e085e2ea3be35345d92b7c (patch)
tree611b68c1d288cace070152c628bb0e0e211bb500 /kernel/exceptions.c
parentfdf6100721870780319bc7cc766a0bb5b4789965 (diff)
tuining userspace and files
Diffstat (limited to 'kernel/exceptions.c')
-rw-r--r--kernel/exceptions.c64
1 files changed, 44 insertions, 20 deletions
diff --git a/kernel/exceptions.c b/kernel/exceptions.c
index bcb5c40..4ad87e8 100644
--- a/kernel/exceptions.c
+++ b/kernel/exceptions.c
@@ -1,6 +1,7 @@
#include "kernel.h"
#include "exceptions.h"
#include "scheduler.h"
+#include "syscalls.h"
#include "log.h"
#include "asm_x86.h"
@@ -35,7 +36,7 @@ static void show_page_fault_error(uint32_t error_code)
klog("at addr: 0x%08X",x86_get_cr(2));
}
-void exception_handle(uint32_t esp, uint32_t irq)
+uint32_t exception_handle(uint32_t esp, uint32_t irq)
{
uint32_t error_code=0;
@@ -60,48 +61,71 @@ void exception_handle(uint32_t esp, uint32_t irq)
switch(irq){
case 0:
- kpanic("Divide by 0");
+ klog("Divide by 0");
+ break;
case 1:
- kpanic("Single step (debugger)");
+ klog("Single step (debugger)");
+ break;
case 2:
- kpanic("Non Maskable Interrupt");
+ klog("Non Maskable Interrupt");
+ break;
case 3:
- kpanic("Breakpoint (debugger)");
+ klog("Breakpoint (debugger)");
+ break;
case 4:
- kpanic("Overflow");
+ klog("Overflow");
+ break;
case 5:
- kpanic("Bounds check");
+ klog("Bounds check");
+ break;
case 6:
- kpanic("Undefined OP Code");
+ klog("Undefined OP Code");
+ break;
case 7:
- kpanic("No coprocessor");
+ klog("No coprocessor");
+ break;
case 8:
- kpanic("Double Fault");
+ klog("Double Fault");
+ break;
case 9:
- kpanic("Coprocessor Segment Overrun");
+ klog("Coprocessor Segment Overrun");
+ break;
case 10:
show_selector_error(error_code);
- kpanic("Invalid TSS");
+ klog("Invalid TSS");
+ break;
case 11:
show_selector_error(error_code);
- kpanic("Segment Not Present");
+ klog("Segment Not Present");
+ break;
case 12:
show_selector_error(error_code);
- kpanic("Stack Segment Overrun");
+ klog("Stack Segment Overrun");
+ break;
case 13:
show_selector_error(error_code);
- kpanic("Exception: Fault: General Protection Fault");
+ klog("Exception: Fault: General Protection Fault");
+ break;
case 14:
show_page_fault_error(error_code);
- kpanic("Exception: Fault: Page Fault");
+ klog("Exception: Fault: Page Fault");
+ break;
case 15:
- kpanic("RESERVED");
+ klog("RESERVED");
+ break;
case 16:
- kpanic("Coprocessor error");
+ klog("Coprocessor error");
+ break;
case 17:
- kpanic("Alignment Check");
+ klog("Alignment Check");
+ break;
case 18:
- kpanic("Machine Check");
+ klog("Machine Check");
+ break;
}
+ klog("killing task in question!");
+
+ task_syscall(SYSCALL_EXIT,task_get_current_pid(),0,0);
+ return scheduler_run(esp,0);
}