• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <stdint.h>
2 
3 #include <cpuinfo.h>
4 #include <x86/api.h>
5 
6 
cpuinfo_x86_decode_model_info(uint32_t eax)7 struct cpuinfo_x86_model_info cpuinfo_x86_decode_model_info(uint32_t eax) {
8 	struct cpuinfo_x86_model_info model_info;
9 	model_info.stepping        =  eax        & 0xF;
10 	model_info.base_model      = (eax >> 4)  & 0xF;
11 	model_info.base_family     = (eax >> 8)  & 0xF;
12 	model_info.processor_type  = (eax >> 12) & 0x3;
13 	model_info.extended_model  = (eax >> 16) & 0xF;
14 	model_info.extended_family = (eax >> 20) & 0xFF;
15 
16 	model_info.family = model_info.base_family + model_info.extended_family;
17 	model_info.model  = model_info.base_model + (model_info.extended_model << 4);
18 	return model_info;
19 }
20