OSDev.org

The Place to Start for Operating System Developers
It is currently Sun Aug 20, 2017 2:05 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Relationship between Page Directory & Page Table
PostPosted: Tue Sep 06, 2016 12:04 am 
Offline

Joined: Sat Apr 04, 2015 9:35 am
Posts: 14
Location: Windsor, UK
Hey,

So I've run in to a bit of confusion whilst implementing my paging algorithm. The problem is specifically one paging is activated. How do I create/construct new page tables?

When I go to create a new page for a page structure (table or directory) I request a physical page from the PMM. The problem is my PMM is returning physical addresses (which is how it should be as far I'm concerned, but please correct me if I should address this), and thus I'm unable to build the structure in the page. Typically this occurs as another page fault exception stating that r/w permissions are incorrect, address not found, etc.

One solution I've thought is to reserve a single page inside the Kernel Heap for creating paging structures. Point that page at the new structure, setup the current paging directory to reference it. Once everything is constructed install the correct page directory entry and remove the heap page for it so that it can be used for future swaps. This solution will obviously need some kind of semaphore support integrating into it once O start on threads and multitasking.

Another solution I thought of (which seems even worse in my mind) is to disable paging whilst constructing page tables and page directories, and then re-enable it after the operation is complete.

However both of these solutions seems clunky to me.

Am I thinking along the right lines here? How is this typically done?

Thanks

_________________
I'm writing a series of Novels, making a toy Operating System and experimental compiler... I seemingly hate free time (not true) and trying to destroy it with as many large projects as possible.


Top
 Profile  
 
 Post subject: Re: Relationship between Page Directory & Page Table
PostPosted: Tue Sep 06, 2016 12:15 am 
Offline
Member
Member

Joined: Sat Nov 07, 2015 3:12 pm
Posts: 145
Hi,
You have to " map " the page table structure you want to edit to a virtual address, and then write at that virtual address. Indeed my friend , you cannot write directly to physical memory anymore.

If your architecture supports it (Intel, recent ARMS..) , you can do " recursive mapping " , which permanently and automatically maps all your page table structures, reserving a slice of the virtual address space for all structures.


Top
 Profile  
 
 Post subject: Re: Relationship between Page Directory & Page Table
PostPosted: Tue Sep 06, 2016 12:36 am 
Offline

Joined: Sat Apr 04, 2015 9:35 am
Posts: 14
Location: Windsor, UK
Boris wrote:
Hi,
You have to " map " the page table structure you want to edit to a virtual address, and then write at that virtual address. Indeed my friend , you cannot write directly to physical memory anymore.

If your architecture supports it (Intel, recent ARMS..) , you can do " recursive mapping " , which permanently and automatically maps all your page table structures, reserving a slice of the virtual address space for all structures.


How is this recursive mapping achieved? What is the process involved?

_________________
I'm writing a series of Novels, making a toy Operating System and experimental compiler... I seemingly hate free time (not true) and trying to destroy it with as many large projects as possible.


Top
 Profile  
 
 Post subject: Re: Relationship between Page Directory & Page Table
PostPosted: Tue Sep 06, 2016 12:59 am 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 797
snijj wrote:
How is this recursive mapping achieved? What is the process involved?

You put in one PDE the physical address of the PD. Draw it to see what it entails.


Top
 Profile  
 
 Post subject: Re: Relationship between Page Directory & Page Table
PostPosted: Tue Sep 13, 2016 4:41 am 
Offline
Member
Member

Joined: Thu Dec 16, 2010 3:08 pm
Posts: 36
Have a look here to further understand recursive page directory mapping. After being confused myself, I read this, and understood everything at an instant! :)

_________________

Daniel Broder Jensen
UNICORN OS


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group