File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020#define KERNEL_CPUID_HPP
2121
2222struct CPUID {
23- struct cpuid_t {
24- unsigned int EAX;
25- unsigned int EBX;
26- unsigned int ECX;
27- unsigned int EDX;
28- };
29-
3023 static bool isAmdCpu ();
3124 static bool isIntelCpu ();
3225 static bool hasRDRAND ();
Original file line number Diff line number Diff line change 8787#define EDX_RDTSCP (1 << 27 ) // RDTSCP and IA32_TSC_AUX
8888#define EDX_64_BIT (1 << 29 ) // 64-bit Architecture
8989
90- using cpuid_t = CPUID::cpuid_t ;
90+ struct cpuid_t {
91+ unsigned int EAX;
92+ unsigned int EBX;
93+ unsigned int ECX;
94+ unsigned int EDX;
95+ }; // < cpuid_t
9196
9297// EBX/RBX needs to be preserved depending on the memory model and use of PIC
9398static cpuid_t
@@ -119,7 +124,7 @@ bool CPUID::hasRDRAND() {
119124 if (!isAmdCpu () && !isIntelCpu ()) {
120125 return false ;
121126 }
122-
123- cpuid_t info = cpuid_info (0 , 0 );
127+
128+ cpuid_t info = cpuid_info (1 , 0 );
124129 return (info.ECX & ECX_RDRAND) != 0 ;
125130}
You can’t perform that action at this time.
0 commit comments