From 0dfd0e9fe296bb4792d40b0cee3ad69cf63b69d5 Mon Sep 17 00:00:00 2001 From: shockrah Date: Sat, 9 Nov 2019 17:37:20 -0800 Subject: [PATCH] added irq dispatch handler rn it just makes sure that execution continues --- interrupts.c | 12 ++++++++++++ kernel.c | 7 ++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/interrupts.c b/interrupts.c index 5a7eb6f..d5a3712 100644 --- a/interrupts.c +++ b/interrupts.c @@ -123,6 +123,18 @@ void init_irq_handler(u32 irq, void (*handler)(struct cpu_reg_state* cpu)) { } void irq_handler(struct cpu_reg_state* cpu) { + void (*handler)(struct cpu_reg_state* cpu); + // Dispatcher for irq's + handler = irq_handlers[cpu->int_no]; + if(handler) { + handler(cpu); + } + // pretend like nothing happend for now + if(cpu->int_no >= 40) { + serialport_write_byte(0xa0, 0x20); + } + // notify master pic controller that we're done handling the interrupt + serialport_write_byte(0x20, 0x20); } void init_idt() { diff --git a/kernel.c b/kernel.c index ff452ff..a8e7c79 100644 --- a/kernel.c +++ b/kernel.c @@ -29,8 +29,9 @@ void kprints(const char* s) { void kmain() { kinit(); - __asm__("xchg bx, bx"); - __asm__("xor eax, eax"); - __asm__("div al"); + //__asm__("xchg bx, bx"); + //__asm__("xor eax, eax"); + //__asm__("div al"); + kprints("i guess we're good now?"); for(;;); // the most amazing loop }