Paging question

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Dario
Member
Member
Posts: 117
Joined: Sun Aug 31, 2008 12:39 pm

Paging question

Post by Dario »

How do you map kernel, memory map I/O space and paging structures(directories and tables) to physical address?
What confuses me most is how to map paging structures to themself and load them into cr3 when paging is enabled. During the creation of the process, we must allocate space for it's paging structures, somehow fetch physical address of PD and store it into CR3...same thing during the task switch...how do we get physicall address of PD?

Thanks!
____
Dario
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Paging question

Post by Combuster »

Answer: &

Question: Do you allocate virtual or physical memory?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Dario
Member
Member
Posts: 117
Joined: Sun Aug 31, 2008 12:39 pm

Re: Paging question

Post by Dario »

physical
____
Dario
TylerH
Member
Member
Posts: 285
Joined: Tue Apr 13, 2010 8:00 pm
Contact:

Re: Paging question

Post by TylerH »

Dario wrote:physical
Correct!
Dario wrote:How do you map kernel, memory map I/O space and paging structures(directories and tables) to physical address?
How about the more general, how do you map a virtual address to an given physical address. The answer is given in the paging wiki. There's even sample code. :)
Dario wrote:What confuses me most is how to map paging structures to themself and load them into cr3 when paging is enabled.
I assume you mean recursive PDPs and PDs, if not ignore the following. I don't use these, nor understand them. Although I know they aren't necessary in a kernel in the early stages of development. Get it working, then optimize.
Dario wrote:During the creation of the process, we must allocate space for it's paging structures, somehow fetch physical address of PD and store it into CR3...same thing during the task switch...how do we get physicall address of PD?
The sample code for this is in the same section linked above.
Post Reply