I'm trying to mask all IRQs except for 0, specifically IRQ 7, which is causing problems with my kernel's initialization, which requires a timer interrupt to drop to userspace. I thought I got it to work, but now I'm getting some boot problems I've traced back to spurious interrupts from IRQ 7. Can you tell me what is wrong with my PIC setup?
Code: Select all
/* Initialize 8259 PIC */
outb(0x20, 0x11); /* Initialize master */
outb(0xA0, 0x11); /* Initialize slave */
outb(0x21, 0x20); /* Master mapped to 0x20 - 0x27 */
outb(0xA1, 0x28); /* Slave mapped to 0x28 - 0x2E */
outb(0x21, 0x04); /* Master thingy */
outb(0xA1, 0x02); /* Slave thingy */
outb(0x21, 0x01); /* 8086 (standard) mode */
outb(0xA1, 0x01); /* 8086 (standard) mode */
outb(0x21, 0xFE); /* Allow only master IRQ 0 */
outb(0xA1, 0xFF); /* Allow no slave IRQs */
I get both IRQ 0 *and* 7, and it depends on optimizations which one fires first (simply because of timing: higher optimizations actually fix it, and I can tell from debug info which fired first). Interestingly, even though this bug is in the test image I posted in another thread, there were no problems with it on other people's real hardware, or in QEMU.