Paging Confusion

If you are new to OS Development, plan on spending some time here first before going into the other forums.

Moderator:Moderators

Post Reply
oib111
Posts:38
Joined:Sat Aug 29, 2009 6:44 am
Paging Confusion

Post by oib111 » Tue Sep 29, 2009 1:21 am

On PTEs and PDEs the bits reserved for the frame address are only 20-bits. So you can really only represent addresses up to 1MB. So is the frame address really multiplied by 4K to get the physical address? So like if the frame address is 1 it represents the page at 4096-8191?

User avatar
Mike
Site Admin
Posts:465
Joined:Sat Oct 20, 2007 7:58 pm
Contact:

Re: Paging Confusion

Post by Mike » Thu Oct 01, 2009 3:29 am

Hello,

It is not stressed to much in the paging chapter (although I suppose it should. It will be updated.) The frame address portion only stores the most significant 20 bits of the frame address, not the entire frame address. The entire frame address is the 32 bit PTE or PDE itself. However, because pages must be 4KB aligned, the least significant 12 bits will always be 0. The architecture uses this fact and takes advantage of it by adding flags to the unused bits.

Thus, the frame address is not the entire frame address - only the top 20 bits of it. The rest of the 32 bit address is 0. Thus the smallest you can use is 0, second is 4096, and largest is, of course, 4gb. You cannot use any address that is not a multiple of 4k do to this.
Lead Programmer for BrokenThorn Entertainment, Co.
Website: http://www.brokenthorn.com
Email: webmaster@brokenthorn.com

oib111
Posts:38
Joined:Sat Aug 29, 2009 6:44 am

Re: Paging Confusion

Post by oib111 » Thu Oct 01, 2009 11:27 pm

Thanks that cleared that up! :)

Post Reply