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.
I've been trying to fix paging for days now! Can't make it work :/
I have one page directory working, but that lets me only access 4 mb.
When I get a page fault, I get a General Protection Fault right after.
And two other things: When I try to enter 4 GB as the limit for my code segment and data segment, bochs returns this: "jump_protected: IP > limit".
Sometimes I get an error telling me "LDTR.valid = 0", can this be caused by beeing in a bogus segment?
LDTR.valid=0 usually means that you have filled a segment register with some garbage. This garbage appears to have the TI bit set (stating that your selector is local and not global), but as you have no LDT, the BOCHS complains ...
look out for your stack operation and make sure pushes and pops pairs nicely together ... don't forget to remove the CPU-pushed error code for handlers that have one (like GPF) and not to remove it for handlers that don't (like PF).
Seeing the bochs output (registers, etc) could help us to figure out what's wrong more in details ...
pointer 'normal' for your memory layout ? One thing that usually helps is finding what ASM instruction is under that pointer, so that you can figure out why things went wrong.
according to my locally-available info, the Page Fault *does* have an error code, but that error code is 0 (should be checked in the Holy Manuals, though -- which i do not have here )
The way i do is that i ask LD to generate a map of my kernel and i use that map to locate the component.o file on which i'll run objdump ... this is a bit longer process but it avoid the generation of a too long disassembly output ...
that's natural: as long as you don't fix the *cause* of the page fault (for instance changing the entry to "present"), the handler will return to the faulty instruction, which will fault again ...