Code: Select all
add esp, 4
...
Edit:
Conclusion: Because I had written my own bootloader, the PIC was incorrectly mapped to the exception interrupts and I needed to manually reprogram it. Thanks Brendan!
Code: Select all
add esp, 4
That's not a double fault, it's a PIT (Programmable Interval Timer) IRQ.campital wrote:Time for my first post! So, I am having problems setting up the GDT and IDT (or it could have occured somewhere else). What happens is an exception is immediately triggered when the STI instruction is executed. I have observed that it initially starts out with a double fault (afaik), but to my knowledge it is not pushing an error code like it should, throwing off the stack.
Code: Select all
mov al, 0xFF
out 0x21, al
out 0xA1, al
Brendan is incorrect, that's unnecessary. You only need a CLI instruction before you switch to protected mode (but after you finish calling BIOS functions).dragon7307 wrote: ↑Thu Jan 23, 2025 12:50 pmSo just to get this right, you're saying that I should issue two outb commands right at the start of my custom bootloader (still in real mode) like so:
The BIOS can't clean up pending interrupts if it never receives them. It also doesn't need to, because initializing the PICs will clean up pending interrupts anyway.dragon7307 wrote: ↑Thu Jan 23, 2025 12:50 pmThis would mask out any further interrupts and the BIOS could - over the remainder of my bootloader - clear up all pending IRQS.
You've only hidden the problem. There are still situations where you can receive an interrupt before you're prepared to handle it. The correct solution is to move the STI instruction to after you're done initializing the PICs.