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

syslinux-bot for Sebastian Herbszt herbszt at gmx.de
Mon Mar 29 13:27:26 PDT 2010


Commit-ID:  1ca27ea6c2fbdc14f06d821cac440898e08ce087
Gitweb:     http://syslinux.zytor.com/commit/1ca27ea6c2fbdc14f06d821cac440898e08ce087
Author:     Sebastian Herbszt <herbszt at gmx.de>
AuthorDate: Sun, 21 Mar 2010 21:55:00 +0100
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Mon, 29 Mar 2010 13:16:09 -0700

gpllib: fix call to CPUID function 4

Only call CPUID function 4 if cpuid_level indicates its availability.

Signed-off-by: Sebastian Herbszt <herbszt at gmx.de>
Signed-off-by: H. Peter Anvin <hpa at zytor.com>


---
 com32/gpllib/cpuid.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

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-commits mailing list