1
0
Fork 0
mirror of https://github.com/anrieff/libcpuid synced 2024-11-10 22:59:13 +00:00

The ext. family and ext. model are now calculated according to Intel and AMD docs

git-svn-id: https://svn.code.sf.net/p/libcpuid/code/HEAD/libcpuid@22 3b4be424-7ac5-41d7-8526-f4ddcb85d872
This commit is contained in:
Veselin Georgiev 2008-11-20 16:09:16 +00:00
parent 6a5dff539e
commit 14bcf31db3

View file

@ -221,12 +221,18 @@ static int cpuid_basic_identify(struct cpu_raw_data_t* raw, struct cpu_id_t* dat
if (data->vendor == VENDOR_UNKNOWN) if (data->vendor == VENDOR_UNKNOWN)
return set_error(ERR_CPU_UNKN); return set_error(ERR_CPU_UNKN);
int basic = raw->basic_cpuid[0][0]; int basic = raw->basic_cpuid[0][0];
int xmodel, xfamily;
if (basic >= 1) { if (basic >= 1) {
data->family = (raw->basic_cpuid[1][0] >> 8) & 0xf; data->family = (raw->basic_cpuid[1][0] >> 8) & 0xf;
data->model = (raw->basic_cpuid[1][0] >> 4) & 0xf; data->model = (raw->basic_cpuid[1][0] >> 4) & 0xf;
data->stepping = raw->basic_cpuid[1][0] & 0xf; data->stepping = raw->basic_cpuid[1][0] & 0xf;
data->ext_model = (raw->basic_cpuid[1][0] >> 16) & 0xf; xmodel = (raw->basic_cpuid[1][0] >> 16) & 0xf;
data->ext_family = (raw->basic_cpuid[1][0] >> 20) & 0xff; xfamily = (raw->basic_cpuid[1][0] >> 20) & 0xff;
if (data->vendor == VENDOR_AMD && data->family < 0xf)
data->ext_family = data->family;
else
data->ext_family = data->family + xfamily;
data->ext_model = data->model + (xmodel << 4);
} }
int ext = raw->ext_cpuid[0][0] - 0x8000000; int ext = raw->ext_cpuid[0][0] - 0x8000000;