Return of the triplefaulting paging - this time with atttach

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Crazed123

Re:Return of the triplefaulting paging - this time with attt

Post by Crazed123 »

Hmmm... looks like that whole thing with the jmp is really only needed if your eip will suddenly change, which in the case of the GDT trick it won't.

Identity mapping is in place, the page directory is set correctly... why is this triplefaulting?!
Crazed123

Re:Return of the triplefaulting paging - this time with attt

Post by Crazed123 »

Double posting so people will see the new information.

Would it be an error if my physical page allocator had returned 0x9f000 as a free page and it became my page directory? Some hunch I have says yes.

[edit]The hunch was correct. The real bug wasn't in my paging code, but my bootstrap/initialization of the physical memory allocator, which was calling things free that shouldn't have been. For example, page 0x9f, with memory beginning at 0x9f000, was only 3/4 of a page. Valid memory in that address range stopped at 0x9fc00 and while Bochs would treat a violation of this as valid memory, a real machine doesn't. So I rewrote my bitmap-and-stack filling loop to take these "partial" pages into account and to clear up the spaghetti if-then's being used. Once that was fixed the appropriate free pages were returned for page directory and page table and paging now works!

I proclaim this kernel has scaled the heights of paging WITH a physical memory allocator! Not a great achievment, but it's something.[/edit]
Post Reply