Vol. 3C 32-5
VIRTUALIZATION OF SYSTEM RESOURCES
As noted above, the VMM maintains an active page-table hierarchy for each virtual machine that it supports. It also
maintains, for each machine, values that the machine expects for control registers CR0, CR2, CR3, and CR4 (they
control address translation). These values are called the guest control registers.
In general, the VMM selects the physical-address space that is allocated to guest software. The term guest address
refers to an address installed by guest software in the guest CR3, in a guest PDE (as a page table base address or
a page base address), or in a guest PTE (as a page base address). While guest software considers these to be
specific physical addresses, the VMM may map them differently.
32.3.5.1 Initialization of Virtual TLB
To enable the Virtual TLB scheme, the VMCS must be set up to trigger VM exits on:
•
All writes to CR3 (the CR3-target count should be 0) or the paging-mode bits in CR0 and CR4 (using the CR0
and CR4 guest/host masks)
•
Page-fault (#PF) exceptions
•
Execution of INVLPG
When guest software first enables paging, the VMM creates an aligned 4-KByte active page directory that is invalid
(all entries marked not-present). This invalid directory is analogous to an empty TLB.
32.3.5.2 Response to Page Faults
Page faults can occur for a variety of reasons. In some cases, the page fault alerts the VMM to an inconsistency
between the active and guest page-table hierarchy. In such cases, the VMM can update the former and re-execute
the faulting instruction. In other cases, the hierarchies are already consistent and the fault should be handled by
the guest operating system. The VMM can detect this and use an established mechanism for raising a page fault to
guest software.
The VMM can handle a page fault by following these steps (The steps below assume the guest is operating in a
paging mode without PAE. Analogous steps to handle address translation using PAE or four-level paging mecha-
Figure 32-1. Virtual TLB Scheme
refill on
TLB miss
CR3
PD
PT
PT
F
F
F
F
PD
"Virtual TLB"
Active
Guest
INVLPG
MOV to CR3
task switch
refill on
page fault
set accessed
and dirty bits
TLB
PD = page directory
PT = page table
F = page frame
INVLPG
MOV to
CR3
task switch
Active Page-Table Hierarchy
Guest Page-Table Hierarchy
PT
PT
F
F
F
F
CR3
set dirty
accessed
OM19040