I get a triple fault when running the `lgdt` instruction. Bochs produced some logs that might be useful to diagnose the issue:
Code: Select all
07797480380e[CPU0 ] interrupt(long mode): IDT entry extended attributes DWORD4 TYPE != 0
07797480380e[CPU0 ] interrupt(long mode): IDT entry extended attributes DWORD4 TYPE != 0
(0).[7797480380] [0x00000010fe3a] 0008:ffffffffffe02e3a (unk. ctxt): lgdt %ds:(%rax) ; 0f0110
07797480380p[CPU0 ] >>PANIC<< exception(): 3rd (13) exception with no resolution
1. The function is called
2. We dereference the stack pointer + 4 bytes and move that into rax [The result I got in rax just before the lgdt call was 00000000_ffffffff in the bochs debugger, this seems wrong]
3. We dereference rax and lgdt that [00000000_ffffffff]
I have no idea what is going on that is making this break so horribly. I have pushed the current code to my GitHub repo if you want to see what's going on. The related code is in kernel/hardware/CPU/interrupts.
The github repo is https://github.com/techflashYT/Techflash-OS