Update markdown and tabs and stuff
This commit is contained in:
@@ -54,7 +54,9 @@ looking up the fourth group in the page directory. It finds the address of the
|
||||
page directory and assumes this is the page table for the group. It caries on,
|
||||
looking up the second entry in this 'page table' and gets the address of the
|
||||
page it wants. This happens to be the address of the page table for the second
|
||||
group. {: .center .noborder}
|
||||
group.
|
||||
|
||||
{: .center .noborder}
|
||||
|
||||
In other words, you can access any page table through a fixed address in
|
||||
memory. But wait, it gets even better.
|
||||
@@ -64,11 +66,13 @@ virtual memory. The MMU will look up the last entry in the page directory and
|
||||
get the address of the page directory. It will then look up the last entry in
|
||||
the page directory and get the address of the page directory (that's not a typo
|
||||
- I meant to write the same thing twice). This lets you access the page
|
||||
directory too through a fixed memory address. {: .center .noborder}
|
||||
directory too through a fixed memory address.
|
||||
|
||||
{: .center .noborder}
|
||||
|
||||
###Some considerations
|
||||
An important question to put at this point is whether a recursive page
|
||||
directory is really a good idea.
|
||||
directory is really a good idea.
|
||||
|
||||
In our imaginary computer with its really small address space, we notice that
|
||||
the page table and directories now reserve a quarter of the entire available
|
||||
@@ -78,7 +82,7 @@ address space, though, which is more reasonable. Then again, if your computer
|
||||
has 4 gigabytes of physical RAM, this would mean there is four megabytes of it
|
||||
that can't be used. Then again again, if you have easy access to your page
|
||||
tables - such as through a recursive page directory - you can just page in
|
||||
those 4 megabytes as needed.
|
||||
those 4 megabytes as needed.
|
||||
|
||||
There are other simple ways of accessing the page directory and tables. For
|
||||
example, if you just keep track of the page directory and one page table it's
|
||||
@@ -91,16 +95,16 @@ tool, others don't.
|
||||
Finally, if a recursive page directory is used on an x86, the following can be
|
||||
used to access the page directories and tables:
|
||||
|
||||
uint32_t *page_dir = 0xFFFFF000;
|
||||
uint32_t *page_tables = 0xFFC00000;
|
||||
|
||||
//addr = virtual address
|
||||
//phys = physical address (page alligned)
|
||||
//flags = access flags
|
||||
|
||||
page_dir[addr >> 22] = &page_tables[addr >> 12] | flags;
|
||||
page_tables[addr >> 12] = phys | flags;
|
||||
{:.prettyprint}
|
||||
:::c
|
||||
uint32_t *page_dir = 0xFFFFF000;
|
||||
uint32_t *page_tables = 0xFFC00000;
|
||||
|
||||
//addr = virtual address
|
||||
//phys = physical address (page alligned)
|
||||
//flags = access flags
|
||||
|
||||
page_dir[addr >> 22] = &page_tables[addr >> 12] | flags;
|
||||
page_tables[addr >> 12] = phys | flags;
|
||||
|
||||
###Git
|
||||
A recursive page directory has been implemented in Git commit
|
||||
|
||||
Reference in New Issue
Block a user