Though I think I set everything up correctly, the page table inspection in bochs tells me, that I am mapping 32-bit linear addresses to 64-bit physical addresses (I assume so, since the output shows 16 hexadecimal chars for the physical addresses).
However, my kernel is linked at 0xffffffff80200000 (In the linker file from the kernel):
Code: Select all
ENTRY(_entry)
KERNEL_BASE_ADDR = 0xffffffff80200000;
SECTIONS
{
. = KERNEL_BASE_ADDR;
...
Code: Select all
elf64_phdr->p_vaddr
The result of the far jump to the kernel results in an grayish screen, which seems to be the effect of an interrupt. As this interrupt is most likely resulting from a page fault, the paging mechanism seems to have a bug.
With your help I want to check if my build up is correct the way I did it so far:
Boot -> Grub:
- - The entry in the grub bootloader starts the separate loader of mine, which is very similar to the one in the tutorial.
- I'm setting up the GDT (32-bit), IDT(64-bit) and the Paging (with PML4, 4-level paging). -> Setup in this exact order (GDT, IDT, Paging).
- I'm parsing the elf64 header from the multiboot struct, just as in the tutorial, and retrieve the kernel entry point address, which is 0xffffffff80200000.
- I enable paging.
- I setup the GDT for 64-bit and far jump into the kernel entry point (0xffffffff80200000).
If this build up is correct, then the mistake might be on my side, most likely in the paging mechanism. However, the bochs page table output irritates me a little, since it only shows 32-bit linear addresses, even though I am mapping 64-bit linear addresses (48-bit, since the last 16 bits are a copy of bit 47).
I hope you can give me a hint or tell me if my build up is wrong.