We recommend using Visual Studio 2017



The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at __vmx_vmclear.

Microsoft Specific**

Initializes the specified virtual machine control structure (VMCS) and sets its launch state to Clear.

unsigned char __vmx_vmclear(  
   unsigned __int64 *VmcsPhysicalAddress  


[in] VmcsPhysicalAddressA pointer to a 64-bit memory location that contains the physical address of the VMCS to clear.
0The operation succeeded.
1The operation failed with extended status available in the VM-instruction error field of the current VMCS.
2The operation failed without status available.

An application can perform a VM-enter operation by using either the __vmx_vmlaunch or __vmx_vmresume function. The __vmx_vmlaunch function can be used only with a VMCS whose launch state is Clear, and the __vmx_vmresume function can be used only with a VMCS whose launch state is Launched. Consequently, use the __vmx_vmclear function to set the launch state of a VMCS to Clear. Use the __vmx_vmlaunch function for your first VM-enter operation and the __vmx_vmresume function for subsequent VM-enter operations.

The __vmx_vmclear function is equivalent to the VMCLEAR machine instruction. This function supports the interaction of a host's virtual machine monitor with a guest operating system and its applications. For more information, search for the document, "Intel Virtualization Technical Specification for the IA-32 Intel Architecture," document number C97063-002, at the Intel Corporation site.


Header file <intrin.h>

Compiler Intrinsics