-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
cpu
497 lines (419 loc) · 27.9 KB
/
cpu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
/*
Copyright (C) 2018-2024 Geoffrey Daniels. https://gpdaniels.com/
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License only.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#ifndef GTL_PLATFORM_CPU_HPP
#define GTL_PLATFORM_CPU_HPP
// Summary: Class to extract cpuid information to determine supported instructions at runtime.
#define GTL_PLATFORM_CPU_X86 0
#define GTL_PLATFORM_CPU_X64 0
#if (defined(i386) || defined(__i386) || defined(__i386__) || defined(__i386__) || defined(_M_IX86))
#undef GTL_PLATFORM_CPU_X86
#define GTL_PLATFORM_CPU_X86 1
#endif
#if (defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64))
#undef GTL_PLATFORM_CPU_X64
#define GTL_PLATFORM_CPU_X64 1
#endif
#if (GTL_PLATFORM_CPU_X86 || GTL_PLATFORM_CPU_X64)
# if defined(_MSC_VER)
# include <intrin.h>
# else
# include <cpuid.h>
# endif
#endif
namespace gtl {
/// @brief The cpu class extracts information about the current cpu.
class cpu final {
public:
constexpr static const unsigned int leaf_vendor_id = 0x00000000u;
constexpr static const unsigned int leaf_feature_bits = 0x00000001u;
constexpr static const unsigned int leaf_cache_and_tlb = 0x00000002u;
constexpr static const unsigned int leaf_serial_number = 0x00000003u;
constexpr static const unsigned int leaf_thread_core_and_cache = 0x00000004u;
constexpr static const unsigned int leaf_extended_feature_bits = 0x00000007u;
constexpr static const unsigned int extended_leaf_highest_function = 0x80000000u;
constexpr static const unsigned int extended_leaf_feature_bits = 0x80000001u;
constexpr static const unsigned int extended_leaf_brand_string_0 = 0x80000002u;
constexpr static const unsigned int extended_leaf_brand_string_1 = 0x80000003u;
constexpr static const unsigned int extended_leaf_brand_string_2 = 0x80000004u;
constexpr static const unsigned int extended_leaf_l1_cache_and_tlb = 0x80000005u;
constexpr static const unsigned int extended_leaf_l2_cache = 0x80000005u;
constexpr static const unsigned int extended_leaf_power_management = 0x80000007u;
constexpr static const unsigned int extended_leaf_raw_size = 0x80000008u;
private:
struct cpuid_registers final {
public:
enum class index : unsigned int {
eax = 0,
ebx = 1,
ecx = 2,
edx = 3
};
private:
unsigned int registers[4] = {};
public:
unsigned int& operator[](index register_index) {
return this->registers[static_cast<unsigned int>(register_index)];
}
const unsigned int& operator[](index register_index) const {
return this->registers[static_cast<unsigned int>(register_index)];
}
};
/// @brief Array of register sets that store all the extractable cpu information.
cpuid_registers* cpu_data = nullptr;
/// @brief Array of register sets that store all the extractable extended cpu information.
cpuid_registers* cpu_extended_data = nullptr;
private:
/// @brief Helper function for getting values from the cpuid instruction.
/// @param leaf_id The leaf number to read.
/// @return An array of four 32 bit values that hold the values of the registers eax, ebx, ecx, and edx;
cpuid_registers query_cpuid(unsigned int leaf_id) {
cpuid_registers leaf_data = {};
#if (GTL_PLATFORM_CPU_X86 || GTL_PLATFORM_CPU_X64)
#if defined(_MSC_VER)
__cpuidex(
reinterpret_cast<int*>(&leaf_data[cpuid_registers::index::eax]),
leaf_id,
0u
);
#elif defined(__GNUC__)
__cpuid_count(
leaf_id,
0u,
leaf_data[cpuid_registers::index::eax],
leaf_data[cpuid_registers::index::ebx],
leaf_data[cpuid_registers::index::ecx],
leaf_data[cpuid_registers::index::edx]
);
#endif
#else
static_cast<void>(leaf_id);
#endif
return leaf_data;
}
public:
~cpu() {
delete[] this->cpu_data;
delete[] this->cpu_extended_data;
}
/// @brief The constructor extracts all available cpu information and stores it in an array.
cpu() {
#if (GTL_PLATFORM_CPU_X86 || GTL_PLATFORM_CPU_X64)
// First get the maximum supported cpuid leaf and the manufacturer id by calling with a cpuid leaf of 0x00000000.
cpuid_registers leaf_vendor_id_value = this->query_cpuid(cpu::leaf_vendor_id);
const unsigned int cpu_data_size = leaf_vendor_id_value[cpuid_registers::index::eax] + 1;
// Reserve memory for cpu_data to fit queries.
this->cpu_data = new cpuid_registers[cpu_data_size]{};
this->cpu_data[cpu::leaf_vendor_id] = leaf_vendor_id_value;
// Extract every leaf.
for (unsigned int leaf_id = 1u; leaf_id < this->get_max_leaf_id(); ++leaf_id) {
this->cpu_data[leaf_id] = this->query_cpuid(leaf_id);
}
// Get the maximum supported cpuid extended leaf by calling with a cpuid leaf of 0x80000000.
cpuid_registers extended_leaf_highest_function_value = this->query_cpuid(cpu::extended_leaf_highest_function);
const unsigned int cpu_extended_data_size = (extended_leaf_highest_function_value[cpuid_registers::index::eax] & 0x7FFFFFFFu) + 1;
// Reserve memory for cpu_extended_data to fit remaining queries.
this->cpu_extended_data = new cpuid_registers[cpu_extended_data_size]{};
this->cpu_extended_data[cpu::extended_leaf_highest_function & 0x7FFFFFFFu] = extended_leaf_highest_function_value;
// Extract every extended leaf.
for (unsigned int leaf_id = 1u; leaf_id < this->get_max_extended_leaf_id(); ++leaf_id) {
this->cpu_extended_data[leaf_id] = this->query_cpuid(leaf_id | 0x80000000u);
}
#endif
}
public:
/// @brief Check the build is compatible with the cpu.
/// @return true if the build flags are a subset of the available cpu instructions, false otherwise.
bool is_build_compatible() {
#if defined(__MMX__)
if (!this->has_mmx()) return false;
#endif
#if defined(__SSE__)
if (!this->has_sse()) return false;
#endif
#if defined(__SSE2__)
if (!this->has_sse2()) return false;
#endif
#if defined(__SSE3__)
if (!this->has_sse3()) return false;
#endif
#if defined(__SSSE3__)
if (!this->has_ssse3()) return false;
#endif
#if defined(__SSE4_1__)
if (!this->has_sse4_1()) return false;
#endif
#if defined(__SSE4_2__)
if (!this->has_sse4_2()) return false;
#endif
#if defined(__POPCNT__)
if (!this->has_popcnt()) return false;
#endif
#if defined(__AVX__)
if (!this->has_avx()) return false;
#endif
#if defined(__AVX2__)
if (!this->has_avx2()) return false;
#endif
#if defined(__AVX512F__)
if (!this->has_avx512_foundation()) return false;
#endif
#if defined(__BMI__)
if (!this->has_bmi()) return false;
#endif
#if defined(__BMI2__)
if (!this->has_bmi2()) return false;
#endif
return true;
}
public:
/// @brief Get the value of a single bit in one of the extracted leafs registers.
/// @param leaf_id The id number of the leaf to read.
/// @param register_id The register number within a leaf.
/// @param bit_id The individual bit number within a register.
/// @return true if the specified bit is 1 in the specified leaf register, false otherwise.
bool get_leaf_register_bit(unsigned int leaf_id, cpuid_registers::index register_id, unsigned int bit_id) const {
#if (GTL_PLATFORM_CPU_X86 || GTL_PLATFORM_CPU_X64)
// Check the requested leaf_id is within those available.
if (this->get_max_leaf_id() < leaf_id) {
return false;
}
// Double check the requested leaf_id is within those available.
if (this->get_max_leaf_id() <= leaf_id) {
return false;
}
// Check the bit_id is within the size of a register.
if (bit_id > 31u) {
return false;
}
// Return the extracted value of the bit.
return this->cpu_data[leaf_id][register_id] & (1u << bit_id);
#else
static_cast<void>(leaf_id);
static_cast<void>(register_id);
static_cast<void>(bit_id);
return false;
#endif
}
/// @brief Get the value of a single bit in one of the extracted extended leafs registers.
/// @param extended_leaf_id The id number of the leaf to read.
/// @param register_id The register number within a leaf.
/// @param bit_id The individual bit number within a register.
/// @return true if the specified bit is 1 in the specified leaf register, false otherwise.
bool get_extended_leaf_register_bit(unsigned int extended_leaf_id, cpuid_registers::index register_id, unsigned int bit_id) const {
#if (GTL_PLATFORM_CPU_X86 || GTL_PLATFORM_CPU_X64)
// First remove the top bit.
extended_leaf_id = extended_leaf_id & 0x7FFFFFFFu;
// Check the requested leaf_id is within those available.
if (this->get_max_extended_leaf_id() < extended_leaf_id) {
return false;
}
// Double check the requested leaf_id is within those available.
if (this->get_max_extended_leaf_id() <= extended_leaf_id) {
return false;
}
// Check the bit_id is within the size of a register.
if (bit_id > 31u) {
return false;
}
// Return the extracted value of the bit.
return this->cpu_extended_data[extended_leaf_id][register_id] & (1u << bit_id);
#else
static_cast<void>(extended_leaf_id);
static_cast<void>(register_id);
static_cast<void>(bit_id);
return false;
#endif
}
public:
/// @brief Get the maximum valid leaf number for this processor.
/// @return The maximum valid leaf number for this processor.
unsigned int get_max_leaf_id() const {
#if (GTL_PLATFORM_CPU_X86 || GTL_PLATFORM_CPU_X64)
return this->cpu_data[cpu::leaf_vendor_id][cpuid_registers::index::eax];
#else
return 0;
#endif
}
/// @brief Simple string structure for returning the manufacturer id string.
struct manufacturer_id_string_type {
char data[13] = {};
};
/// @brief Get the name of the processors manufacturer.
/// @return The name of the manufacturer of this processor as a string.
manufacturer_id_string_type get_manufacturer_id() const {
manufacturer_id_string_type manufacturer_id_string;
#if (GTL_PLATFORM_CPU_X86 || GTL_PLATFORM_CPU_X64)
manufacturer_id_string.data[0] = reinterpret_cast<const char*>(&this->cpu_data[cpu::leaf_vendor_id][cpuid_registers::index::ebx])[0];
manufacturer_id_string.data[1] = reinterpret_cast<const char*>(&this->cpu_data[cpu::leaf_vendor_id][cpuid_registers::index::ebx])[1];
manufacturer_id_string.data[2] = reinterpret_cast<const char*>(&this->cpu_data[cpu::leaf_vendor_id][cpuid_registers::index::ebx])[2];
manufacturer_id_string.data[3] = reinterpret_cast<const char*>(&this->cpu_data[cpu::leaf_vendor_id][cpuid_registers::index::ebx])[3];
manufacturer_id_string.data[4] = reinterpret_cast<const char*>(&this->cpu_data[cpu::leaf_vendor_id][cpuid_registers::index::edx])[0];
manufacturer_id_string.data[5] = reinterpret_cast<const char*>(&this->cpu_data[cpu::leaf_vendor_id][cpuid_registers::index::edx])[1];
manufacturer_id_string.data[6] = reinterpret_cast<const char*>(&this->cpu_data[cpu::leaf_vendor_id][cpuid_registers::index::edx])[2];
manufacturer_id_string.data[7] = reinterpret_cast<const char*>(&this->cpu_data[cpu::leaf_vendor_id][cpuid_registers::index::edx])[3];
manufacturer_id_string.data[8] = reinterpret_cast<const char*>(&this->cpu_data[cpu::leaf_vendor_id][cpuid_registers::index::ecx])[0];
manufacturer_id_string.data[9] = reinterpret_cast<const char*>(&this->cpu_data[cpu::leaf_vendor_id][cpuid_registers::index::ecx])[1];
manufacturer_id_string.data[10] = reinterpret_cast<const char*>(&this->cpu_data[cpu::leaf_vendor_id][cpuid_registers::index::ecx])[2];
manufacturer_id_string.data[11] = reinterpret_cast<const char*>(&this->cpu_data[cpu::leaf_vendor_id][cpuid_registers::index::ecx])[3];
manufacturer_id_string.data[12] = 0;
#endif
return manufacturer_id_string;
}
public:
/// @brief Check if mmx instructions are supported.
/// @return true if the instruction is supported, false otherwise.
bool has_mmx() const {
return this->get_leaf_register_bit(cpu::leaf_feature_bits, cpuid_registers::index::edx, 23);
}
/// @brief Check if fma instructions are supported.
/// @return true if the instruction is supported, false otherwise.
bool has_fma() const {
return this->get_leaf_register_bit(cpu::leaf_feature_bits, cpuid_registers::index::ecx, 12);
}
/// @brief Check if sse instructions are supported.
/// @return true if the instruction is supported, false otherwise.
bool has_sse() const {
return this->get_leaf_register_bit(cpu::leaf_feature_bits, cpuid_registers::index::edx, 25);
}
/// @brief Check if sse2 instructions are supported.
/// @return true if the instruction is supported, false otherwise.
bool has_sse2() const {
return this->get_leaf_register_bit(cpu::leaf_feature_bits, cpuid_registers::index::edx, 26);
}
/// @brief Check if sse3 instructions are supported.
/// @return true if the instruction is supported, false otherwise.
bool has_sse3() const {
return this->get_leaf_register_bit(cpu::leaf_feature_bits, cpuid_registers::index::ecx, 0);
}
/// @brief Check if ssse3 instructions are supported.
/// @return true if the instruction is supported, false otherwise.
bool has_ssse3() const {
return this->get_leaf_register_bit(cpu::leaf_feature_bits, cpuid_registers::index::ecx, 9);
}
/// @brief Check if sse4.1 instructions are supported.
/// @return true if the instruction is supported, false otherwise.
bool has_sse4_1() const {
return this->get_leaf_register_bit(cpu::leaf_feature_bits, cpuid_registers::index::ecx, 19);
}
/// @brief Check if sse4.2 instructions are supported.
/// @return true if the instruction is supported, false otherwise.
bool has_sse4_2() const {
return this->get_leaf_register_bit(cpu::leaf_feature_bits, cpuid_registers::index::ecx, 20);
}
/// @brief Check if popcnt instructions are supported.
/// @return true if the instruction is supported, false otherwise.
bool has_popcnt() const {
return this->get_leaf_register_bit(cpu::leaf_feature_bits, cpuid_registers::index::ecx, 23);
}
/// @brief Check if avx instructions are supported.
/// @return true if the instruction is supported, false otherwise.
bool has_avx() const {
return this->get_leaf_register_bit(cpu::leaf_feature_bits, cpuid_registers::index::ecx, 28);
}
/// @brief Check if avx2 instructions are supported.
/// @return true if the instruction is supported, false otherwise.
bool has_avx2() const {
return this->get_leaf_register_bit(cpu::leaf_extended_feature_bits, cpuid_registers::index::ebx, 5);
}
/// @brief Check if avx512 foundation instructions are supported.
/// @return true if the instruction is supported, false otherwise.
bool has_avx512_foundation() const {
return this->get_extended_leaf_register_bit(cpu::leaf_extended_feature_bits, cpuid_registers::index::ebx, 16);
}
/// @brief Check if bmi instructions are supported.
/// @return true if the instruction is supported, false otherwise.
bool has_bmi() const {
return this->get_leaf_register_bit(cpu::leaf_extended_feature_bits, cpuid_registers::index::ebx, 3);
}
/// @brief Check if bmi2 instructions are supported.
/// @return true if the instruction is supported, false otherwise.
bool has_bmi2() const {
return this->get_leaf_register_bit(cpu::leaf_extended_feature_bits, cpuid_registers::index::ebx, 8);
}
public:
/// @brief Get the maximum valid extended leaf number for this processor.
/// @return The maximum valid extended leaf number for this processor.
unsigned int get_max_extended_leaf_id() const {
#if (GTL_PLATFORM_CPU_X86 || GTL_PLATFORM_CPU_X64)
return this->cpu_extended_data[cpu::extended_leaf_highest_function & 0x7FFFFFFFu][cpuid_registers::index::eax] & 0x7FFFFFFFu;
#else
return 0;
#endif
}
/// @brief Simple string structure for returning the brand string.
struct brand_string_type {
char data[49] = {};
};
/// @brief Get the brand string of the processors manufacturer.
/// @return The brand string of the manufacturer of this processor as a string.
brand_string_type get_brand_string() const {
brand_string_type brand_string;
#if (GTL_PLATFORM_CPU_X86 || GTL_PLATFORM_CPU_X64)
brand_string.data[0] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_0 & 0x7FFFFFFFu][cpuid_registers::index::eax])[0];
brand_string.data[1] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_0 & 0x7FFFFFFFu][cpuid_registers::index::eax])[1];
brand_string.data[2] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_0 & 0x7FFFFFFFu][cpuid_registers::index::eax])[2];
brand_string.data[3] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_0 & 0x7FFFFFFFu][cpuid_registers::index::eax])[3];
brand_string.data[4] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_0 & 0x7FFFFFFFu][cpuid_registers::index::ebx])[0];
brand_string.data[5] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_0 & 0x7FFFFFFFu][cpuid_registers::index::ebx])[1];
brand_string.data[6] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_0 & 0x7FFFFFFFu][cpuid_registers::index::ebx])[2];
brand_string.data[7] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_0 & 0x7FFFFFFFu][cpuid_registers::index::ebx])[3];
brand_string.data[8] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_0 & 0x7FFFFFFFu][cpuid_registers::index::ecx])[0];
brand_string.data[9] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_0 & 0x7FFFFFFFu][cpuid_registers::index::ecx])[1];
brand_string.data[10] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_0 & 0x7FFFFFFFu][cpuid_registers::index::ecx])[2];
brand_string.data[11] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_0 & 0x7FFFFFFFu][cpuid_registers::index::ecx])[3];
brand_string.data[12] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_0 & 0x7FFFFFFFu][cpuid_registers::index::edx])[0];
brand_string.data[13] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_0 & 0x7FFFFFFFu][cpuid_registers::index::edx])[1];
brand_string.data[14] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_0 & 0x7FFFFFFFu][cpuid_registers::index::edx])[2];
brand_string.data[15] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_0 & 0x7FFFFFFFu][cpuid_registers::index::edx])[3];
brand_string.data[16] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_1 & 0x7FFFFFFFu][cpuid_registers::index::eax])[0];
brand_string.data[17] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_1 & 0x7FFFFFFFu][cpuid_registers::index::eax])[1];
brand_string.data[18] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_1 & 0x7FFFFFFFu][cpuid_registers::index::eax])[2];
brand_string.data[19] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_1 & 0x7FFFFFFFu][cpuid_registers::index::eax])[3];
brand_string.data[20] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_1 & 0x7FFFFFFFu][cpuid_registers::index::ebx])[0];
brand_string.data[21] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_1 & 0x7FFFFFFFu][cpuid_registers::index::ebx])[1];
brand_string.data[22] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_1 & 0x7FFFFFFFu][cpuid_registers::index::ebx])[2];
brand_string.data[23] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_1 & 0x7FFFFFFFu][cpuid_registers::index::ebx])[3];
brand_string.data[24] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_1 & 0x7FFFFFFFu][cpuid_registers::index::ecx])[0];
brand_string.data[25] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_1 & 0x7FFFFFFFu][cpuid_registers::index::ecx])[1];
brand_string.data[26] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_1 & 0x7FFFFFFFu][cpuid_registers::index::ecx])[2];
brand_string.data[27] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_1 & 0x7FFFFFFFu][cpuid_registers::index::ecx])[3];
brand_string.data[28] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_1 & 0x7FFFFFFFu][cpuid_registers::index::edx])[0];
brand_string.data[29] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_1 & 0x7FFFFFFFu][cpuid_registers::index::edx])[1];
brand_string.data[30] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_1 & 0x7FFFFFFFu][cpuid_registers::index::edx])[2];
brand_string.data[31] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_1 & 0x7FFFFFFFu][cpuid_registers::index::edx])[3];
brand_string.data[32] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_2 & 0x7FFFFFFFu][cpuid_registers::index::eax])[0];
brand_string.data[33] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_2 & 0x7FFFFFFFu][cpuid_registers::index::eax])[1];
brand_string.data[34] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_2 & 0x7FFFFFFFu][cpuid_registers::index::eax])[2];
brand_string.data[35] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_2 & 0x7FFFFFFFu][cpuid_registers::index::eax])[3];
brand_string.data[36] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_2 & 0x7FFFFFFFu][cpuid_registers::index::ebx])[0];
brand_string.data[37] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_2 & 0x7FFFFFFFu][cpuid_registers::index::ebx])[1];
brand_string.data[38] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_2 & 0x7FFFFFFFu][cpuid_registers::index::ebx])[2];
brand_string.data[39] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_2 & 0x7FFFFFFFu][cpuid_registers::index::ebx])[3];
brand_string.data[40] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_2 & 0x7FFFFFFFu][cpuid_registers::index::ecx])[0];
brand_string.data[41] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_2 & 0x7FFFFFFFu][cpuid_registers::index::ecx])[1];
brand_string.data[42] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_2 & 0x7FFFFFFFu][cpuid_registers::index::ecx])[2];
brand_string.data[43] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_2 & 0x7FFFFFFFu][cpuid_registers::index::ecx])[3];
brand_string.data[44] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_2 & 0x7FFFFFFFu][cpuid_registers::index::edx])[0];
brand_string.data[45] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_2 & 0x7FFFFFFFu][cpuid_registers::index::edx])[1];
brand_string.data[46] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_2 & 0x7FFFFFFFu][cpuid_registers::index::edx])[2];
brand_string.data[47] = reinterpret_cast<const char*>(&this->cpu_extended_data[cpu::extended_leaf_brand_string_2 & 0x7FFFFFFFu][cpuid_registers::index::edx])[3];
brand_string.data[48] = 0;
#endif
return brand_string;
}
};
}
#undef GTL_PLATFORM_CPU_X86
#undef GTL_PLATFORM_CPU_X64
#endif // GTL_PLATFORM_CPU_HPP