Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl3/gcc/dist/gcc/config/i386 Fix logic bug where _...



details:   https://anonhg.NetBSD.org/src/rev/940a0e137b8f
branches:  trunk
changeset: 341800:940a0e137b8f
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Nov 22 20:47:05 2015 +0000

description:
Fix logic bug where __cpuid gets called when __get_cpuid_max() returns 0.
This happens when __level == 0, from libgcc/config/i386/cpuinfo.c#285.
This breaks early i486 CPUs which don't have cpuid
XXX: pullup-7

diffstat:

 external/gpl3/gcc/dist/gcc/config/i386/cpuid.h |  3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diffs (14 lines):

diff -r 02df50a5bf37 -r 940a0e137b8f external/gpl3/gcc/dist/gcc/config/i386/cpuid.h
--- a/external/gpl3/gcc/dist/gcc/config/i386/cpuid.h    Sun Nov 22 20:24:19 2015 +0000
+++ b/external/gpl3/gcc/dist/gcc/config/i386/cpuid.h    Sun Nov 22 20:47:05 2015 +0000
@@ -259,8 +259,9 @@
             unsigned int *__ecx, unsigned int *__edx)
 {
   unsigned int __ext = __level & 0x80000000;
+  unsigned int __maxlevel = __get_cpuid_max (__ext, 0);
 
-  if (__get_cpuid_max (__ext, 0) < __level)
+  if (__maxlevel == 0 || __maxlevel < __level)
     return 0;
 
   __cpuid (__level, *__eax, *__ebx, *__ecx, *__edx);



Home | Main Index | Thread Index | Old Index