Set Present Bit in Page Fault Exception Handler
Posted: Fri Aug 19, 2011 4:54 am
Hi everyone,
I read a post from "Paging - OSDev Wiki" website here.
Right now, I have an assignment, which is to write a Page Fault Exception Handler. The Page Fault is caused by the present bit in the Page Table Entry is not set.
I'm stuck in changing the Page Table Entry present bit from 0 to 1. From the hints given, "You'll need to map some physical memory to the page table, set the present bit and then iretd to continue processing"
"When the CPU fires a page-not-present exception the CR2 register is populated with the linear address that caused the exception. The upper 10 bits specify the page directory entry (PDE) and the middle 10 bits specify the page table entry (PTE). First check the PDE and see if it's present bit is set, if not setup a page table and point the PDE to the base address of the page table, set the present bit and iretd. If the PDE is present then the present bit of the PTE will be cleared. You'll need to map some physical memory to the page table, set the present bit and then iretd to continue processing."
How Can I map some physical memory to the page table ??
Please Advice
Regards
WJ
I read a post from "Paging - OSDev Wiki" website here.
Right now, I have an assignment, which is to write a Page Fault Exception Handler. The Page Fault is caused by the present bit in the Page Table Entry is not set.
I'm stuck in changing the Page Table Entry present bit from 0 to 1. From the hints given, "You'll need to map some physical memory to the page table, set the present bit and then iretd to continue processing"
"When the CPU fires a page-not-present exception the CR2 register is populated with the linear address that caused the exception. The upper 10 bits specify the page directory entry (PDE) and the middle 10 bits specify the page table entry (PTE). First check the PDE and see if it's present bit is set, if not setup a page table and point the PDE to the base address of the page table, set the present bit and iretd. If the PDE is present then the present bit of the PTE will be cleared. You'll need to map some physical memory to the page table, set the present bit and then iretd to continue processing."
How Can I map some physical memory to the page table ??
Please Advice
Regards
WJ