2 * Acess2 - CPUID Parser
9 int main(int argc, char *argv[]);
10 void cpuid(uint32_t Num, uint32_t *EAX, uint32_t *EBX, uint32_t *EDX, uint32_t *ECX);
13 int main(int argc, char *argv[])
17 uint32_t eax, ebx, edx, ecx;
19 // -- Get Vendor ID and maximum ID
21 (uint32_t*)&iMaxBasic, (uint32_t*)&sVendorId[0],
22 (uint32_t*)&sVendorId[4], (uint32_t*)&sVendorId[8]);
24 printf("Vendor: %s\n", sVendorId);
25 printf("Maximum CPUID: %i\n", iMaxBasic);
27 // -- Get Processor Information
28 if( iMaxBasic == 0 ) return 0;
33 # 13:12 - Processor Type
34 # 19:16 - Extended Model
35 # 27:20 - Extended Famil
37 cpuid(1, &eax, &ebx, &edx, &ecx);
38 printf("Model: Family %i, Model %i, Stepping %i\n", (eax>>8)&7, (eax>>4)&7, eax&7);
39 printf("Type: %i\n", (eax>>12)&7);
40 printf("EDX Features: ");
41 if(edx & 1 << 0) printf("FPU ");
42 if(edx & 1 << 1) printf("VME ");
43 if(edx & 1 << 2) printf("DE ");
44 if(edx & 1 << 3) printf("PSE ");
45 if(edx & 1 << 4) printf("TSC ");
46 if(edx & 1 << 5) printf("MSR ");
47 if(edx & 1 << 6) printf("PAE ");
48 if(edx & 1 << 7) printf("MCE ");
49 if(edx & 1 << 8) printf("CX8 ");
50 if(edx & 1 << 9) printf("APIC ");
52 if(edx & 1 << 11) printf("SEP ");
53 if(edx & 1 << 12) printf("MTRR ");
54 if(edx & 1 << 13) printf("PGE ");
55 if(edx & 1 << 14) printf("MCA ");
56 if(edx & 1 << 15) printf("CMOV ");
57 if(edx & 1 << 16) printf("PAT ");
58 if(edx & 1 << 17) printf("PSE36 ");
59 if(edx & 1 << 18) printf("PSN ");
60 if(edx & 1 << 19) printf("CLF ");
62 if(edx & 1 << 21) printf("DTES ");
63 if(edx & 1 << 22) printf("ACPI ");
64 if(edx & 1 << 23) printf("MMX ");
65 if(edx & 1 << 25) printf("SSE ");
66 if(edx & 1 << 26) printf("SSE2 ");
67 if(edx & 1 << 27) printf("SS ");
68 if(edx & 1 << 28) printf("HTT ");
69 if(edx & 1 << 29) printf("TM1 ");
70 if(edx & 1 << 30) printf("IA64 ");
71 if(edx & 1 << 31) printf("PBE ");
74 printf("ECX Features: ");
75 if(ecx & 1 << 0) printf("SSE3 ");
76 if(ecx & 1 << 1) printf("PCLMUL ");
77 if(ecx & 1 << 4) printf("DTES64 ");
78 if(ecx & 1 << 5) printf("VMX ");
79 if(ecx & 1 << 6) printf("SMX ");
80 if(ecx & 1 << 7) printf("EST ");
81 if(ecx & 1 << 8) printf("TM2 ");
82 if(ecx & 1 << 9) printf("SSSE3 ");
83 if(ecx & 1 << 10) printf("CID ");
85 if(ecx & 1 << 12) printf("FMA ");
86 if(ecx & 1 << 13) printf("CX16 ");
87 if(ecx & 1 << 14) printf("ETPRD ");
88 if(ecx & 1 << 15) printf("PDCM ");
91 if(ecx & 1 << 18) printf("DCA ");
92 if(ecx & 1 << 19) printf("SSE4.1");
93 if(ecx & 1 << 20) printf("SSE4.2");
94 if(ecx & 1 << 21) printf("x2APIC ");
95 if(ecx & 1 << 22) printf("MOVBE ");
96 if(ecx & 1 << 23) printf("POPCNT ");
99 if(ecx & 1 << 26) printf("XSAVE ");
100 if(ecx & 1 << 27) printf("OSXSAVE ");
101 if(ecx & 1 << 28) printf("AVX ");
108 * \brief Call the CPUID opcode
110 void cpuid(uint32_t Num, uint32_t *EAX, uint32_t *EBX, uint32_t *EDX, uint32_t *ECX)
112 uint32_t eax, ebx, edx, ecx;
114 __asm__ __volatile__ (
116 : "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx)