Hello,
I was testing out my Long mode initialization code on Virtualbox and real hardware, but it fails to work. It triple faults. It is pretty lengthy, so I have posted a link to it. It can be found at
https://github.com/Nexware-Project/NexO ... 4/boot.asm.
Thanks,
nexos
Long mode code works in QEMU, but not Virtualbox
Re: Long mode code works in QEMU, but not Virtualbox
You've almost certainly made some assumption about uninitialized variables being zero, the value of the df flag, or something similar.
-
- Member
- Posts: 5574
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Long mode code works in QEMU, but not Virtualbox
Is that a 1G page I see? Did you check for 1G pages before using it?
VirtualBox can log the triple fault. You should be able to narrow down the cause a bit from that.
Also, rather than storing the multiboot magic and address in memory, why not just move them directly to ESI and EDI before jumping to long mode? (You can store them in the wrong registers and do "xchg esi, edi" after jumping to long mode to clear the upper bits.)
VirtualBox can log the triple fault. You should be able to narrow down the cause a bit from that.
Also, rather than storing the multiboot magic and address in memory, why not just move them directly to ESI and EDI before jumping to long mode? (You can store them in the wrong registers and do "xchg esi, edi" after jumping to long mode to clear the upper bits.)
Re: Long mode code works in QEMU, but not Virtualbox
It looks like you're mapping the lowest 1GB page to its equivalent physical page, which is a good place to start.
But, have you verified that your environments support 1GB pages? It's not automatic with 4-level paging. There's a CPUID flag for it.
But, have you verified that your environments support 1GB pages? It's not automatic with 4-level paging. There's a CPUID flag for it.
Re: Long mode code works in QEMU, but not Virtualbox
Yes, that was the problem. I have fixed that, but now the basic video driver triple faults. I will go fix that, and come back here if i have troubles.