[syslinux] [PATCH] gpllib: fix call to CPUID function 4

Sebastian Herbszt herbszt at gmx.de
Sun Mar 21 13:55:00 PDT 2010


Only call CPUID function 4 if cpuid_level indicates its availability.

Signed-off-by: Sebastian Herbszt <herbszt at gmx.de>

diff --git a/com32/gpllib/cpuid.c b/com32/gpllib/cpuid.c
index fa21204..f33e895 100644
--- a/com32/gpllib/cpuid.c
+++ b/com32/gpllib/cpuid.c
@@ -232,8 +232,10 @@ void generic_identify(struct cpuinfo_x86 *c)
 	}
 	break;
     case X86_VENDOR_INTEL:
-	cpuid(0x4, &eax, &ebx, &ecx, &edx);
-	c->x86_num_cores = ((eax & 0xfc000000) >> 26) + 1;
+	if (c->cpuid_level >= 0x00000004) {
+	    cpuid(0x4, &eax, &ebx, &ecx, &edx);
+	    c->x86_num_cores = ((eax & 0xfc000000) >> 26) + 1;
+	}
 	break;
     default:
 	c->x86_num_cores = 1;




More information about the Syslinux mailing list