|
|
@@ -1,6 +1,7 @@
|
|
|
#include "cpuid.h"
|
|
|
|
|
|
#include <stdio.h>
|
|
|
+#include <stdint.h>
|
|
|
|
|
|
int main()
|
|
|
{
|
|
|
@@ -9,12 +10,6 @@ int main()
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
- printf ("MMX: %s\n", cpuid_has_mmx() ? "Yes" : "No");
|
|
|
- printf ("SSE: %s\n", cpuid_has_sse() ? "Yes" : "No");
|
|
|
- printf ("SSE2: %s\n", cpuid_has_sse2() ? "Yes" : "No");
|
|
|
- printf ("SSE3: %s\n", cpuid_has_sse3() ? "Yes" : "No");
|
|
|
- printf ("x64: %s\n", cpuid_has_x64() ? "Yes" : "No");
|
|
|
-
|
|
|
char buf[128];
|
|
|
cpuid(CPU_VENDORID, buf);
|
|
|
printf ("Vendor ID: %s\n", buf);
|
|
|
@@ -26,22 +21,38 @@ int main()
|
|
|
cpuid(CPU_HIGHEST_EXTENDED_FUNCTION_SUPPORTED, &addr);
|
|
|
printf ("Highest extended function supported: %#010x\n", addr);
|
|
|
|
|
|
- int virtphys_size;
|
|
|
- cpuid(CPU_VIRT_PHYS_ADDR_SIZES, &virtphys_size);
|
|
|
- printf ("Virtual and physical address sizes: %d\n", virtphys_size);
|
|
|
+ union {
|
|
|
+ struct {
|
|
|
+ uint32_t phys_bits : 8;
|
|
|
+ uint32_t virt_bits : 8;
|
|
|
+ uint32_t reserved : 16;
|
|
|
+ };
|
|
|
+ uint32_t w;
|
|
|
+ } s;
|
|
|
+ cpuid(CPU_VIRT_PHYS_ADDR_SIZES, &s.w);
|
|
|
+ printf ("Physical address size: %d\nVirtual: %d\n", s.phys_bits, s.virt_bits);
|
|
|
|
|
|
int extfeatures[2];
|
|
|
cpuid(CPU_EXTENDED_PROC_INFO_FEATURE_BITS, extfeatures);
|
|
|
printf ("Extended processor info and feature bits: %d %d\n", extfeatures[0], extfeatures[1]);
|
|
|
|
|
|
- int l2features[3];
|
|
|
- cpuid(CPU_EXTENDED_L2_CACHE_FEATURES, l2features);
|
|
|
+ union {
|
|
|
+ struct {
|
|
|
+ uint32_t line_size : 8;
|
|
|
+ uint32_t reserved : 4;
|
|
|
+ uint32_t assoc : 4;
|
|
|
+ uint32_t cache_size : 16;
|
|
|
+ };
|
|
|
+
|
|
|
+ uint32_t w;
|
|
|
+ } l2c;
|
|
|
+
|
|
|
+ cpuid(CPU_EXTENDED_L2_CACHE_FEATURES, &l2c.w);
|
|
|
printf ("L2 Cache Size: %u KB\tLine Size: %u bytes\tAssociativity: %02xh\n",
|
|
|
- l2features[0], l2features[1], l2features[2]);
|
|
|
+ l2c.cache_size, l2c.line_size, l2c.assoc);
|
|
|
|
|
|
int invalid;
|
|
|
cpuid(0x0ffffffUL, &invalid);
|
|
|
printf ("Testing invalid: %#010x\n", invalid);
|
|
|
return 0;
|
|
|
}
|
|
|
-
|