background image

30-20 Vol. 3C

VMX INSTRUCTION REFERENCE

VMREAD—Read Field from Virtual-Machine Control Structure

Description

Reads a specified field from a VMCS and stores it into a specified destination operand (register or memory). In VMX 
root operation, the instruction reads from the current VMCS. If executed in VMX non-root operation, the instruction 
reads from 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 source operand. Outside IA-32e 
mode, the source operand has 32 bits, regardless of the value of CS.D. In 64-bit mode, the source operand has 64 
bits. 
The effective size of the destination 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 source operand is shorter than this effective operand size, the high bits of the destination operand 
are cleared to 0. If the VMCS field is longer, then the high bits of the field are not read.
Note that any faults resulting from accessing a memory destination operand can occur only after determining, in 
the operation section below, that the relevant VMCS pointer is valid and that the specified 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 source operand sets bits in range 63:15 OR
VMREAD bit corresponding to bits 14:0 of 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 source operand does not correspond to any VMCS field

THEN VMfailValid(VMREAD/VMWRITE from/to unsupported VMCS component);
ELSE

IF in VMX root operation

THEN destination operand ← contents of field indexed by source operand in current VMCS;

ELSE destination operand ← contents of field indexed by source operand in VMCS referenced by VMCS link pointer;

FI;
VMsucceed;

FI;

Flags Affected

See the operation section and Section 30.2.

Protected Mode Exceptions

#GP(0)

If the current privilege level is not 0.

Opcode

Instruction

Description

0F 78

VMREAD r/m64, r64

Reads a specified VMCS field (in 64-bit mode).

0F 78

VMREAD r/m32, r32

Reads a specified VMCS field (outside 64-bit mode).

1. The VMREAD bit for a source operand is defined as follows. Let x be the value of bits 14:0 of the source operand and let addr be the 

VMREAD-bitmap address. The corresponding VMREAD bit is in bit position & 7 of the byte at physical address addr | (x » 3).