diff options
Diffstat (limited to 'Source/Core/Common/ArmCPUDetect.cpp')
| -rw-r--r-- | Source/Core/Common/ArmCPUDetect.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
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 <asm/hwcap.h> #include <cstring> #include <fstream> #include <sstream> #include <string> +#include <thread> + +#ifndef _WIN32 +#include <asm/hwcap.h> #include <sys/auxv.h> #include <unistd.h> +#endif #include <fmt/format.h> @@ -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 |
