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!
Paging question
- Combuster
- 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
Answer: &
Question: Do you allocate virtual or physical memory?
Question: Do you allocate virtual or physical memory?
Re: Paging question
Correct!Dario wrote:physical
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:How do you map kernel, memory map I/O space and paging structures(directories and tables) to physical address?
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:What confuses me most is how to map paging structures to themself and load them into cr3 when paging is enabled.
The sample code for this is in the same section linked above.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?