You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// if running under Hyper-V (doesnt matter the VTL/partition level), this value is hardcoded and intercepted/emulated at kernel level
3844
+
// if running under Hyper-V in AMD64 (doesnt matter the VTL/partition level), this value is hardcoded and intercepted/emulated at kernel level
3850
3845
// specifically at KiPreprocessFault -> KiOpDecode -> KiOpLocateDecodeEntry (KiOp_SLDTSTRSMSW)
3851
3846
// this is intercepted by the kernel before handling execution to the hypervisor, so it's a decent safeguard against basic cpuid spoofing
3852
3847
if (idt_base == 0xfffff80000001000) {
@@ -3858,6 +3853,11 @@ struct VM {
3858
3853
debug("HYPER-X: Detected hypervisor trying to spoof itself as Hyper-V");
3859
3854
state = HYPERV_UNKNOWN; // doing this is enough to trigger a VM detection, we dont need to mark a 100% vm score as our techniques will do the job for us
3860
3855
}
3856
+
#else
3857
+
debug("HYPER-X: Detected Hyper-V host machine");
3858
+
core::add(brand_enum::HYPERV_ROOT);
3859
+
state = HYPERV_ARTIFACT_VM;
3860
+
#endif
3861
3861
}
3862
3862
}
3863
3863
@@ -5020,10 +5020,17 @@ struct VM {
5020
5020
#else
5021
5021
auto is_smt_enabled = []() noexcept -> bool {
5022
5022
auto popcount = [](uint64_t v) noexcept -> int {
5023
-
#if (GCC || CLANG)
5023
+
#if (GCC) || (CLANG)
5024
5024
return __builtin_popcountll(v);
5025
5025
#elif (MSVC)
5026
+
#if (x86_32)
5027
+
return static_cast<int>(
5028
+
__popcnt(static_cast<unsigned int>(v)) +
5029
+
__popcnt(static_cast<unsigned int>(v >> 32))
5030
+
);
5031
+
#else
5026
5032
return static_cast<int>(__popcnt64(static_cast<unsigned long long>(v)));
5033
+
#endif
5027
5034
#else
5028
5035
int c = 0;
5029
5036
while (v) { c += static_cast<int>(v & 1ull); v >>= 1; }
0 commit comments