Amount of space needed for page directory+page tables

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
LeoLeoLeo
Posts: 2
Joined: Mon Feb 18, 2013 4:12 pm

Amount of space needed for page directory+page tables

Post by LeoLeoLeo »

If I understand correctly... the paging structures are set up so the page directory contains 1024 4-byte page directory entries, each of which point to a page table consisting of 1024 4-byte page table entries. So the total space taken up by the page directory entries and page table entries is 1024*1024*4 (1024*1024 page tables entries, four bytes each), plus 1024*4 (1024 page directory entries, four bytes each), for a total of 4.4 MB. Am I understanding this correctly? Because I keep seeing people refer to the paging structures as taking up 4 MB, and I'm not sure how that can be.

This is for x86, without PAE. Thanks very much!
User avatar
NickJohnson
Member
Member
Posts: 1249
Joined: Tue Mar 24, 2009 8:11 pm
Location: Sunnyvale, California

Re: Amount of space needed for page directory+page tables

Post by NickJohnson »

4198400 bytes (~4.004 MB) is a theoretical maximum. The whole point of having a page directory with page tables is that you don't need to have all the page tables allocated if you're not using the whole address space (which you're usually not), so in practice, you use much less than that per address space.
LeoLeoLeo
Posts: 2
Joined: Mon Feb 18, 2013 4:12 pm

Re: Amount of space needed for page directory+page tables

Post by LeoLeoLeo »

Oops, looks like I can't do math. Got it, thanks!
User avatar
b.zaar
Member
Member
Posts: 294
Joined: Wed May 21, 2008 4:33 am
Location: Mars MTC +6:00
Contact:

Re: Amount of space needed for page directory+page tables

Post by b.zaar »

Have a look at this it'll save the .004MB (4K) page that you're looking for

Self referencing page table
"God! Not Unix" - Richard Stallman

Website: venom Dev
OS project: venom OS
Hexadecimal Editor: hexed
Post Reply