yuzu-emu
/
yuzu
Archived
1
0
Fork 0

Merge pull request #7998 from Wunkolo/cpuid_array

cpu_detect: Revert `__cpuid{ex}` array-type argument
This commit is contained in:
Morph 2022-03-10 00:09:36 -05:00 committed by GitHub
commit 52f8f00434
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -21,7 +21,7 @@
// clang-format on // clang-format on
#endif #endif
static inline void __cpuidex(const std::span<u32, 4> info, u32 function_id, u32 subfunction_id) { static inline void __cpuidex(int info[4], u32 function_id, u32 subfunction_id) {
#if defined(__DragonFly__) || defined(__FreeBSD__) #if defined(__DragonFly__) || defined(__FreeBSD__)
// Despite the name, this is just do_cpuid() with ECX as second input. // Despite the name, this is just do_cpuid() with ECX as second input.
cpuid_count((u_int)function_id, (u_int)subfunction_id, (u_int*)info); cpuid_count((u_int)function_id, (u_int)subfunction_id, (u_int*)info);
@ -34,7 +34,7 @@ static inline void __cpuidex(const std::span<u32, 4> info, u32 function_id, u32
#endif #endif
} }
static inline void __cpuid(const std::span<u32, 4> info, u32 function_id) { static inline void __cpuid(int info[4], u32 function_id) {
return __cpuidex(info, function_id, 0); return __cpuidex(info, function_id, 0);
} }
@ -67,7 +67,7 @@ static CPUCaps Detect() {
// Assumes the CPU supports the CPUID instruction. Those that don't would likely not support // Assumes the CPU supports the CPUID instruction. Those that don't would likely not support
// yuzu at all anyway // yuzu at all anyway
std::array<u32, 4> cpu_id; int cpu_id[4];
// Detect CPU's CPUID capabilities and grab manufacturer string // Detect CPU's CPUID capabilities and grab manufacturer string
__cpuid(cpu_id, 0x00000000); __cpuid(cpu_id, 0x00000000);
@ -128,11 +128,11 @@ static CPUCaps Detect() {
if (max_ex_fn >= 0x80000004) { if (max_ex_fn >= 0x80000004) {
// Extract CPU model string // Extract CPU model string
__cpuid(cpu_id, 0x80000002); __cpuid(cpu_id, 0x80000002);
std::memcpy(caps.cpu_string, cpu_id.data(), sizeof(cpu_id)); std::memcpy(caps.cpu_string, cpu_id, sizeof(cpu_id));
__cpuid(cpu_id, 0x80000003); __cpuid(cpu_id, 0x80000003);
std::memcpy(caps.cpu_string + 16, cpu_id.data(), sizeof(cpu_id)); std::memcpy(caps.cpu_string + 16, cpu_id, sizeof(cpu_id));
__cpuid(cpu_id, 0x80000004); __cpuid(cpu_id, 0x80000004);
std::memcpy(caps.cpu_string + 32, cpu_id.data(), sizeof(cpu_id)); std::memcpy(caps.cpu_string + 32, cpu_id, sizeof(cpu_id));
} }
if (max_ex_fn >= 0x80000001) { if (max_ex_fn >= 0x80000001) {