VMLAUNCH/VMRESUME

Launch/Resume Virtual Machine

Opcodes

Hex Mnemonic Encoding Long Mode Legacy Mode Description
0F 01 C3 VMRESUME None None None Resume virtual machine managed by current VMCS.
0F 01 C2 VMLAUNCH None None None Launch virtual machine managed by current VMCS.

Description

Effects a VM entry managed by the current VMCS.

If VM entry is attempted, the logical processor performs a series of consistency checks as detailed in Chapter 23, "VM Entries," in theIntel® 64 and IA-32 Architectures Software Developer's Manual, Volume 3B. Failure to pass checks on the VMX controls or on the host-state area passes control to the instruction following the VMLAUNCH or VMRESUME instruction. If these pass but checks on the guest-state area fail, the logical processor loads state from the host-state area of the VMCS, passing control to the instruction referenced by the RIP field in the host-state area.

VM entry is not allowed when events are blocked by MOV SS or POP SS. Neither VMLAUNCH nor VMRESUME should be used immediately after either MOV to SS or POP to SS.

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 current-VMCS pointer is not valid
				VMfailInvalid;
			ELSE
				IF events are being blocked by MOV SS
					VMfailValid(VM entry with events blocked by MOV SS);
				ELSE
					IF (VMLAUNCH and launch state of current VMCS is not "clear")
						VMfailValid(VMLAUNCH with non-clear VMCS);
					ELSE
						IF (VMRESUME and launch state of current VMCS is not "launched")
							VMfailValid(VMRESUME with non-launched VMCS);
						ELSE
							Check settings of VMX controls and host-state area;
							IF invalid settings
								VMfailValid(VM entry with invalid VMX-control field(s)) or VMfailValid(VM entry with invalid host-state field(s)) or VMfailValid(VM entry with invalid executive-VMCS pointer)) or VMfailValid(VM entry with non-launched executive VMCS) or VMfailValid(VM entry with executive-VMCS pointer not VMXON pointer) or VMfailValid(VM entry with invalid VM-execution control fields in executive VMCS) as appropriate;
							ELSE
								Attempt to load guest state and PDPTRs as appropriate;
								clear address-range monitoring;
								IF failure in checking guest state or PDPTRs
									VM entry fails (see Section 22.7, in the
									Intel® 64 and IA-32 Architectures Software Developer's Manual, Volume 3B
									);
								ELSE
									Attempt to load MSRs from VM-entry MSR-load area;
									IF failure
										VM entry fails; (* see Section 22.7, in the Intel® 64 and IA-32 Architectures Software Developer's Manual, Volume 3B *)
									ELSE
										IF VMLAUNCH
											launch state of VMCS = "launched";
										FI;
										IF in SMM and "entry to SMM" VM-entry control is 0
											IF "deactivate dual-monitor treatment" VM-entry control is 0
												SMM-transfer VMCS pointer = current-VMCS pointer;
											FI;
											IF executive-VMCS pointer is VMX pointer
												current-VMCS pointer = VMCS-link pointer;
											ELSE
												current-VMCS pointer = executive-VMCS pointer;
											FI;
											leave SMM;
										FI;
										VM entry succeeds;
									FI;
								FI;
							FI;
						FI;
					FI;
				FI;
			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 the current privilege level is not 0.

Compatibility Mode Exceptions

Exception Description
#UD The VMLAUNCH and VMRESUME instructions are not recognized in compatibility mode.

Virtual-8086 Mode Exceptions

Exception Description
#UD The VMLAUNCH and VMRESUME instructions are 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 VMLAUNCH and VMRESUME instructions are 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.