Skip to content

Commit 3dc1565

Browse files
committed
change to Hyper-X
1 parent d2d6216 commit 3dc1565

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

src/vmaware.hpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,19 +1678,23 @@ struct VM {
16781678
return result;
16791679
};
16801680

1681-
// char out[sizeof(int32_t) * 4 + 1] = { 0 }; // e*x size + number of e*x registers + null terminator
1682-
// cpu::cpuid((int*)out, cpu::leaf::hypervisor);
1683-
//
1684-
// const u32 eax = static_cast<u32>(out[0]);
1685-
//
1686-
// core_debug("HYPER_X: eax = ", eax);
1681+
char out[sizeof(int32_t) * 4 + 1] = { 0 }; // e*x size + number of e*x registers + null terminator
1682+
cpu::cpuid((int*)out, cpu::leaf::hypervisor);
1683+
1684+
const u32 eax = static_cast<u32>(out[0]);
1685+
1686+
core_debug("HYPER_X: eax = ", eax);
1687+
1688+
const bool is_eax_valid = ((eax == 11) || (eax == 12));
16871689

16881690
const std::array<std::string, 2> cpu = cpu::cpu_manufacturer(cpu::leaf::hypervisor);
16891691

1690-
if (
1692+
const bool is_cpu_hyperv = (
16911693
(cpu.at(0) == "Microsoft Hv") ||
16921694
(cpu.at(1) == "Microsoft Hv")
1693-
) {
1695+
);
1696+
1697+
if (is_eax_valid || is_cpu_hyperv) {
16941698
// SMBIOS check
16951699
const std::string smbios = SMBIOS_string();
16961700

0 commit comments

Comments
 (0)