cpuid: Introduce cpuid_write_info
[ccan] / ccan / cpuid / test / run.c
1 #include "../cpuid.c"
2
3 #include <stdio.h>
4 #include <stdint.h>
5
6 int main(void)
7 {
8         if (!cpuid_is_supported()) {
9                 printf ("CPUID instruction is not supported by this CPU\n");
10                 return 1;
11         }
12
13         uint32_t info = CPUID_HIGHEST_EXTENDED_FUNCTION_SUPPORTED | CPUID_EXTENDED_L2_CACHE_FEATURES | CPUID_VIRT_PHYS_ADDR_SIZES
14                         | CPUID_PROCINFO_AND_FEATUREBITS;
15         uint32_t featureset = CPUID_FEAT_ECX_ALL | CPUID_FEAT_EDX_ALL;
16         if (!cpuid_write_info(info, featureset, NULL)) {
17                 printf("Failed to write CPU information!\n");
18                 return 1;
19         }
20
21         printf("Wrote CPU information\n");
22         return 0;
23 }