Opcode/Instruction | Op/En | Description |
---|---|---|
NP 0F 79 VMWRITE r64, r/m64 | RM | Writes a specified VMCS field (in 64-bit mode). |
NP 0F 79 VMWRITE r32, r/m32 | RM | Writes a specified VMCS field (outside 64-bit mode). |
Op/En | Operand 1 | Operand 2 | Operand 3 | Operand 4 |
RM | ModRM:reg (r) | ModRM:r/m (r) | NA | NA |
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.
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 fields2 THEN VMfailValid(VMWRITE to read-only VMCS component); ELSE
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 operand 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).
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;
See the operation section and Section 31.2.
#GP(0) | If the current privilege level is not 0. |
If a memory source operand effective address is outside the CS, DS, ES, FS, or GS segment limit. | |
If the DS, ES, FS, or GS register contains an unusable segment. | |
If the source operand is located in an execute-only code segment. | |
#PF(fault-code) | If a page fault occurs in accessing a memory source operand. |
#SS(0) | If a memory source operand effective address is outside the SS segment limit. |
If the SS register contains an unusable segment. | |
#UD | If not in VMX operation. |
#UD | The VMWRITE instruction is not recognized in real-address mode. |
#UD | The VMWRITE instruction is not recognized in virtual-8086 mode. |
#UD | The VMWRITE instruction is not recognized in compatibility mode. |
#GP(0) | If the current privilege level is not 0. |
If the memory source operand is in the CS, DS, ES, FS, or GS segments and the memory address is in a non-canonical form. | |
#PF(fault-code) | If a page fault occurs in accessing a memory source operand. |
#SS(0) | If the memory source operand is in the SS segment and the memory address is in a non-canonical form. |
#UD | If not in VMX operation. |