diff options
| author | Ada Christine <adachristine18@gmail.com> | 2022-02-14 00:33:18 +0000 |
|---|---|---|
| committer | Ada Christine <adachristine18@gmail.com> | 2022-02-14 00:33:18 +0000 |
| commit | 86de700207fb0114ec52fafc36f84e1cbe508fd8 (patch) | |
| tree | 830649e3b7081e4c43d579a6ded67f7ee18add92 /kc/core/pic8259.c | |
| parent | e8a76b2f6b53d99640ceb2850bf4e45118b923f1 (diff) | |
entering idle loop works with timer
Diffstat (limited to 'kc/core/pic8259.c')
| -rw-r--r-- | kc/core/pic8259.c | 13 |
1 files changed, 10 insertions, 3 deletions
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 |
