diff options
author | Alex Auvolat <alex@adnab.me> | 2015-03-11 17:59:28 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2015-03-11 17:59:28 +0100 |
commit | 0b76aff59b586d87ee0449bc7deda878f4633515 (patch) | |
tree | 8fd773681e302d84bc1f33c2a2bdf791f0b0df95 /src/kernel/core/idt.c | |
parent | 64b9108a58d3483e9b63511c4cf74b12dceeb0f6 (diff) | |
download | kogata-0b76aff59b586d87ee0449bc7deda878f4633515.tar.gz kogata-0b76aff59b586d87ee0449bc7deda878f4633515.zip |
Add better stack tracing technology (now uses kernel memory map!)
Diffstat (limited to 'src/kernel/core/idt.c')
-rw-r--r-- | src/kernel/core/idt.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/kernel/core/idt.c b/src/kernel/core/idt.c index d963b4d..457e5ae 100644 --- a/src/kernel/core/idt.c +++ b/src/kernel/core/idt.c @@ -91,7 +91,8 @@ static isr_handler_t ex_handlers[32] = {0}; /* Called in interrupt.s when an exception fires (interrupt 0 to 31) */ void idt_ex_handler(registers_t *regs) { - dbg_printf("ex%d.", regs->int_no); + /*dbg_printf("ex%d.", regs->int_no);*/ + if (ex_handlers[regs->int_no] != 0) { ex_handlers[regs->int_no](regs); } else { @@ -115,7 +116,7 @@ void idt_ex_handler(registers_t *regs) { void idt_irq_handler(registers_t *regs) { int st = enter_critical(CL_EXCL); // if someone tries to yield(), an assert will fail - dbg_printf("irq%d.", regs->err_code); + if (regs->err_code != 0) dbg_printf("irq%d.", regs->err_code); if (regs->err_code > 7) { outb(0xA0, 0x20); @@ -278,15 +279,8 @@ void dbg_dump_registers(registers_t *regs) { dbg_printf("| EIP: 0x%p CS : 0x%p DS : 0x%p SS : 0x%p\n", regs->eip, regs->cs, regs->ds, regs->ss); dbg_printf("| EFl: 0x%p I# : 0x%p Err: 0x%p\n", regs->eflags, regs->int_no, regs->err_code); dbg_printf("- Stack trace:\n"); - - uint32_t ebp = regs->ebp, eip = regs->eip; - int i = 0; - while (ebp >= K_HIGHHALF_ADDR && eip >= K_HIGHHALF_ADDR && i++ < 10) { - dbg_printf("| 0x%p EIP: 0x%p\n", ebp, eip); - uint32_t *d = (uint32_t*)ebp; - ebp = d[0]; - eip = d[1]; - } + + kernel_stacktrace(regs->ebp, regs->eip); dbg_printf("\\\n"); } |