Correct irq number for slave pic

This commit is contained in:
Mathieu Maret 2018-07-18 01:28:27 +02:00
parent 3fceb00ab4
commit 97a9955b21

4
pic.c
View File

@ -49,7 +49,7 @@ void enableIrq(int irq)
outb(PIC_MASTER_DATA, (status | (1 << irq))); outb(PIC_MASTER_DATA, (status | (1 << irq)));
} else { } else {
uint8_t status = inb(PIC_SLAVE_DATA); uint8_t status = inb(PIC_SLAVE_DATA);
outb(PIC_SLAVE_DATA, (status | (1 << irq))); outb(PIC_SLAVE_DATA, (status | (1 << (irq - 8))));
} }
} }
@ -60,6 +60,6 @@ void disableIrq(int irq)
outb(PIC_MASTER_DATA, (status & ~(1 << irq))); outb(PIC_MASTER_DATA, (status & ~(1 << irq)));
} else { } else {
uint8_t status = inb(PIC_SLAVE_DATA); uint8_t status = inb(PIC_SLAVE_DATA);
outb(PIC_SLAVE_DATA, (status & ~(1 << irq))); outb(PIC_SLAVE_DATA, (status & ~(1 << (irq - 8))));
} }
} }