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

Table Of Contents
Vol. 3 20-1
CHAPTER 20
VIRTUAL-MACHINE CONTROL STRUCTURES
20.1 OVERVIEW
The virtual-machine control data structure (VMCS) is defined for VMX operation. A
VMCS manages transitions in and out of VMX non-root operation (VM entries and
VM exits) as well as processor behavior in VMX non-root operation. This structure is
manipulated by the new instructions VMCLEAR, VMPTRLD, VMREAD, and VMWRITE.
A VMM can use a different VMCS for each virtual machine that it supports. For a
virtual machine with multiple logical processors (virtual processors), the VMM can
use a different VMCS for each virtual processor.
Each logical processor associates a region in memory with each VMCS. This region is
called the VMCS region.
1
Software references a specific VMCS by using the 64-bit
physical address of the region; such an address is called a VMCS pointer. VMCS
pointers must be aligned on a 4-KByte boundary (bits 11:0 must be zero). On
processors that support Intel 64 architecture, these pointers must not set bits
beyond the processor’s physical-address width.
2
On processors that do not support
Intel 64 architecture, they must not set any bits in the range 63:32.
A logical processor may maintain any number of active VMCSs. At any given time,
one is the current VMCS:
Software makes a VMCS active by executing VMPTRLD with the address of the
VMCS. The processor may optimize VMX operation by maintaining the state of an
active VMCS in memory, on the processor, or both. Software should not make a
VMCS active on more than one logical processor (see Section 20.10.1 for how to
migrate a VMCS from one logical processor to another). Software makes a VMCS
inactive by executing VMCLEAR with the address of the VMCS. A logical processor
does not use an inactive VMCS or maintain its state on the processor.
If VMXOFF is executed while a VMCS is active, the VMCS data in the corre-
sponding VMCS region are undefined after execution of VMXOFF. Software can
avoid this problem by avoiding execution of VMXOFF while a VMCS is active.
Software makes a VMCS current by executing VMPTRLD with the address of the
VMCS; that address is loaded into the current-VMCS pointer. VMX instructions
VMLAUNCH, VMPTRST, VMREAD, VMRESUME, and VMWRITE operate on the
current VMCS. In particular, the VMPTRST instruction stores the current-VMCS
1. The amount of memory required for a VMCS region is at most 4 KBytes. The exact size is imple-
mentation specific and can be determined by consulting the VMX capability MSR
IA32_VMX_BASIC to determine the size of the VMCS region (see Appendix G.1).
2. Software can determine a processor’s physical-address width by executing CPUID with
80000008H in EAX. The physical-address width is returned in bits 7:0 of EAX.