diff --git a/kernel/include/isr.h b/kernel/include/isr.h index 9beb58c..18f5c06 100644 --- a/kernel/include/isr.h +++ b/kernel/include/isr.h @@ -15,7 +15,7 @@ struct isr_int_frame { // Pushed by CPU uint64_t rip, cs, rflags, user_rsp, user_ss; -}; +} __packed; typedef void (*isr_handler_ptr)(struct isr_int_frame* iframe); int isr_init(void); diff --git a/kernel/src/isr.c b/kernel/src/isr.c index e92e497..e512067 100644 --- a/kernel/src/isr.c +++ b/kernel/src/isr.c @@ -75,7 +75,7 @@ int isr_init(void) { } idt_set_gate(0x03, isr_redirect_table[3], IDT_FLAG_USER); // Allow breakpoints idt_set_gate(0x80, isr128, IDT_FLAG_USER); // Syscall - // + pic_remap(); // TODO: apic_init(); @@ -99,7 +99,16 @@ void isr_handle_interrupt(size_t rsp) { struct isr_int_frame* iframe = (void*)rsp; if (iframe->interrupt < 32) { - if (iframe->error) debugf("[kernel] Error code: 0x%08x\n", iframe->error); + debugf("[kernel] Register Dump:\n"); + debugf("\tRAX: %016lu RBX: %016lu RCX: %016lx\n", iframe->rax, iframe->rbx, iframe->rcx); + debugf("\tRDX: %016lu RSI: %016lu RDI: %016lx\n", iframe->rdx, iframe->rsi, iframe->rdi); + debugf("\tR08: %016lu R09: %016lu R10: %016lx\n", iframe->r8, iframe->r9, iframe->r10); + debugf("\tR11: %016lu R12: %016lu R13: %016lx\n", iframe->r11, iframe->r12, iframe->r13); + debugf("\tR14: %016lu R15: %016lu DS/ES: %016lx\n", iframe->r14, iframe->r15, iframe->ds); + debugf("\tRBP: %016lu RSP: %016lu SS: %016lx\n", iframe->rbp, iframe->user_rsp, iframe->user_ss); + debugf("\tRIP: %016lu RFLAGS: %016lx CS: %016lx\n", iframe->rip, iframe->rflags, iframe->cs); + + if (iframe->error) debugf("[kernel] Error code: 0x%lx\n", iframe->error); panic(exceptions[iframe->interrupt]); } else if (iframe->interrupt >= 32 && iframe->interrupt < 48) { // ISRs 32-47 - Hardware interrupts