Discussion:
Page Directory and Table Setup
(too old to reply)
Ben Rogers
2005-03-23 02:29:28 UTC
Permalink
So, I understand most of the relationsihps between the addresses and the
tables and directories involved in paging. What i'm still unclear about
from the project description is how these structures are allocated, and
where. The description says allocate a page for them, and I understand
setting up the PDBR pointer to access the page directory. I guess i'm
getting confused as to how many directories/tables I need, and where to
allocate them (or I guess how to allocate them in the page I have
already set up). Can someone point me in the right direction?

Thanks,
Ben
Tom Brubaker
2005-03-23 03:36:36 UTC
Permalink
There's a pretty good chance I'm completely wrong, but here's my hunch:

I think for the kernel part you only need one directory. Since the
directory is one page (4k) long, it will have room for 1024 4-byte entries,
each of which points to a page table which must be allocated (and each of
which is also one page long). Then you can interate through all pages of
physical memory and split apart the base address to get a directory index
and table index. You can find the table and table entry, which is already
allocated, and fill in the members of the struct.

Presumably it is OK to allocate page tables that are not necessarily used
yet, because if everything is initialized to 0 then the 'present' flag is
also set to 0 and hence the entries are ignored.

All that said, this is the structure I'm using and it isn't working. So any
thoughts are welcome.

-Tom-

Loading...