summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Wunkolo2022-03-09 19:34:39 -0800
committerGravatar Wunkolo2022-03-09 19:50:01 -0800
commitd9b1199ffb7670248a02acce7e8216f5a577de38 (patch)
tree34f21eea962c4ac36722c81558b08b65184dfebd
parentMerge pull request #7936 from Wunkolo/cpu_detect (diff)
downloadyuzu-d9b1199ffb7670248a02acce7e8216f5a577de38.tar.gz
yuzu-d9b1199ffb7670248a02acce7e8216f5a577de38.tar.xz
yuzu-d9b1199ffb7670248a02acce7e8216f5a577de38.zip
cpu_detect: Revert `__cpuid{ex}` array-type argument
Restores compatibility with MSVC's `__cpuid` intrinsic.
-rw-r--r--src/common/x64/cpu_detect.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/common/x64/cpu_detect.cpp b/src/common/x64/cpu_detect.cpp
index a95dc15a3..99d87f586 100644
--- a/src/common/x64/cpu_detect.cpp
+++ b/src/common/x64/cpu_detect.cpp
@@ -21,7 +21,7 @@
21// clang-format on 21// clang-format on
22#endif 22#endif
23 23
24static inline void __cpuidex(const std::span<u32, 4> info, u32 function_id, u32 subfunction_id) { 24static inline void __cpuidex(int info[4], u32 function_id, u32 subfunction_id) {
25#if defined(__DragonFly__) || defined(__FreeBSD__) 25#if defined(__DragonFly__) || defined(__FreeBSD__)
26 // Despite the name, this is just do_cpuid() with ECX as second input. 26 // Despite the name, this is just do_cpuid() with ECX as second input.
27 cpuid_count((u_int)function_id, (u_int)subfunction_id, (u_int*)info); 27 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
34#endif 34#endif
35} 35}
36 36
37static inline void __cpuid(const std::span<u32, 4> info, u32 function_id) { 37static inline void __cpuid(int info[4], u32 function_id) {
38 return __cpuidex(info, function_id, 0); 38 return __cpuidex(info, function_id, 0);
39} 39}
40 40
@@ -67,7 +67,7 @@ static CPUCaps Detect() {
67 // Assumes the CPU supports the CPUID instruction. Those that don't would likely not support 67 // Assumes the CPU supports the CPUID instruction. Those that don't would likely not support
68 // yuzu at all anyway 68 // yuzu at all anyway
69 69
70 std::array<u32, 4> cpu_id; 70 int cpu_id[4];
71 71
72 // Detect CPU's CPUID capabilities and grab manufacturer string 72 // Detect CPU's CPUID capabilities and grab manufacturer string
73 __cpuid(cpu_id, 0x00000000); 73 __cpuid(cpu_id, 0x00000000);
@@ -128,11 +128,11 @@ static CPUCaps Detect() {
128 if (max_ex_fn >= 0x80000004) { 128 if (max_ex_fn >= 0x80000004) {
129 // Extract CPU model string 129 // Extract CPU model string
130 __cpuid(cpu_id, 0x80000002); 130 __cpuid(cpu_id, 0x80000002);
131 std::memcpy(caps.cpu_string, cpu_id.data(), sizeof(cpu_id)); 131 std::memcpy(caps.cpu_string, cpu_id, sizeof(cpu_id));
132 __cpuid(cpu_id, 0x80000003); 132 __cpuid(cpu_id, 0x80000003);
133 std::memcpy(caps.cpu_string + 16, cpu_id.data(), sizeof(cpu_id)); 133 std::memcpy(caps.cpu_string + 16, cpu_id, sizeof(cpu_id));
134 __cpuid(cpu_id, 0x80000004); 134 __cpuid(cpu_id, 0x80000004);
135 std::memcpy(caps.cpu_string + 32, cpu_id.data(), sizeof(cpu_id)); 135 std::memcpy(caps.cpu_string + 32, cpu_id, sizeof(cpu_id));
136 } 136 }
137 137
138 if (max_ex_fn >= 0x80000001) { 138 if (max_ex_fn >= 0x80000001) {