[Solved] PIC and spurious IRQs
Posted: Wed May 18, 2022 2:06 am
Hi all,
The PIC page on the wiki says:
Edit: oh wait, I was missing something. You can set privilege level in the IDT to prevent user space raising interrupts.
The PIC page on the wiki says:
I understand that the PIC itself can generate spurious interrupts using the IRQ 7 vector, but I think that it's important to check if any interrupt is spurious (since userspace can easily execute INT xx instruction for any interrupt anyway, and you certainly don't want to send EOI to the PIC in that case). Am I misunderstanding something?For a spurious IRQ, there is no real IRQ and the PIC chip's ISR (In Service Register) flag for the corresponding IRQ will not be set. This means that the interrupt handler must not send an EOI back to the PIC to reset the ISR flag.
The correct way to handle an IRQ 7 is to first check the master PIC chip's ISR to see if the IRQ is a spurious IRQ or a real IRQ. If it is a real IRQ then it is treated the same as any other real IRQ. If it is a spurious IRQ then you ignore it (and do not send the EOI).
Edit: oh wait, I was missing something. You can set privilege level in the IDT to prevent user space raising interrupts.