This is a bug that is really annoying me - if, at any point in my kernel code, I issue the "sti" instruction, I get a double fault. Now, according to Intel, a double fault occurs when an exception/interrupt handler was interrupted. The thing is, I have a default handler for ALL 256 interrupts (yes, wasteful, but I thought it might help...) and every single one of them works correctly.
Two things: why would a "sti" instruction issue an immediate interrupt if hardware is masked at the PIC (which has been remapped above the exceptions at good ol' 0x20 and 0x28) and what could possibly cause a second exception?
Also, despite the DF being raised, interrupts are still enabled (I put some code after the "sti" to check eflags).
Double Fault and "sti"
Re:Double Fault and "sti"
Mishandling an error flag?Fraser Gordon wrote: Two things: why would a "sti" instruction issue an immediate interrupt if hardware is masked at the PIC (which has been remapped above the exceptions at good ol' 0x20 and 0x28) and what could possibly cause a second exception?
The processor pushes eflags before doing the interrupt. This stored eflags won't have it's interrupt flag changed. So if interrupts were enabled before the interrupt, and you don't change eflags/stack in the interrupt, and you use iret to return from the interrupt then interrupts will still be enabled when you return. Hopefully that makes sense.Also, despite the DF being raised, interrupts are still enabled (I put some code after the "sti" to check eflags).