public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH, committed] X86: Don't assert on older Intel CPUs [BZ #20647]
@ 2016-10-12 15:28 H.J. Lu
  0 siblings, 0 replies; only message in thread
From: H.J. Lu @ 2016-10-12 15:28 UTC (permalink / raw)
  To: GNU C Library

Since the maximum CPUID level of older Intel CPUs is 1, change
handle_intel to return -1, instead of assert, when the maximum
CPUID level is less than 2.

Tested on i686 and x86-64.  Checked in.

H.J.
---

	[BZ #20647]
	* sysdeps/x86/cacheinfo.c (handle_intel): Return -1 if the
	maximum CPUID level is less than 2.
---
 ChangeLog               | 6 ++++++
 sysdeps/x86/cacheinfo.c | 4 +++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index d129219..81dd89f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2016-10-12  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #20647]
+	* sysdeps/x86/cacheinfo.c (handle_intel): Return -1 if the
+	maximum CPUID level is less than 2.
+
 2016-10-12  Joseph Myers  <joseph@codesourcery.com>
 
 	* math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
diff --git a/sysdeps/x86/cacheinfo.c b/sysdeps/x86/cacheinfo.c
index cf4f64b..35268e8 100644
--- a/sysdeps/x86/cacheinfo.c
+++ b/sysdeps/x86/cacheinfo.c
@@ -259,7 +259,9 @@ intel_check_word (int name, unsigned int value, bool *has_level_2,
 static long int __attribute__ ((noinline))
 handle_intel (int name, unsigned int maxidx)
 {
-  assert (maxidx >= 2);
+  /* Return -1 for older CPUs.  */
+  if (maxidx < 2)
+    return -1;
 
   /* OK, we can use the CPUID instruction to get all info about the
      caches.  */
-- 
2.7.4

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-10-12 15:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-12 15:28 [PATCH, committed] X86: Don't assert on older Intel CPUs [BZ #20647] H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).