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

Table Of Contents
26-22 Vol. 3
VIRTUAL-MACHINE MONITOR PROGRAMMING CONSIDERATIONS
to proceed. This level of protection may be utilized by VMMs to selectively allow
guest access to some MSRs while virtualizing others.
Default MSR protection: If the use-MSR-bitmap control is not set, an attempt
by a guest to access any MSR causes a VM exit. This also occurs for any attempt
to access an MSR outside the ranges identified above (even if the use-MSR-
bitmap control is set).
VM exits due to guest MSR accesses may be identified by the VMM through VM-exit
reason codes. The MSR-read exit reason implies guest software attempted to read an
MSR protected either by default or through MSR bitmaps. The MSR-write exit reason
implies guest software attempting to write a MSR protected through the VM-execu-
tion controls. Upon VM exits caused by MSR accesses, the VMM may virtualize the
guest MSR access through emulation of RDMSR/WRMSR.
26.10.2 Using VM-Exit Controls for MSRs
If a VMM allows its guest to access MSRs directly, the VMM may need to store guest
MSR values and load host MSR values for these MSRs on VM exits. This is especially
true if the VMM uses the same MSRs while in VMX root operation.
A VMM can use the VM-exit MSR-store-address and the VM-exit MSR-store-count exit
control fields (see Section 20.7.2) to manage how MSRs are stored on VM exits. The
VM-exit MSR-store-address field contains the physical address (16-byte aligned) of
the VM-exit MSR-store area (a table of entries with 16 bytes per entry). Each table
entry specifies an MSR whose value needs to be stored on VM exits. The VM-exit
MSR-store-count contains the number of entries in the table.
Similarly the VM-exit MSR-load-address and VM-exit MSR-load-count fields point to
the location and size of the VM-exit MSR load area. The entries in the VM-exit MSR-
load area contain the host expected values of specific MSRs when a VM exit occurs.
Upon VM-exit, bits 127:64 of each entry in the VM-exit MSR-store area is updated
with the contents of the MSR indexed by bits 31:0. Also, bits 127:64 of each entry in
the VM-exit MSR-load area is updated by loading with values from bits 127:64 the
contents of the MSR indexed by bits 31:0.
26.10.3 Using VM-Entry Controls for MSRs
A VMM may require specific MSRs to be loaded explicitly on VM entries while
launching or resuming guest execution. The VM-entry MSR-load-address and
VM-entry MSR-load-count entry control fields determine how MSRs are loaded on
VM-entries. The VM-entry MSR-load-address and count fields are similar in structure
and function to the VM-exit MSR-load address and count fields, except the MSR
loading is done on VM-entries.