vmcall
Call to VM Monitor
VMCALL
Guest VM calls the Hypervisor (VM Exit).
Details
Initiates a VM exit from guest mode to invoke the VM monitor (hypervisor). The instruction immediately transitions control to the hypervisor and is available only when running in VMX non-root mode; execution in root mode raises #UD. RFLAGS.CF and ZF may be set on VM exit depending on the exit reason; other flags are preserved across the transition.
Pseudocode Operation
if (CPL != 0 || VMX_ROOT == 1) raise #UD
VMEXIT(VMCALL_EXIT_REASON)
if (exit_error) { RFLAGS.CF ← 1; RFLAGS.ZF ← 1; }
Example
VMCALL
Encoding
Binary Layout
0F
+0
01
+1
C1
+2
Operands
Reference (Intel® SDM)
Instruction Forms
| Opcode | Instruction | Op/En | 64/32-bit Mode | CPUID | Description |
|---|---|---|---|---|---|
| 0F 01 C1 | VMCALL | ZO | Call to VM monitor by causing VM exit. |
Description
This instruction allows guest software can make a call for service into an underlying VM monitor. The details of the programming interface for such calls are VMM-specific; this instruction does nothing more than cause a VM exit, registering the appropriate exit reason.
Use of this instruction in VMX root operation invokes an SMM monitor (see Section 34.15.2). This invocation will activate the dual-monitor treatment of system-management interrupts (SMIs) and system-management mode (SMM) if it is not already active (see Section 34.15.6).
Operation
IF not in VMX operation THEN #UD; ELSIF in VMX non-root operation THEN VM exit; ELSIF (RFLAGS.VM = 1) or (IA32_EFER.LMA = 1 and CS.L = 0) THEN #UD; ELSIF CPL > 0 or in SEAM root operation THEN #GP(0); ELSIF in SMM or the logical processor does not support the dual-monitor treatment of SMIs and SMM or the valid bit in the IA32_SM- M_MONITOR_CTL MSR is clear THEN VMfail (VMCALL executed in VMX root operation); ELSIF dual-monitor treatment of SMIs and SMM is active THEN perform an SMM VM exit (see Section 34.15.2); ELSIF current-VMCS pointer is not valid THEN VMfailInvalid; ELSIF launch state of current VMCS is not clear THEN VMfailValid(VMCALL with non-clear VMCS); ELSIF VM-exit control fields are not valid (see Section 34.15.6.1) THEN VMfailValid (VMCALL with invalid VM-exit control fields); ELSE enter SMM; read revision identifier in MSEG; IF revision identifier does not match that supported by processor THEN leave SMM; VMfailValid(VMCALL with incorrect MSEG revision identifier); ELSE read SMM-monitor features field in MSEG (see Section 34.15.6.1); IF features field is invalid THEN leave SMM; VMCALL—Call to VM Monitor 33-9 Vol. 3C VMfailValid(VMCALL with invalid SMM-monitor features); ELSE activate dual-monitor treatment of SMIs and SMM (see Section 34.15.6); FI; FI; FI;
Flags Affected
See the operation section and Section 33.2.
Exceptions
Protected Mode Exceptions
#GP(0) If the current privilege level is not 0 and the logical processor is in VMX root operation.
If in SEAM root operation.
#UD If executed outside VMX operation.
Real-Address Mode Exceptions
#UD If executed outside VMX operation.
Virtual-8086 Mode Exceptions
#UD If executed outside VMX non-root operation.
Compatibility Mode Exceptions
#UD If executed outside VMX non-root operation.
64-Bit Mode Exceptions
#UD If executed outside VMX operation.