As soon as it disabled the PIC and configured the I/O APIC, then configured PIT and the APIC timer, it enabled interrupts. Then, IRQ1 arrives as interrupt 33, IRQ0 arrives once (as interrupt 32), but then, for some reason, interrupt 8 arrives, but does NOT push an error code (which means it's not a real double-fault). So it seems like it's the "misdiagnosed IRQ0" problem, but how, if IRQ0s already arrived as INT 32, and it also works everywhere but not in Bochs?
I can tell that no error code was pushed because for the interrupts where an error code is not pushed, my kernel pushes a "fake" error code of 0. Since it does expect an error code to be pushed by the CPU in this case, it does not push the fake error code, and since no error code was actually pushed by the CPU, the register structure in on the stack is corrupt, and for example, the code segment is placed where RIP should be (you can see that RIP=8):
Code: Select all
DS: 0xFFFF8000001A0010 SS: 0x9FFFFF8000001043
RDI: 0xFFFF8000001B2298 RSI: 0x0000000000000007
RBP: 0xFFFF80000010437F RSP: 0x0000000000000000
RAX: 0xFFFF8000001ADB30 RBX: 0xFFFF8000001001B0
RCX: 0x0000000000000780 RDX: 0x00000000000003D5
R8: 0x0000000000000002 R9: 0xFFFF800000141486
R10: 0x0000000000000000 R11: 0x0000000000000000
R12: 0x0000000000000000 R13: 0x0000000000000000
R14: 0x0000000000000000 R15: 0x0000000000000000
INO: 0x0000000000000008 ERR: 0xFFFF80000018E1AD
CS: 0x0000000000200246 RIP: 0x0000000000000008
RFLAGS: 0xFFFF80000010431F (CPAZSTIDONR)
In function isrHandler at src/idt.c:535
Kernel panic: Unhandled interrupt: 8
What could be causing this random INT 8, and only in Bochs?