diff options
author | Alex Auvolat <alex.auvolat@ens.fr> | 2015-02-13 19:23:28 +0100 |
---|---|---|
committer | Alex Auvolat <alex.auvolat@ens.fr> | 2015-02-13 19:23:28 +0100 |
commit | e484c92ff08e54e7cbfdb815a5b254507dade003 (patch) | |
tree | 21f843225c5b2ba7a2e794ed16a1aa06afe9ecd3 /src/kernel/core/idt.c | |
parent | 0ea68568372b7b7b20bca6985ae4b36e8c99c0e9 (diff) | |
download | kogata-e484c92ff08e54e7cbfdb815a5b254507dade003.tar.gz kogata-e484c92ff08e54e7cbfdb815a5b254507dade003.zip |
Implement some handling of user stuff...
Diffstat (limited to 'src/kernel/core/idt.c')
-rw-r--r-- | src/kernel/core/idt.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/kernel/core/idt.c b/src/kernel/core/idt.c index cb02bf9..e1862c9 100644 --- a/src/kernel/core/idt.c +++ b/src/kernel/core/idt.c @@ -3,6 +3,7 @@ #include <sys.h> #include <string.h> #include <dbglog.h> +#include <thread.h> struct idt_entry { uint16_t base_lo; //Low part of address to jump to @@ -92,10 +93,14 @@ void idt_exHandler(registers_t *regs) { if (ex_handlers[regs->int_no] != 0) { ex_handlers[regs->int_no](regs); } else { - //TODO: make sure all exceptions happenning in userspace do not cause kernel panic... - dbg_printf("Unhandled exception: %i\n", regs->int_no); - dbg_dump_registers(regs); - PANIC("Unhandled exception"); + if (regs->eip >= K_HIGHHALF_ADDR) { + dbg_printf("Unhandled exception in kernel code: %i\n", regs->int_no); + dbg_dump_registers(regs); + PANIC("Unhandled exception"); + } else { + ASSERT(current_thread != 0 && current_thread->user_ex_handler != 0); + current_thread->user_ex_handler(regs); + } } } |