From d744c5a148f5a477b41b63bceac0558a498ef989 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Tue, 26 Nov 2019 15:31:45 +1100 Subject: Compile fixes for Windows-on-ARM64 --- Source/Core/Common/ArmCPUDetect.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'Source/Core/Common/ArmCPUDetect.cpp') diff --git a/Source/Core/Common/ArmCPUDetect.cpp b/Source/Core/Common/ArmCPUDetect.cpp index 7ad619581c..53026bf5d2 100644 --- a/Source/Core/Common/ArmCPUDetect.cpp +++ b/Source/Core/Common/ArmCPUDetect.cpp @@ -2,13 +2,17 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. -#include #include #include #include #include +#include + +#ifndef _WIN32 +#include #include #include +#endif #include @@ -16,6 +20,8 @@ #include "Common/CommonTypes.h" #include "Common/FileUtil.h" +#ifndef WIN32 + const char procfile[] = "/proc/cpuinfo"; static std::string GetCPUString() @@ -42,6 +48,8 @@ static std::string GetCPUString() return cpu_string; } +#endif + CPUInfo cpu_info; CPUInfo::CPUInfo() @@ -60,6 +68,21 @@ void CPUInfo::Detect() Mode64bit = true; vendor = CPUVendor::ARM; +#ifdef _WIN32 + num_cores = std::thread::hardware_concurrency(); + + // Windows does not provide any mechanism for querying the system registers on ARMv8, unlike Linux + // which traps the register reads and emulates them in the kernel. There are environment variables + // containing some of the CPU-specific values, which we could use for a lookup table in the + // future. For now, assume all features are present as all known devices which are Windows-on-ARM + // compatible also support these extensions. + bFP = true; + bASIMD = true; + bAES = true; + bCRC32 = true; + bSHA1 = true; + bSHA2 = true; +#else // Get the information about the CPU num_cores = sysconf(_SC_NPROCESSORS_CONF); strncpy(cpu_string, GetCPUString().c_str(), sizeof(cpu_string)); @@ -71,6 +94,7 @@ void CPUInfo::Detect() bCRC32 = hwcaps & HWCAP_CRC32; bSHA1 = hwcaps & HWCAP_SHA1; bSHA2 = hwcaps & HWCAP_SHA2; +#endif } // Turn the CPU info into a string we can show -- cgit v1.2.3