diff --git a/kernel/pic.c b/kernel/pic.c index 8b661b6..8cd5588 100644 --- a/kernel/pic.c +++ b/kernel/pic.c @@ -58,3 +58,13 @@ void irq(uint8 idx, bool t) { outb(port, data); } } + +static uint16 irq_reg(int ocw3) { + outb(PIC1_CMD, ocw3); + outb(PIC2_CMD, ocw3); + return (inb(PIC2_CMD) << 8 | inb(PIC1_CMD)); +} + +uint16 get_irr() { return irq_reg(PIC_R_IRR); } // fetch IRR +uint16 get_isr() { return irq_reg(PIC_R_ISR); } // fetch ISR + diff --git a/kernel/pic.h b/kernel/pic.h index 04f4fa2..27d1017 100644 --- a/kernel/pic.h +++ b/kernel/pic.h @@ -42,3 +42,5 @@ void pic_disable(); void irq(uint8, bool); static uint16 irq_reg(int ocw3); +uint16 get_irr(); +uint16 get_isr();