Paging troubles

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.
Post Reply
HuntrCkr

Paging troubles

Post by HuntrCkr »

Yes, well.... It seems I am having yet another problem. My kernel is running fine, with everything set up including an FDC controller and multi-tasking capability. Then I tried to set up paging. This is giving me real headaches!!

I went over to Bona Fide OS Dev site, and looked at the basic paging tutorial. I have virtually implemented what they said in there to the letter, but it still doesn't seem to work. I get a triple fault (using VMWare, so I can see this), whenever i set the paging bit in CR0 to 1. My CR3 contains the correct address to the PDE, and the PDE is set up correctly for the PTE's. At the moment I have only the first 4Mb of RAM mapped linear (virtual-to-physical).
The only thing I seem to be doing differently is that I set up the paging and try to enable paging when already in Protected Mode... is this a problem?

Banging head against wall,
   HuntrCkr
carbonBased

RE:Paging troubles

Post by carbonBased »

Nope, no problem, you can enable and disable paging while in protected mode.

Just a few guesses:
are all your TSS segments correctly mapped?
is the GDT mapped to the exact same location for each process?
is CR3 set for each task in the TSS?
does each task have every other tasks TSS mapped into its address space?
  ie, if the processor is switching from task A to task B,
  both tasks must have both TSSs mapped into both their address spaces
is the stack properly mapped?

Hopefully somethere there triggers something... unfortunately, I don't know what else it could be.  I got lucky the first time I wrote an OS, and paging just worked... I can't wait to implement it in my current OS, though ;)

Jeff
HuntrCkr

RE:Paging troubles

Post by HuntrCkr »

Hehe... Got up this morning, and it was staring me in the face :)

I first set up the table entries, and then set the pointers to point to a certain memeory location. So, I most likely overwrote a good part of instructions still to be executed in my code, and made my CR3 point to gibberish. Problems solved now :)

Thanks anyway
Post Reply