diff options
author | Danny Holman <dholman@gymli.org> | 2024-02-16 12:59:43 -0600 |
---|---|---|
committer | Danny Holman <dholman@gymli.org> | 2024-02-16 12:59:43 -0600 |
commit | bcb79aaff44f126064c4698ea74ffe2b68baeb0e (patch) | |
tree | b176c8e6352b78342e622d3384f9b68242773f6b /arch/i386/kernel | |
parent | 157bea025cf120be22efe6327e6dd6b390fc4ba1 (diff) |
arch: i386: move IRQ functions to PIC driver
Move all the functions that control IRQ lines to the PIC driver. This
allows the IDT controller to handle only raw interrupts no matter where
they come from.
Signed-off-by: Danny Holman <dholman@gymli.org>
Diffstat (limited to 'arch/i386/kernel')
-rw-r--r-- | arch/i386/kernel/pic.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/arch/i386/kernel/pic.c b/arch/i386/kernel/pic.c index 9494b92..7a51763 100644 --- a/arch/i386/kernel/pic.c +++ b/arch/i386/kernel/pic.c @@ -1,6 +1,6 @@ #include <kernel/pic.h> -void (*irq_handlers[16])(struct isr_frame *frame); +static void (*irq_handlers[16])(struct isr_frame *frame); void pic_eoi(uint8_t irq) { if (irq >= 8) @@ -38,6 +38,16 @@ uint16_t pic_get_isr(void) { return __pic_get_irq_reg(PIC_READ_ISR); } +void register_irq_handler(uint8_t irq, void (*handler)(struct isr_frame *frame)) { + irq_handlers[irq] = handler; +} + +void irq_dispatch(struct isr_frame *frame) { + (*irq_handlers[frame->vector-32])(frame); + pic_eoi(frame->vector-32); + return; +} + void irq_set_mask(uint8_t irq) { uint16_t port; uint8_t data; |