Continue cpuid implementation

This commit is contained in:
Baptiste Wicht 2014-02-09 22:53:23 +01:00
parent 4ba26a4227
commit 540f33935c

View File

@ -22,9 +22,23 @@ void native_cpuid(uint32_t key, uint32_t* eax, uint32_t* ebx, uint32_t* ecx, uin
: "0" (*eax), "2" (*ecx));
}
void get_base_info(){
uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0;
native_cpuid(1, &eax, &ebx, &ecx, &edx);
printf("Stepping: %u\n", eax & 0xF);
printf("Model: %u\n", (eax >> 4) & 0xF);
printf("Family: %u\n", (eax >> 8) & 0xF);
printf("Processor Type: %u\n", (eax >> 12) & 0x3);
printf("Extended Model: %u\n", (eax >> 16) & 0xF);
printf("Extended Family: %u\n", (eax >> 20) & 0xFF);
}
} //end of anonymous namespace
int main(){
get_base_info();
exit(0);
}