Determining If Hypervisor Is Installed

Before it uses any hypervisor interface functions, software should first determine whether it runs within a virtualized environment. On x64 platforms, software verifies that it runs within a virtualized environment by executing the CPUID instruction with an input (EAX register) value of 1. When the CPUID instruction is executed, code should check bit 31 of register ECX. Bit 31 is the hypervisor-present bit. If the hypervisor-present bit is set, the hypervisor is present. In a non-virtualized environment, the hypervisor-present bit is clear. The HV_CPUID_RESULT union encodes the result for this CPUID instruction.

If the hypervisor-present bit is set, software can query additional CPUID leaves for more information about the hypervisor and the hypervisor's capabilities. The 0x40000000 and 0x40000001 leaves are guaranteed to be available. Subsequently-numbered leaves might also be available.

 

 

Send comments about this topic to Microsoft

Build date: 11/16/2013

Show:
© 2014 Microsoft. All rights reserved.