Page 1 of 1
Triple Fault on Far Jump To Long Mode
Posted: Sat May 26, 2018 5:52 pm
by K3achas
Whenever I run the following code to switch to long mode in qemu, it triple faults (by way of #GP). I've tried changing the GDT entry for the code segment, but I haven't had success so far. Any ideas would be much appreciated.
Links to file for the
code to switch from the 32-bit environment grub loads the bootstrapper in to 64-bit long mode (fault is on the far jump), the
gdt, and the
overall repository.
Re: Triple Fault on Far Jump To Long Mode
Posted: Mon Jun 04, 2018 6:58 am
by OmeletHopper
This (most likely) won't fix your triple fault, but just a quick look at your early.asm and I noticed you've labeled (and set up) your stack backwards.
Remember: On x86 The stack grows downwards. From the wiki:
Code: Select all
To set up a stack, we set the esp register to point to the top of our
stack (as it grows downwards on x86 systems). This is necessarily done
in assembly as languages such as C cannot function without a stack.
Although written for 32 bit protected mode, it should apply to you. I could also be completely wrong, because I am new to OSDev, but being proven wrong is an opportunity to learn
EDIT: Sorry, I goofed. I misread your code and had a dyslexic moment. Your stack is set up properly.
Re: Triple Fault on Far Jump To Long Mode
Posted: Mon Jun 04, 2018 8:17 am
by iansjack
1. Perhaps I'm missing something, but I couldn't see a long jump in your code.
2. You don't appear to set up a page table.