diff options
author | Marvin Borner | 2021-03-02 23:34:39 +0100 |
---|---|---|
committer | Marvin Borner | 2021-03-02 23:34:39 +0100 |
commit | d47e627d0006e038dcd1c34b9015c3370f7b4b0c (patch) | |
tree | 5091e41c0d14f06ee345e7fd965044b2028b4dbb /kernel/drivers | |
parent | 557cb0919118624eacbe4bb95de7bd6b4decab91 (diff) |
Getting closer!
Diffstat (limited to 'kernel/drivers')
-rw-r--r-- | kernel/drivers/interrupts.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/kernel/drivers/interrupts.c b/kernel/drivers/interrupts.c index fa455d7..55926b7 100644 --- a/kernel/drivers/interrupts.c +++ b/kernel/drivers/interrupts.c @@ -169,26 +169,30 @@ void isr_uninstall_handler(int isr) isr_routines[isr] = 0; } -void isr_handler(struct regs *r); -void isr_handler(struct regs *r) +void isr_panic(struct regs *r) { - if (r->int_no <= 32) { - struct proc *proc = proc_current(); - printf("%s Exception at 0x%x, exiting!\n", isr_exceptions[r->int_no], r->eip); - if (proc) { - printf("\t-> Exception occurred in %s at addr 0x%x\n", proc->name, - r->eip - proc->entry); - proc_exit(proc, 1); - } else { - __asm__ volatile("cli\nhlt"); - } - proc_yield(r); + struct proc *proc = proc_current(); + printf("%s Exception (%x) at 0x%x, exiting!\n", isr_exceptions[r->int_no], r->err_code, + r->eip); + if (proc) { + printf("\t-> Exception occurred in %s at addr 0x%x\n", proc->name, + r->eip - proc->entry); + proc_exit(proc, 1); } else { - // Execute fault handler if exists - void (*handler)(struct regs * r) = isr_routines[r->int_no]; - if (handler) - handler(r); + __asm__ volatile("cli\nhlt"); } + proc_yield(r); +} + +void isr_handler(struct regs *r); +void isr_handler(struct regs *r) +{ + // Execute fault handler if exists + void (*handler)(struct regs * r) = isr_routines[r->int_no]; + if (handler) + handler(r); + else + isr_panic(r); } static void isr_install(void) |