Vol. 3C 30-23
VMX INSTRUCTION REFERENCE
VMWRITE—Write Field to Virtual-Machine Control Structure
Description
Writes the contents of a primary source operand (register or memory) to a specified field in a VMCS. In VMX root
operation, the instruction writes to the current VMCS. If executed in VMX non-root operation, the instruction writes
to the VMCS referenced by the VMCS link pointer field in the current VMCS.
The VMCS field is specified by the VMCS-field encoding contained in the register secondary source operand.
Outside IA-32e mode, the secondary source operand is always 32 bits, regardless of the value of CS.D. In 64-bit
mode, the secondary source operand has 64 bits.
The effective size of the primary source operand, which may be a register or in memory, is always 32 bits outside
IA-32e mode (the setting of CS.D is ignored with respect to operand size) and 64 bits in 64-bit mode. If the VMCS
field specified by the secondary source operand is shorter than this effective operand size, the high bits of the
primary source operand are ignored. If the VMCS field is longer, then the high bits of the field are cleared to 0.
Note that any faults resulting from accessing a memory source operand occur after determining, in the operation
section below, that the relevant VMCS pointer is valid but before determining if the destination VMCS field is
supported.
Operation
IF (not in VMX operation) or (CR0.PE = 0) or (RFLAGS.VM = 1) or (IA32_EFER.LMA = 1 and CS.L = 0)
THEN #UD;
ELSIF in VMX non-root operation AND (“VMCS shadowing” is 0 OR secondary source operand sets bits in range 63:15 OR
VMWRITE bit corresponding to bits 14:0 of secondary source operand is 1)
1
THEN VMexit;
ELSIF CPL
>
0
THEN #GP(0);
ELSIF (in VMX root operation AND current-VMCS pointer is not valid) OR
(in VMX non-root operation AND VMCS-link pointer is not valid)
THEN VMfailInvalid;
ELSIF secondary source operand does not correspond to any VMCS field
THEN VMfailValid(VMREAD/VMWRITE from/to unsupported VMCS component);
ELSIF VMCS field indexed by secondary source operand is a VM-exit information field AND
processor does not support writing to such fields
2
THEN VMfailValid(VMWRITE to read-only VMCS component);
ELSE
IF in VMX root operation
THEN field indexed by secondary source operand in current VMCS ← primary source operand;
ELSE field indexed by secondary source operand in VMCS referenced by VMCS link pointer ← primary source operand;
FI;
VMsucceed;
FI;
Opcode
Instruction
Description
0F 79
VMWRITE r64, r/m64
Writes a specified VMCS field (in 64-bit mode)
0F 79
VMWRITE r32, r/m32
Writes a specified VMCS field (outside 64-bit mode)
1. The VMWRITE bit for a secondary source operand is defined as follows. Let x be the value of bits 14:0 of the secondary source oper-
and and let addr be the VMWRITE-bitmap address. The corresponding VMWRITE bit is in bit position x & 7 of the byte at physical
address addr | (x » 3).
2. Software can discover whether these fields can be written by reading the VMX capability MSR IA32_VMX_MISC (see Appendix A.6).