Intel 64 and IA-32 Architectures Software Developers Manual Volume 3B, System Programming Guide Part 2

Table Of Contents
27-6 Vol. 3
VIRTUALIZATION OF SYSTEM RESOURCES
translation to take effect, guest software should flush any older translations from
the TLB either by executing INVLPG or by loading CR3. Because both these
operations will cause a trap to the VMM, the VMM will gain control and can
remove from the active page-table hierarchy the translations indicated by guest
software (the translation of a specific linear address for INVLPG or all translations
for a load of CR3).
As noted previously, the processor reads the page-table hierarchy to cache transla-
tions in the TLB. It also writes to the hierarchy to main the accessed (A) and dirty (D)
bits in the PDEs and PTEs. The virtual TLB emulates this behavior as follows:
When a page is accessed by guest software, the A bit in the corresponding PTE
(or PDE for a 4-MByte page) in the active page-table hierarchy will be set by the
processor (the same is true for PDEs when active page tables are accessed by the
processor). For guest software to operate properly, the VMM should update the A
bit in the guest entry at this time. It can do this reliably if it keeps the active PTE
(or PDE) marked not-present until it has set the A bit in the guest entry.
When a page is written by guest software, the D bit in the corresponding PTE (or
PDE for a 4-MByte page) in the active page-table hierarchy will be set by the
processor. For guest software to operate properly, the VMM should update the D
bit in the guest entry at this time. It can do this reliably if it keeps the active PTE
(or PDE) marked read-only until it has set the D bit in the guest entry. This
solution is valid for guest software running at privilege level 3; support for more
privileged guest software is described in Section 27.3.5.
27.3.5 Details of Virtual TLB Operation
This section describes in more detail how a VMM could support a virtual TLB. It
explains how an active page-table hierarchy is initialized and how it is maintained in
response to page faults, uses of INVLPG, and accesses to CR3. The mechanisms
described here are the minimum necessary. They may not result in the best perfor-
mance.