7 cpu_get_model(char* model_out)
9 u32_t* out = (u32_t*)model_out;
10 reg32 eax = 0, ebx = 0, edx = 0, ecx = 0;
12 __get_cpuid(0, &eax, &ebx, &ecx, &edx);
20 #define BRAND_LEAF 0x80000000UL
23 cpu_brand_string_supported()
25 reg32 supported = __get_cpuid_max(BRAND_LEAF, 0);
26 return (supported >= 0x80000004UL);
30 cpu_get_brand(char* brand_out)
32 if (!cpu_brand_string_supported()) {
36 u32_t* out = (u32_t*)brand_out;
37 reg32 eax = 0, ebx = 0, edx = 0, ecx = 0;
38 for (u32_t i = 2, j = 0; i < 5; i++) {
39 __get_cpuid(BRAND_LEAF + i, &eax, &ebx, &ecx, &edx);
52 // reference: Intel manual, section 10.4.2
53 reg32 eax = 0, ebx = 0, edx = 0, ecx = 0;
54 __get_cpuid(1, &eax, &ebx, &ecx, &edx);
60 cpu_rdmsr(u32_t msr_idx, u32_t* reg_high, u32_t* reg_low)
63 asm volatile("rdmsr" : "=d"(h), "=a"(l) : "c"(msr_idx));
70 cpu_wrmsr(u32_t msr_idx, u32_t reg_high, u32_t reg_low)
72 asm volatile("wrmsr" : : "d"(reg_high), "a"(reg_low), "c"(msr_idx));
78 reg32 eax = 0, ebx = 0, ecx = 0, edx = 0;
79 __get_cpuid(0x01, &eax, &ebx, &ecx, &edx);
80 return (ecx & (1 << 30));