From 46d663cdcb3648130cd8c3341f3f30225070b661 Mon Sep 17 00:00:00 2001 From: offtkp Date: Tue, 17 Sep 2024 05:06:32 +0300 Subject: [PATCH] Use different processor values --- src/core/cpu_patches.cpp | 2 -- src/core/signals.cpp | 26 +++++++++++++++++++++----- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/core/cpu_patches.cpp b/src/core/cpu_patches.cpp index ced7aaa09..d86a1d93e 100644 --- a/src/core/cpu_patches.cpp +++ b/src/core/cpu_patches.cpp @@ -827,8 +827,6 @@ void PatchCPUID(u64 segment_addr, u64 segment_size) { continue; } - LOG_CRITICAL(Core, "FOUND CPUID INSTRUCTION AT: {}", fmt::ptr(code)); - // Replace any potential prefixes and the 0F byte with single byte NOPs u8 instruction_length = instruction.length; for (u8 i = 0; i < instruction_length - 1; i++) { diff --git a/src/core/signals.cpp b/src/core/signals.cpp index 39952afa1..87eafd3bd 100644 --- a/src/core/signals.cpp +++ b/src/core/signals.cpp @@ -18,18 +18,24 @@ #endif // CPUID constants from http://instlatx64.atw.hu/ -// There wasn't dumps for the PS4 itself, we used a Jaguar CPU: AMD A9-9820 +// There aren't dumps for the PS4 itself, these are from a 7600x // Optimally at some point we should dump the PS4 CPUID values // For EAX=0 / EAX=0x80000000 -constexpr static u32 maxCpuid = 0xD; +constexpr static u32 maxCpuid = 0x10; constexpr static const char* vendorId = "AuthenticAMD"; // For EAX=1 -constexpr static u32 processorFamilyIDs = 0x00720F61; -constexpr static u32 additionalInfo = 0x00080800; -constexpr static u32 featureInfoEcx = 0x3ED8220B; +constexpr static u32 processorFamilyIDs = 0x00A60F12; +constexpr static u32 additionalInfo = 0x000C0800; +constexpr static u32 featureInfoEcx = 0x7EF8320B; constexpr static u32 featureInfoEdx = 0x178BFBFF; +// For EAX=0x80000001 +constexpr static u32 extendedFeatureInfoEax = 0x00A60F12; +constexpr static u32 extendedFeatureInfoEbx = 0x00000000; +constexpr static u32 extendedFeatureInfoEcx = 0x75C237FF; +constexpr static u32 extendedFeatureInfoEdx = 0x2FD3FBFF; + namespace Core { #if defined(_WIN32) @@ -58,6 +64,11 @@ static LONG WINAPI SignalHandler(EXCEPTION_POINTERS* pExp) noexcept { results[1] = additionalInfo; results[2] = featureInfoEcx; results[3] = featureInfoEdx; + } else if (rax == 0x80000001) { + results[0] = extendedFeatureInfoEax; + results[1] = extendedFeatureInfoEbx; + results[2] = extendedFeatureInfoEcx; + results[3] = extendedFeatureInfoEdx; } else { __cpuidex(reinterpret_cast(results), static_cast(rax), static_cast(rcx)); @@ -162,6 +173,11 @@ static void SignalHandler(int sig, siginfo_t* info, void* raw_context) { results[1] = additionalInfo; results[2] = featureInfoEcx; results[3] = featureInfoEdx; + } else if (rax == 0x80000001) { + results[0] = extendedFeatureInfoEax; + results[1] = extendedFeatureInfoEbx; + results[2] = extendedFeatureInfoEcx; + results[3] = extendedFeatureInfoEdx; } else { __cpuid_count(rax, rcx, results[0], results[1], results[2], results[3]); if (rax == 0 || rax == 0x80000000) {