OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 16, 2024 11:18 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Set Present Bit in Page Fault Exception Handler
PostPosted: Fri Aug 19, 2011 4:54 am 
Offline

Joined: Fri Aug 19, 2011 4:49 am
Posts: 2
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


Top
 Profile  
 
 Post subject: Re: Set Present Bit in Page Fault Exception Handler
PostPosted: Fri Aug 19, 2011 7:31 am 
Offline

Joined: Fri Aug 19, 2011 4:49 am
Posts: 2
If i code in assembly language ,

for an example ..

The Page Table Entry to handle theaddress 0x890000 is 0x890066 and this indicates that the Present bit does not set.
How can I change the value to 0x890067 so that the present bit is set in my page fault exception handler and then iret to continue processing ?

My Page Table Base Pointer, the CR3 register is set to 0x6000.

Please advice :)


Top
 Profile  
 
 Post subject: Re: Set Present Bit in Page Fault Exception Handler
PostPosted: Fri Aug 19, 2011 8:28 am 
Offline
Member
Member
User avatar

Joined: Fri Jun 13, 2008 3:21 pm
Posts: 1700
Location: Cambridge, United Kingdom
I'm sorry, but
  1. This is an assignment. The intention of most assignments is that you do the work yourself
  2. We will point you in the right direction (And Berkus has just done so), but do no more
  3. Even if this wasn't an assignment, we would be unlikely to point you further.
  4. The questions you are asking are predominantly basic programming, with a small portion of OS development specific content. As Berkus has just given you a pseudo-code version of the OS development portion, the remainder of the task reduces to basic programming. We do not teach basic programming as a matter of policy which keeps this community sustainable.

One presumes that someone on an OS development course should have been given all the information they need or pointers as to how to get said information.


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 768 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