diff --git a/k/idt.c b/k/idt.c index 3de6ba0..91d0f96 100644 --- a/k/idt.c +++ b/k/idt.c @@ -3,7 +3,7 @@ static struct idt idt = { 0 }; -struct idt_entry_info infos[] = { +static struct idt_entry_info infos[] = { {int_de, INTERRUPT_TYPE}, {int_db, INTERRUPT_TYPE}, {int_nmi, INTERRUPT_TYPE}, {int_bp, TRAP_TYPE}, {int_of, TRAP_TYPE}, {int_br, INTERRUPT_TYPE}, @@ -17,10 +17,9 @@ struct idt_entry_info infos[] = { {int_ve, INTERRUPT_TYPE} }; -void handle_interrupt(struct int_args args) +void handle_interrupt(struct int_args *args) { - (void)args; - printf("INTERRUPT\r\n"); + printf("INTERRUPT: %d, error code: %d\r\n", args->int_code, args->err_code); return; } diff --git a/k/idt.h b/k/idt.h index 548dbbe..b8700a3 100644 --- a/k/idt.h +++ b/k/idt.h @@ -38,9 +38,17 @@ struct idt_r } __attribute__ ((packed)); // FIXME: This struct is used to get int_code and err_code pushed to the stack -// by the isr (but isn't working now) +// by the isr. We can refactor this by offsetting esp before pushing it. struct int_args { + uint32_t edi; + uint32_t esi; + uint32_t ebp; + uint32_t esp; + uint32_t ebx; + uint32_t edx; + uint32_t ecx; + uint32_t eax; uint32_t int_code; uint32_t err_code; } __attribute__ ((packed)); @@ -53,6 +61,6 @@ struct idt_entry_info }; void init_idt(void); -void handle_interrupt(struct int_args args); +void handle_interrupt(struct int_args *args); #endif /* !IDT_H */