--- old/src/hotspot/cpu/x86/vm_version_x86.hpp 2020-07-27 13:16:53.041847799 +0900 +++ new/src/hotspot/cpu/x86/vm_version_x86.hpp 2020-07-27 13:16:52.967846206 +0900 @@ -89,7 +89,8 @@ : 1, osxsave : 1, avx : 1, - : 3; + : 2, + hv : 1; } bits; }; @@ -348,6 +349,7 @@ #define CPU_CLWB ((uint64_t)UCONST64( 0x80000000000)) // clwb instruction #define CPU_AVX512_VBMI2 ((uint64_t)UCONST64(0x100000000000)) // VBMI2 shift left double instructions #define CPU_AVX512_VBMI ((uint64_t)UCONST64(0x200000000000)) // Vector BMI instructions +#define CPU_HV_PRESENT ((uint64_t)UCONST64(0x400000000000)) // for hypervisor detection // NB! When adding new CPU feature detection consider updating vmStructs_x86.hpp, vmStructs_jvmci.hpp, and VM_Version::get_processor_features(). @@ -580,6 +582,8 @@ result |= CPU_AVX512_VBMI2; } } + if (_cpuid_info.std_cpuid1_ecx.bits.hv != 0) + result |= CPU_HV_PRESENT; if (_cpuid_info.sef_cpuid7_ebx.bits.bmi1 != 0) result |= CPU_BMI1; if (_cpuid_info.std_cpuid1_edx.bits.tsc != 0) @@ -871,6 +875,7 @@ static bool supports_avx512_vnni() { return (_features & CPU_AVX512_VNNI) != 0; } static bool supports_avx512_vbmi() { return (_features & CPU_AVX512_VBMI) != 0; } static bool supports_avx512_vbmi2() { return (_features & CPU_AVX512_VBMI2) != 0; } + static bool supports_hv() { return (_features & CPU_HV_PRESENT) != 0; } // Intel features static bool is_intel_family_core() { return is_intel() && @@ -1023,8 +1028,13 @@ // support functions for virtualization detection private: - static void check_virt_cpuid(uint32_t idx, uint32_t *regs); + static void check_virt_cpuid(uint32_t *regs); static void check_virtualizations(); + +#ifdef _WINDOWS + static bool is_in_VM(); +#endif + }; #endif // CPU_X86_VM_VERSION_X86_HPP