From 86de700207fb0114ec52fafc36f84e1cbe508fd8 Mon Sep 17 00:00:00 2001 From: Ada Christine Date: Mon, 14 Feb 2022 00:33:18 +0000 Subject: entering idle loop works with timer --- kc/core/pic8259.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'kc/core/pic8259.c') diff --git a/kc/core/pic8259.c b/kc/core/pic8259.c index f449e38..b1de903 100644 --- a/kc/core/pic8259.c +++ b/kc/core/pic8259.c @@ -21,11 +21,18 @@ #define OCW3_READ_ISR 0xb #define OCW3_EOI 0x20 -typedef int (*pic8259_handler_func)(uint8_t irq); - pic8259_handler_func irq_handlers[PIC_ISR_COUNT]; -__attribute__((optimize("O3"))) +void pic8259_irq_install(uint8_t irq, pic8259_handler_func h) +{ + if (irq_handlers[irq]) + { + kprintf("attempt to overwrite irq handler for %u\n", irq); + return; + } + irq_handlers[irq] = h; +} + static void wait(void) { // stall for a few cycles -- cgit v1.3.1-1-g115d