EHS
Loading...
Searching...
No Matches
CPU.h
Go to the documentation of this file.
1#pragma once
2
3#include "ehs/Types.h"
4#include "Architecture.h"
5#include "OS.h"
6#include "ehs/Str.h"
7#include "ehs/Array.h"
8
9namespace ehs
10{
19
20 enum class Endianness : UInt_8
21 {
24 };
25
26 struct TSC
27 {
31 };
32
33 class EHS_LIB_IO CPU
34 {
35 private:
36 #ifdef EHS_OS_LINUX
37 static UInt_64 TSC_Freq;
38 #endif
39
40 public:
42
43 static UInt_8 PointerSize();
44
46
47 static void RDTSCP(TSC* tsc);
48
49 static UInt_64 GetTSC_Freq();
50
51 static UInt_64 GetTSC();
52
55 static void GetManufacturer(Char_8* input);
56
57 static UInt_32 GetInfoBits();
58
59 static UInt_8 GetSteppingId();
60
61 static UInt_8 GetModelId();
62
63 static UInt_8 GetFamilyId();
64
66
67 static UInt_8 GetExtModelId();
68
69 static UInt_8 GetExtFamilyId();
70
72
73 static bool HasFPU();
74
75 static bool HasVME();
76
77 static bool HasDE();
78
79 static bool HasPSE();
80
81 static bool HasTSC();
82
83 static bool HasMSR();
84
85 static bool HasPAE();
86
87 static bool HasMCE();
88
89 static bool HasCX8();
90
91 static bool HasAPIC();
92
93 static bool HasSEP();
94
95 static bool HasMTRR();
96
97 static bool HasPGE();
98
99 static bool HasMCA();
100
101 static bool HasCMOV();
102
103 static bool HasPAT();
104
105 static bool HasPSE_36();
106
107 static bool HasPSN();
108
109 static bool HasCLFSH();
110
111 static bool HasDS();
112
113 static bool HasACPI();
114
115 static bool HasMMX();
116
117 static bool HasFXSR();
118
119 static bool HasSSE();
120
121 static bool HasSSE2();
122
123 static bool HasSS();
124
125 static bool HasHTT();
126
127 static bool HasTM();
128
129 static bool HasIA64();
130
131 static bool HasPBE();
132
133 static UInt_32 GetFeatureBits_2();
134
135 static bool HasSSE3();
136
137 static bool HasPCLMULQDQ();
138
139 static bool HasDTES64();
140
141 static bool HasMONITOR();
142
143 static bool HasDS_CPL();
144
145 static bool HasVMX();
146
147 static bool HasSMX();
148
149 static bool HasEST();
150
151 static bool HasTM2();
152
153 static bool HasSSSE3();
154
155 static bool HasCNXT_ID();
156
157 static bool HasSDBG();
158
159 static bool HasFMA();
160
161 static bool HasCX16();
162
163 static bool HasXTPR();
164
165 static bool HasPDCM();
166
167 static bool HasPCID();
168
169 static bool HasDCA();
170
171 static bool HasSSE4_1();
172
173 static bool HasSSE4_2();
174
175 static bool HasX2APIC();
176
177 static bool HasMOVBE();
178
179 static bool HasPOPCNT();
180
181 static bool HasTSC_DEADLINE();
182
183 static bool HasAES();
184
185 static bool HasXSAVE();
186
187 static bool HasOSXSAVE();
188
189 static bool HasAVX();
190
191 static bool HasF16C();
192
193 static bool HasRDRND();
194
195 static bool HasHYPERVISOR();
196
198
199 static bool HasAVX2();
200
201 static bool HasRDSEED();
202
203 static bool HasADX();
204
206
208
211 static void GetBrand(Char_8* input);
212
213 static UInt_8 GetCacheLineSize();
214
215 //static Str_8 ToStr();
216
217 private:
218 static UInt_64 RetrieveTSC_Freq();
219
220 static UInt_64 CalculateTSC_Freq();
221 };
222}
Definition CPU.h:34
static bool HasPOPCNT()
Definition CPU.cpp:382
static bool HasSMX()
Definition CPU.cpp:302
static bool HasTM()
Definition CPU.cpp:257
static bool HasMMX()
Definition CPU.cpp:227
static bool HasPCLMULQDQ()
Definition CPU.cpp:277
static UInt_8 GetFamilyId()
Definition CPU.cpp:102
static UInt_8 GetModelId()
Definition CPU.cpp:97
static UInt_32 GetExtFeatureBits_2()
Definition CPU_ARM64.cpp:33
static bool HasSSE3()
Definition CPU.cpp:272
static bool HasCX8()
Definition CPU.cpp:162
static bool HasPSN()
Definition CPU.cpp:207
static UInt_64 GetTSC()
Definition CPU.cpp:61
static bool HasOSXSAVE()
Definition CPU.cpp:402
static bool HasTM2()
Definition CPU.cpp:312
static void GetManufacturer(Char_8 *input)
Definition CPU_ARM64.cpp:9
static bool HasPSE_36()
Definition CPU.cpp:202
static bool HasCX16()
Definition CPU.cpp:337
static bool HasDE()
Definition CPU.cpp:132
static bool HasRDSEED()
Definition CPU.cpp:432
static bool HasFPU()
Definition CPU.cpp:122
static UInt_32 GetFeatureBits_2()
Definition CPU_ARM64.cpp:23
static Endianness GetEndianness()
Definition CPU.cpp:29
static UInt_32 GetFeatureBits_1()
Definition CPU_ARM64.cpp:18
static bool HasMSR()
Definition CPU.cpp:147
static bool HasSSE4_2()
Definition CPU.cpp:367
static bool HasPDCM()
Definition CPU.cpp:347
static bool HasPAT()
Definition CPU.cpp:197
static bool HasFXSR()
Definition CPU.cpp:232
static bool HasHYPERVISOR()
Definition CPU.cpp:422
static UInt_8 GetCacheLineSize()
Definition CPU_ARM64.cpp:47
static bool HasXTPR()
Definition CPU.cpp:342
static bool HasDCA()
Definition CPU.cpp:357
static bool HasHTT()
Definition CPU.cpp:252
static bool HasADX()
Definition CPU.cpp:437
static UInt_8 GetExtModelId()
Definition CPU.cpp:112
static bool HasPSE()
Definition CPU.cpp:137
static UInt_8 PointerSize()
Definition CPU.cpp:24
static bool HasAPIC()
Definition CPU.cpp:167
static bool HasIA64()
Definition CPU.cpp:262
static bool HasRDRND()
Definition CPU.cpp:417
static bool HasSEP()
Definition CPU.cpp:172
static bool HasMOVBE()
Definition CPU.cpp:377
static bool HasCMOV()
Definition CPU.cpp:192
static Architecture GetArchitecture()
Definition CPU.cpp:13
static UInt_8 GetExtFamilyId()
Definition CPU.cpp:117
static UInt_32 GetExtFeatureBits_3()
Definition CPU_ARM64.cpp:38
static bool HasSSE4_1()
Definition CPU.cpp:362
static UInt_64 GetTSC_Freq()
Definition CPU.cpp:44
static bool HasCNXT_ID()
Definition CPU.cpp:322
static bool HasACPI()
Definition CPU.cpp:222
static bool HasMTRR()
Definition CPU.cpp:177
static bool HasAVX()
Definition CPU.cpp:407
static bool HasSDBG()
Definition CPU.cpp:327
static UInt_32 GetInfoBits()
Definition CPU_ARM64.cpp:13
static bool HasXSAVE()
Definition CPU.cpp:397
static bool HasSS()
Definition CPU.cpp:247
static UInt_8 GetProcessorTypeId()
Definition CPU.cpp:107
static bool HasMCA()
Definition CPU.cpp:187
static bool HasAVX2()
Definition CPU.cpp:427
static void GetBrand(Char_8 *input)
Definition CPU_ARM64.cpp:43
static bool HasAES()
Definition CPU.cpp:392
static UInt_32 GetExtFeatureBits_1()
Definition CPU_ARM64.cpp:28
static bool HasPAE()
Definition CPU.cpp:152
static void RDTSCP(TSC *tsc)
Definition CPU_ARM64.cpp:5
static bool HasPCID()
Definition CPU.cpp:352
static bool HasPBE()
Definition CPU.cpp:267
static bool HasDTES64()
Definition CPU.cpp:282
static bool HasVMX()
Definition CPU.cpp:297
static bool HasTSC()
Definition CPU.cpp:142
static bool HasMCE()
Definition CPU.cpp:157
static bool HasSSE2()
Definition CPU.cpp:242
static bool HasFMA()
Definition CPU.cpp:332
static UInt_8 GetSteppingId()
Definition CPU.cpp:92
static bool HasTSC_DEADLINE()
Definition CPU.cpp:387
static bool HasDS()
Definition CPU.cpp:217
static bool HasEST()
Definition CPU.cpp:307
static bool HasF16C()
Definition CPU.cpp:412
static bool HasDS_CPL()
Definition CPU.cpp:292
static bool HasX2APIC()
Definition CPU.cpp:372
static bool HasSSE()
Definition CPU.cpp:237
static bool HasMONITOR()
Definition CPU.cpp:287
static bool HasCLFSH()
Definition CPU.cpp:212
static bool HasSSSE3()
Definition CPU.cpp:317
static bool HasPGE()
Definition CPU.cpp:182
static bool HasVME()
Definition CPU.cpp:127
Definition Anchor.h:6
Endianness
Definition CPU.h:21
@ LE
Definition CPU.h:22
@ BE
Definition CPU.h:23
Architecture
Definition CPU.h:12
@ ARM
Definition CPU.h:16
@ UNKNOWN
Definition CPU.h:17
@ ARM64
Definition CPU.h:15
@ X64
Definition CPU.h:13
@ X86
Definition CPU.h:14
unsigned int UInt_32
Definition Types.h:49
char Char_8
Definition Types.h:40
unsigned char UInt_8
Definition Types.h:43
Definition CPU.h:27
UInt_32 lowCount
Definition CPU.h:30
UInt_32 coreId
Definition CPU.h:28
UInt_32 highCount
Definition CPU.h:29