Paging (This is a real problem this time...)
Posted: Thu Sep 21, 2006 1:34 pm
Heyyyyy people.
First things first.
My Second Stage bootloader is now coded entirely in C.
It sets up all kinds of things, probes ram to get memory size, etc.
Sets up Paging.
Identity maps 0-1MiB.
Then it aliases 3GiB to 1MiB. (maps up to 5MiB up from 3GiB).
Anywho, Kernel works happily and ive implemented a nice set of handy debugging things, like a little box on the screen that shows you the value of the registers at any time.
Anywho, the problem is - I dont like having to rely on a ... 'early' Page Directory (at 0x9000).
So, I am trying to reinitialize Paging, to use structures from Kernel space. (New PAge dir is at 0xC0006000).
Everything seems to go ok,
Cr3 is loaded with the new Address for the PDIR, All the entries are filled with the correct data, and all the Page descriptors have the right addresses and permissions.
However, After paging has 'reanabled', it just dies.
its like paging stops working altogether, because Bochs tells me its a Physical RAM read error.
(Its trying to read from 3GiB Kernelspace... physical in the VMachine, rather than it being virtual and translated).
Im not sure why, but I remember someone mentioning you having to 'invalidate' the Page Directory cache? or something like that?
Any help would be super, ultra MEGA appreciated.
Thanks!
~zeii.
First things first.
My Second Stage bootloader is now coded entirely in C.
It sets up all kinds of things, probes ram to get memory size, etc.
Sets up Paging.
Identity maps 0-1MiB.
Then it aliases 3GiB to 1MiB. (maps up to 5MiB up from 3GiB).
Anywho, Kernel works happily and ive implemented a nice set of handy debugging things, like a little box on the screen that shows you the value of the registers at any time.
Anywho, the problem is - I dont like having to rely on a ... 'early' Page Directory (at 0x9000).
So, I am trying to reinitialize Paging, to use structures from Kernel space. (New PAge dir is at 0xC0006000).
Everything seems to go ok,
Cr3 is loaded with the new Address for the PDIR, All the entries are filled with the correct data, and all the Page descriptors have the right addresses and permissions.
However, After paging has 'reanabled', it just dies.
its like paging stops working altogether, because Bochs tells me its a Physical RAM read error.
(Its trying to read from 3GiB Kernelspace... physical in the VMachine, rather than it being virtual and translated).
Im not sure why, but I remember someone mentioning you having to 'invalidate' the Page Directory cache? or something like that?
Any help would be super, ultra MEGA appreciated.
Thanks!
~zeii.