]> git.ozlabs.org Git - ccan/blobdiff - ccan/cpuid/test/run.c
cpuid: remove the static func has_feature
[ccan] / ccan / cpuid / test / run.c
index 1f523e4aa207e4db7290961a48f996cc85984c99..c77fd25f87face6a4dc74a501b140132764413fc 100644 (file)
@@ -1,25 +1,22 @@
-#include "cpuid.h"
+#include "../cpuid.c"
 
 #include <stdio.h>
 #include <stdint.h>
 
-int main()
+int main(void)
 {
        if (!cpuid_is_supported()) {
                printf ("CPUID instruction is not supported by this CPU\n");
                return 1;
        }
 
-       char buf[128];
-       cpuid(CPU_VENDORID, buf);
-       printf ("Vendor ID: %s\n", buf);
+       printf ("Vendor ID: %s\n", cpuid_get_cpu_type_string (cpuid_get_cpu_type ()));
 
-       cpuid(CPU_PROC_BRAND_STRING, buf);
+       char buf[48];
+       cpuid(CPU_PROC_BRAND_STRING, (uint32_t *)buf);
        printf ("Processor Brand: %s\n", buf);
 
-       int addr;
-       cpuid(CPU_HIGHEST_EXTENDED_FUNCTION_SUPPORTED, &addr);
-       printf ("Highest extended function supported: %#010x\n", addr);
+       printf ("Highest extended function supported: %#010x\n", cpuid_highest_ext_func_supported());
 
        union {
                struct {
@@ -32,7 +29,7 @@ int main()
        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];
+       uint32_t extfeatures[2];
        cpuid(CPU_EXTENDED_PROC_INFO_FEATURE_BITS, extfeatures);
        printf ("Extended processor info and feature bits: %d %d\n", extfeatures[0], extfeatures[1]);
 
@@ -51,8 +48,9 @@ int main()
        printf ("L2 Cache Size: %u KB\tLine Size: %u bytes\tAssociativity: %02xh\n",
                        l2c.cache_size, l2c.line_size, l2c.assoc);
 
-       int invalid;
+       uint32_t invalid;
        cpuid(0x0ffffffUL, &invalid);
        printf ("Testing invalid: %#010x\n", invalid);
        return 0;
 }
+