Page 1 of 1
Paging question
Posted: Sat Nov 13, 2010 6:37 pm
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!
Re: Paging question
Posted: Sat Nov 13, 2010 6:52 pm
by Combuster
Answer: &
Question: Do you allocate virtual or physical memory?
Re: Paging question
Posted: Sat Nov 13, 2010 6:59 pm
by Dario
physical
Re: Paging question
Posted: Sat Nov 13, 2010 7:23 pm
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.