Check if deterministic cache parameters leaf is valid before use.

This commit is contained in:
jkim 2006-04-24 22:23:52 +00:00
parent e3ef44f73d
commit 6b218fc19f
2 changed files with 4 additions and 2 deletions

View File

@ -360,7 +360,8 @@ printcpuinfo(void)
else if (strcmp(cpu_vendor, "GenuineIntel") == 0 &&
(cpu_high >= 4)) {
cpuid_count(4, 0, regs);
cmp = ((regs[0] & 0xfc000000) >> 26) + 1;
if ((regs[0] & 0x1f) != 0)
cmp = ((regs[0] >> 26) & 0x3f) + 1;
}
if (cmp > 1)
printf("\n Cores per package: %d", cmp);

View File

@ -856,7 +856,8 @@ printcpuinfo(void)
else if (strcmp(cpu_vendor, "GenuineIntel") == 0 &&
(cpu_high >= 4)) {
cpuid_count(4, 0, regs);
cmp = ((regs[0] & 0xfc000000) >> 26) + 1;
if ((regs[0] & 0x1f) != 0)
cmp = ((regs[0] >> 26) & 0x3f) + 1;
}
if (cmp > 1)
printf("\n Cores per package: %d", cmp);