VMXOFF

Leave VMX Operation

Opcodes

Hex Mnemonic Encoding Long Mode Legacy Mode Description
0F 01 C4 VMXOFF None None None VMX operation.

Description

Takes the logical processor out of VMX operation, unblocks INIT signals, conditionally re-enables A20M, and clears any address-range monitoring.1

Pseudo Code

IF (not in VMX operation) or (CR0.PE = 0) or (RFLAGS.VM = 1) or (IA32_EFER.LMA = 1 and CS.L = 0)
	#UD;
ELSE
	IF in VMX non-root operation
		VMexit;
	ELSE
		IF CPL > 0
			#GP(0);
		ELSE
			IF dual-monitor treatment of SMIs and SMM is active
				VMfail(VMXOFF under dual-monitor treatment of SMIs and SMM);
			ELSE
				leave VMX operation;
				unblock INIT;
				unblock SMI;
				(* A logical processor is outside SMX operation if GETSEC[SENTER] has not been executed or if GETSEC[SEXIT] was executed after the last execution of GETSEC[SENTER]. See Chapter 6, Safer Mode Extensions Reference. *)
				IF outside SMX operation
					unblock and enable A20M;
				FI;
				clear address-range monitoring;
				VMsucceed;
			FI;
		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 operation.
#GP(0) If executed in VMX root operation with CPL > 0.

Compatibility Mode Exceptions

Exception Description
#UD The VMXOFF instruction is not recognized in compatibility mode.

Virtual-8086 Mode Exceptions

Exception Description
#UD The VMXOFF instruction is not recognized in virtual-8086 mode.

Real-Address Mode Exceptions

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

Protected Mode Exceptions

Exception Description
#UD If executed outside VMX operation.
#GP(0) If executed in VMX root operation with CPL > 0.