I've been trying to write an x86_64 kernel in rust using the Limine boot protocol. Initially I based a lot of what I had on the tutorials on https://os.phil-opp.com/ but I found that I had to figure most things out myself as I decided to restart and use Limine as the bootloader.
Recently I've been trying to implement paging using a custom recursive page table that allows me to modify it without it being loaded (makes it a lot easier to set everything up up until that point), instead of relying on one from the x86_64 crate.
Whenever I load the page table however, I get a triple fault. I've been trying to debug this for a couple days now and I feel like I'm not making any progress whatsoever.
Using info mem and info tlb doesn't seem to show anything wrong, I am mapping the kernel and the kernel stack as well as the page table itself and those appear to be correct in there.
I've also tried logging all interrupts and in the first page fault it does show CR2 to have a strange value ending in 0x9, which I think means there might be some stack corruption, although I wouldn't really know how or why that could be happening.
The code for this project is hosted at https://github.com/h3tR/kermol and the page table is loaded in https://github.com/h3tR/kermol/blob/mas ... le.rs#L211
I might be forgetting some details so feel free to ask for anything I might have left out of this post. I also hope the code is readable enough, I try to add comments as much as I can but I doubt that is enough.
Any help is greatly appreciated.
