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

Table Of Contents
Vol. 3 26-9
VIRTUAL-MACHINE MONITOR PROGRAMMING CONSIDERATIONS
ii) If (1) the relevant VMX capability MSR just read reports that a control can
be set to 0 or 1; and (2) the control’s meaning is known to the VMM; then
set the control based on functionality desired.
iii) If (1) the relevant VMX capability MSR just read reports that a control can
be set to 0 or 1; (2) the control’s meaning is not known to the VMM; and
(3) the relevant VMX capability MSR as read in step (a) reports that a
control can be set to 0; then set the control to 0.
iv) If (1) the relevant VMX capability MSR just read reports that a control can
be set to 0 or 1; (2) the control’s meaning is not known to the VMM; and
(3) the relevant VMX capability MSR as read in step (a) reports that a
control must be 1; then set the control to 1.
A VMM using this algorithm will set to 1 all controls in the default1 class whose
meaning it does not know (in step (b)(i), step (c)(i), or step (c)(iv)). It will
operate correctly even on processors that allow some controls in the default1
class to be 0. Unlike a VMM using Algorithm 1, a VMM using Algorithm 3 will be
able to use the new features enabled by the 0-setting of such controls. Unlike a
VMM using Algorithm 2, a VMM using Algorithm 3 need not know the identities
of the controls in the default1 class.
26.6 PREPARATION AND LAUNCHING A VIRTUAL
MACHINE
The following list describes the minimal steps required by the VMM to set up and
launch a guest VM.
Create a VMCS region in non-pageable memory of size specified by the VMX
capability MSR IA32_VMX_BASIC and aligned to 4-KBytes. Software should read
the capability MSRs to determine width of the physical addresses that may be
used for a VMCS region and ensure the entire VMCS region can be addressed by
addresses with that width. The term “guest-VMCS address” refers to the physical
address of the new VMCS region for the following steps.
Initialize the version identifier in the VMCS (first 32 bits) with the VMCS revision
identifier reported by the VMX capability MSR IA32_VMX_BASIC.
Execute the VMCLEAR instruction by supplying the guest-VMCS address. This will
initialize the new VMCS region in memory and set the launch state of the VMCS
to “clear”. This action also invalidates the working-VMCS pointer register to
FFFFFFFF_FFFFFFFFH. Software should verify successful execution of VMCLEAR
by checking if RFLAGS.CF = 0 and RFLAGS.ZF = 0.
Execute the VMPTRLD instruction by supplying the guest-VMCS address. This
initializes the working-VMCS pointer with the new VMCS region’s physical
address.
Issue a sequence of VMWRITEs to initialize various host-state area fields in the
working VMCS. The initialization sets up the context and entry-points to the VMM