VMCALL

Call to VM Monitor

Opcodes

Hex Mnemonic Encoding Long Mode Legacy Mode Description
0F 01 C1 VMCALL None None None 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

26.15.2 in IA-32 Intel Architecture Software Developer's Manual, Volume 3B). 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

26.15.6 in IA-32 Intel Architecture Software Developer's Manual, Volume 3B).

Pseudo Code

IF not in VMX operation
	#UD;
ELSE
	IF in VMX non-root operation
		VM exit;
	ELSE
		IF (RFLAGS.VM = 1) or (IA32_EFER.LMA = 1 and CS.L = 0)
			#UD;
		ELSE
			IF CPL > 0
				#GP(0);
			ELSE
				IF in SMM or the logical processor does not support the dual-monitor treatment of SMIs and SMM or the valid bit in the IA32_SMM_MONITOR_CTL MSR is clear
					VMfail (VMCALL executed in VMX root operation);
				ELSE
					IF dual-monitor treatment of SMIs and SMM is active
						perform an SMM VM exit (see Section 26.15.2  of the Intel® 64 and IA-32 Architectures Software Developer's Manual, Volume 3B);
					ELSE
						IF current-VMCS pointer is not valid
							VMfailInvalid;
						ELSE
							IF launch state of current VMCS is not clear
								VMfailValid(VMCALL with non-clear VMCS);
							ELSE
								IF VM-exit control fields are not valid (see Section 26.15.6.1 of the Intel® 64 and IA-32 Architectures Software Developer's Manual, Volume 3B)
									VMfailValid (VMCALL with invalid VM-exit control fields);
								ELSE
									enter SMM;
									read revision identifier in MSEG;FI;
								FI;
							FI;
						FI;
					FI;
				FI;
			FI;
		FI;
	FI;
	IF revision identifier does not match that supported by processor
		leave SMM;
		VMfailValid(VMCALL with incorrect MSEG revision identifier);
	ELSE
		read SMM-monitor features field in MSEG (see Section 26.15.6.2, in the Intel® 64 and IA-32 Architectures Software Developer's Manual, Volume 3B);
		IF features field is invalid
			leave SMM;
			VMfailValid(VMCALL with invalid SMM-monitor features);
		ELSE
			activate dual-monitor treatment of SMIs and SMM (see Section 26.15.6 in the Intel® 64 and IA-32 Architectures Software Developer's Manual, Volume 3B);
		FI;
	FI;
FI;

Flags Affected

See the operation section and Section 5.2.

Exceptions

64-Bit Mode Exceptions

Exception Description
#UD If executed outside VMX non-root operation.

Compatibility Mode Exceptions

Exception Description
#UD If executed outside VMX non-root operation.

Virtual-8086 Mode Exceptions

Exception Description
#UD If executed outside VMX non-root operation.

Real-Address Mode Exceptions

Exception Description
#UD A logical processor cannot be in real-address mode while in VMX operation and the VMCALL instruction is not recognized outside VMX operation.

Protected Mode Exceptions

Exception Description
#UD If executed outside VMX operation.
#GP(0) If the current privilege level is not 0 and the logical processor is in VMX root operation.