Clarification on some aspects of paging.
Posted: Thu Nov 10, 2005 8:58 pm
Hello,
I have just finished reading the entire section on paging in the Intel manuals
(Many times T_T) and would like some verification that this is correct.
For my paging mechanism on initiation I am going to do something like:
Map all the user memory as RW, U, P
Map some global memory for my libraries etc (Does the "Global" flag do this or should I just make it U, RW, P)
Map the kernel memory as R,S,P
Load the PDBR into CR3
Enable paging
Now a few questions arrise before implementation: Bits 12-31 in the PDEs and PTEs show
the address field now is this virtual of physical? I don't get where the phys2virt
conversion goes on or how to map physical addresses to virtual ones.
Also which "permissions" take priority over what? eg(If a PDE is set as RW, U can a PTE in
the PDE be set as R, S?)
When in ring0 does the paging mechanism even do permission checks? Or can the kernel
access anything regardless of what flags are set?
Now can someone please explain to me when a VMM might become useful?
The only thing I can consider it for is finding a physical adddress for a page and
adding it to the PDE then Invalidating the PTE with whatever flags. Maybe as a sub
function of a "MapPage(phys,virt,flags)" kind of thing.
That's all I can think of for now. But hey atleast I'm clearer on paging than I was
a few months ago.
Thanks,
Nelson
I have just finished reading the entire section on paging in the Intel manuals
(Many times T_T) and would like some verification that this is correct.
For my paging mechanism on initiation I am going to do something like:
Map all the user memory as RW, U, P
Map some global memory for my libraries etc (Does the "Global" flag do this or should I just make it U, RW, P)
Map the kernel memory as R,S,P
Load the PDBR into CR3
Enable paging
Now a few questions arrise before implementation: Bits 12-31 in the PDEs and PTEs show
the address field now is this virtual of physical? I don't get where the phys2virt
conversion goes on or how to map physical addresses to virtual ones.
Also which "permissions" take priority over what? eg(If a PDE is set as RW, U can a PTE in
the PDE be set as R, S?)
When in ring0 does the paging mechanism even do permission checks? Or can the kernel
access anything regardless of what flags are set?
Now can someone please explain to me when a VMM might become useful?
The only thing I can consider it for is finding a physical adddress for a page and
adding it to the PDE then Invalidating the PTE with whatever flags. Maybe as a sub
function of a "MapPage(phys,virt,flags)" kind of thing.
That's all I can think of for now. But hey atleast I'm clearer on paging than I was
a few months ago.
Thanks,
Nelson