mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Compile fixes for Windows-on-ARM64
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user