I get one spurious IRQ in bochs each time my os starts and I have more then 1 threads in the scheduler queue.
The spurious IRQ happens on first task switch and then never occurs again. I tried removing every line of code that does EOI but that doesn't help.
How is that even possible? I thought spurious IRQs only happend when you acknowledged a non-existent interrupt.
(it only happens in bochs, qemu works fine)
Heres a screenshot of logs on bochs (interesting thing to note is that the main thread did a few cycles before switching, maybe thats related):
And here's qemu, no spurious IRQs here but the main thread also didn't do a single cycle and got interrupted right after doing sti:
Any ideas why this happens?
Thanks
Update:
I just tried adding some logging to the end_of_interrupt function to see if it gets called and the spurious interrupt disappeared WTFFFFFF
(it only disappears in cases where I dont ever do EOI in my code, if I do I still get a spurious IRQ)
Code: Select all
void PIC::end_of_interrupt(u8 request_number, bool spurious)
{
if (request_number >= 8 && !spurious)
IO::out8<slave_command>(end_of_interrupt_code);
log() << "here"; // ADDING ANY RANDOM CODE ON THIS LINE REMOVES THE SPURIOUS IRQ (IT'S NEVER ACTUALLY LOGGED, AND THIS FUNCTION IS NEVER ACTUALLY CALLED)????????????????
IO::out8<master_command>(end_of_interrupt_code);
}