Relationship between Page Directory & Page Table
Posted: Tue Sep 06, 2016 12:04 am
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
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