From e5c2553bf5a5fc6391dcf1ce7ad0bdc15edd16b3 Mon Sep 17 00:00:00 2001 From: shockrahwow Date: Wed, 30 Oct 2019 18:39:26 -0700 Subject: [PATCH] * setting ID[i].zero to 0 * also adding louder prints to interrupt handler for now --- interrupts.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/interrupts.c b/interrupts.c index 4f81616..8a97a0f 100644 --- a/interrupts.c +++ b/interrupts.c @@ -74,6 +74,7 @@ void setup_idt_entry(u32 t_idx, u32 base, u16 sel, u8 type_attrs) { IDT[t_idx].offset_high = ((base >> 16) & 0xffff); IDT[t_idx].type_attrs = type_attrs; + IDT[t_idx].zero = 0; IDT[t_idx].selector = sel; } @@ -90,12 +91,12 @@ void int_keyboard(struct cpu_reg_state* cpu) { void interrupt_handler(struct cpu_reg_state cpu) { // treating things on the stack like it were a cpu_reg_state // NOTE: dummy stuff to stop gcc from complaining atm + printf("handled exception\n"); if(cpu.int_no < 32) { - printf("int response is:\n"); - printf(err_msg[cpu.int_no]); + printf("handled exception\n"); } else { - printf("Unhandled exception"); + printf("Unimplemented exception"); } return; } @@ -103,9 +104,9 @@ void interrupt_handler(struct cpu_reg_state cpu) { void init_idt() { // setup special idt pointer idt_ptr.address = (u32)(&IDT); - idt_ptr.limit = sizeof(struct IDT_Entry) * IDT_SIZE; + idt_ptr.limit = (sizeof(struct IDT_Entry) * IDT_SIZE) - 1; // clear table - memset((u8*)IDT, 0x00, (sizeof(struct IDT_Entry) * IDT_SIZE) - 1); + memset((u8*)IDT, 0x00, (sizeof(struct IDT_Entry) * IDT_SIZE)); // add interrupt service routines here setup_idt_entry(0,(u32)no_err_handler_1,0x08, 0x8e); setup_idt_entry(1,(u32)no_err_handler_2,0x08, 0x8e);