Page directory and table setup
Posted: Tue Feb 12, 2008 4:37 am
I have two questions regarding Paging and Physical Frame Allocation.
(1) I see some kernel implementations which set up paging with 4MB page size. However, for physical frame allocation, they use 4KB page size. I'm quite confused how can different page sizes be used.
(2) If I want to enable paging with 4KB page size, I can use the code below to setup page directory. But, How can I setup page table? and How to link page table to page directory:
Thanks in advance!!!
(1) I see some kernel implementations which set up paging with 4MB page size. However, for physical frame allocation, they use 4KB page size. I'm quite confused how can different page sizes be used.
(2) If I want to enable paging with 4KB page size, I can use the code below to setup page directory. But, How can I setup page table? and How to link page table to page directory:
Code: Select all
//setup page directory
uint32_t page_directory[1024] __attribute__ (aligned (4096));
uint32_t i;
for (i = 0; i < 1024; i++) {
page_directory[i] = i * 4096 | 3; //supervisor level, read/write, present(011 in binary);
}