Page 1 of 1

Paging

Posted: Sun Jun 16, 2002 11:00 pm
by Mr_X
Does anybody have code/tutorials on setting up Paging?  I know how it works but I can't find any information on how to set it up.

RE:Paging

Posted: Sun Jun 16, 2002 11:00 pm
by carbonBased
All you've gotta do is setup your page tables/directories in advance, load CR3, and set PG in CR0.

Check out the sources for GazOS, I believe it enables paging, and I believe that's what I learned (learnt?) from.

Personally, I'd recommend enabling paging while preserving the location of all the memory pages (ie, no remapping... just map all the pages where they'd be with paging disabled) at first... just for testing purposes.  Makes it easier... then fiddle around with it.  Just my $0.02

Jeff

RE:Paging

Posted: Sun Jun 16, 2002 11:00 pm
by Mr_X
Thank you.
I load CR3 with what? The address of PDE?

RE:Paging

Posted: Mon Jun 17, 2002 11:00 pm
by carbonBased
Oops... I totally skipped right over that part... :)

Bits 11->31 of CR3 contain the (4KB Aligned!!!) physical address of the page directory.

Bits 0->11 are all reserved if you're on an 386.  486+ processors define PWT (Bit 3) and PCD (bit 4)

PWT = Page Write-Through
PCD = Page Cache Disable

Hope that helps.

Jeff

RE:Paging

Posted: Wed Jun 19, 2002 11:00 pm
by pete
Take a look at Intel's Developer Manuals (http://developer.intel.com). I believe Volume 3 of the Pentium manuals digs deepest in covering paging and related features.