From 6fe93375e6767a0126572f8d30e74f56d3de2999 Mon Sep 17 00:00:00 2001 From: Igor Pissolati Date: Mon, 20 Oct 2025 22:26:15 -0300 Subject: [PATCH 1/3] Disable SSE4.x --- src/analyzer/main.cpp | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/analyzer/main.cpp b/src/analyzer/main.cpp index 8e977b8f..baa97b27 100644 --- a/src/analyzer/main.cpp +++ b/src/analyzer/main.cpp @@ -492,8 +492,11 @@ namespace const auto& exe = *win_emu->mod_manager.executable; win_emu->emu().hook_instruction(x86_hookable_instructions::cpuid, [&] { - const auto rip = win_emu->emu().read_instruction_pointer(); - const auto leaf = win_emu->emu().reg(x86_register::eax); + auto& emu = win_emu->emu(); + + const auto rip = emu.read_instruction_pointer(); + const auto leaf = emu.reg(x86_register::eax); + const auto sub = emu.reg(x86_register::ecx); const auto mod = get_module_if_interesting(win_emu->mod_manager, options.modules, rip); if (mod.has_value() && (!concise_logging || context.cpuid_cache.insert({rip, leaf}).second)) @@ -502,6 +505,27 @@ namespace (*mod) ? (*mod)->name.c_str() : ""); } + if (leaf == 1) + { + std::array regs = {0, 0, 0, 0}; + __cpuidex(regs.data(), static_cast(leaf), static_cast(sub)); + uint32_t eax = static_cast(regs[0]); + uint32_t ebx = static_cast(regs[1]); + uint32_t ecx = static_cast(regs[2]); + uint32_t edx = static_cast(regs[3]); + + // Disable SSE4.x + ecx &= ~(1u << 19); // SSE4.1 + ecx &= ~(1u << 20); // SSE4.2 + + emu.reg(x86_register::eax, eax); + emu.reg(x86_register::ebx, ebx); + emu.reg(x86_register::ecx, ecx); + emu.reg(x86_register::edx, edx); + + return instruction_hook_continuation::skip_instruction; + } + return instruction_hook_continuation::run_instruction; }); From 65de67b24fa02c5466702ce6137d258e051283fa Mon Sep 17 00:00:00 2001 From: Igor Pissolati Date: Mon, 20 Oct 2025 22:52:56 -0300 Subject: [PATCH 2/3] Use hard-coded values instead of calling __cpuidex --- src/analyzer/main.cpp | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/analyzer/main.cpp b/src/analyzer/main.cpp index baa97b27..f28eec20 100644 --- a/src/analyzer/main.cpp +++ b/src/analyzer/main.cpp @@ -507,21 +507,11 @@ namespace if (leaf == 1) { - std::array regs = {0, 0, 0, 0}; - __cpuidex(regs.data(), static_cast(leaf), static_cast(sub)); - uint32_t eax = static_cast(regs[0]); - uint32_t ebx = static_cast(regs[1]); - uint32_t ecx = static_cast(regs[2]); - uint32_t edx = static_cast(regs[3]); - - // Disable SSE4.x - ecx &= ~(1u << 19); // SSE4.1 - ecx &= ~(1u << 20); // SSE4.2 - - emu.reg(x86_register::eax, eax); - emu.reg(x86_register::ebx, ebx); - emu.reg(x86_register::ecx, ecx); - emu.reg(x86_register::edx, edx); + // NOTE: We hard-code these values to disable SSE4.x + emu.reg(x86_register::eax, 0x000906EA); + emu.reg(x86_register::ebx, 0x00100800); + emu.reg(x86_register::ecx, 0xFFE2F38F); + emu.reg(x86_register::edx, 0xBFEBFBFF); return instruction_hook_continuation::skip_instruction; } From 1a97f3b2e255232fe5283ae5daeb074b6d3978c9 Mon Sep 17 00:00:00 2001 From: Igor Pissolati Date: Mon, 20 Oct 2025 23:19:24 -0300 Subject: [PATCH 3/3] Fix failed check --- src/analyzer/main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/analyzer/main.cpp b/src/analyzer/main.cpp index f28eec20..27b854ee 100644 --- a/src/analyzer/main.cpp +++ b/src/analyzer/main.cpp @@ -496,7 +496,6 @@ namespace const auto rip = emu.read_instruction_pointer(); const auto leaf = emu.reg(x86_register::eax); - const auto sub = emu.reg(x86_register::ecx); const auto mod = get_module_if_interesting(win_emu->mod_manager, options.modules, rip); if (mod.has_value() && (!concise_logging || context.cpuid_cache.insert({rip, leaf}).second))