summaryrefslogtreecommitdiff
path: root/src/common/x64/cpu_detect.h
diff options
context:
space:
mode:
authorGravatar Wunkolo2022-02-23 19:41:27 -0800
committerGravatar Wunkolo2022-03-09 13:57:47 -0800
commitec5f3351b69b6427d1e411fcc849e98705a044c3 (patch)
treec137667f61e31588ef1b07298a7e2c8a0d1a49be /src/common/x64/cpu_detect.h
parentcpu_detect: Update array-types to `span` and `array` (diff)
downloadyuzu-ec5f3351b69b6427d1e411fcc849e98705a044c3.tar.gz
yuzu-ec5f3351b69b6427d1e411fcc849e98705a044c3.tar.xz
yuzu-ec5f3351b69b6427d1e411fcc849e98705a044c3.zip
cpu_detect: Refactor cpu/manufacturer identification
Set the zero-enum value to Unknown Move the Manufacterer enum into the CPUCaps structure namespace Add "ParseManufacturer" utility-function Fix cpu/brand string buffer sizes(!)
Diffstat (limited to '')
-rw-r--r--src/common/x64/cpu_detect.h25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/common/x64/cpu_detect.h b/src/common/x64/cpu_detect.h
index e4f90bee1..3e6d808f3 100644
--- a/src/common/x64/cpu_detect.h
+++ b/src/common/x64/cpu_detect.h
@@ -3,25 +3,32 @@
3 3
4#pragma once 4#pragma once
5 5
6#include <string_view>
6#include "common/common_types.h" 7#include "common/common_types.h"
7 8
8namespace Common { 9namespace Common {
9 10
10enum class Manufacturer : u8 {
11 Intel = 0,
12 AMD = 1,
13 Hygon = 2,
14 Unknown = 3,
15};
16
17/// x86/x64 CPU capabilities that may be detected by this module 11/// x86/x64 CPU capabilities that may be detected by this module
18struct CPUCaps { 12struct CPUCaps {
13
14 enum class Manufacturer : u8 {
15 Unknown = 0,
16 Intel = 1,
17 AMD = 2,
18 Hygon = 3,
19 };
20
21 static Manufacturer ParseManufacturer(std::string_view brand_string);
22
19 Manufacturer manufacturer; 23 Manufacturer manufacturer;
20 char cpu_string[0x21]; 24 char brand_string[13];
21 char brand_string[0x41]; 25
26 char cpu_string[48];
27
22 u32 base_frequency; 28 u32 base_frequency;
23 u32 max_frequency; 29 u32 max_frequency;
24 u32 bus_frequency; 30 u32 bus_frequency;
31
25 bool sse : 1; 32 bool sse : 1;
26 bool sse2 : 1; 33 bool sse2 : 1;
27 bool sse3 : 1; 34 bool sse3 : 1;