]> sourceware.org Git - glibc.git/commitdiff
Check if cpuid is available in init_cpu_features
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 13 Aug 2015 11:52:50 +0000 (04:52 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 13 Aug 2015 11:53:03 +0000 (04:53 -0700)
Since not all i486 processors support cpuid, we call __get_cpuid_max to
check if cpuid is available before using it if not compiling for i586,
i686 nor x86-64.

* sysdeps/x86/cpu-features.c (init_cpu_features): Call
__get_cpuid_max if not compiling for i586, i686 nor x86-64.

ChangeLog
sysdeps/x86/cpu-features.c

index 51c6fef0a5feb8b28ee62262ba493ba8377944b1..3f55c55a1d1bc1a9685c36f1eed1f80045fa3058 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-08-13  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * sysdeps/x86/cpu-features.c (init_cpu_features): Call
+       __get_cpuid_max if not compiling for i586, i686 nor x86-64.
+
 2015-08-13  H.J. Lu  <hongjiu.lu@intel.com>
 
        * sysdeps/unix/sysv/linux/x86/elision-conf.h: Don't include
index 587080c1a4de6e14f3fd989f81d41889a9dff9fa..582a8f5f7980edbf9a31b0d04a6194e46e6b63af 100644 (file)
@@ -40,6 +40,14 @@ init_cpu_features (struct cpu_features *cpu_features)
   unsigned int model = 0;
   enum cpu_features_kind kind;
 
+#if !defined __i586__ && !defined __i686__ && !defined __x86_64__
+  if (__get_cpuid_max (0, 0) == 0)
+    {
+      kind = arch_kind_other;
+      goto no_cpuid;
+    }
+#endif
+
   __cpuid (0, cpu_features->max_cpuid, ebx, ecx, edx);
 
   /* This spells out "GenuineIntel".  */
@@ -196,6 +204,10 @@ init_cpu_features (struct cpu_features *cpu_features)
        }
     }
 
+#if !defined __i586__ && !defined __i686__ && !defined __x86_64__
+no_cpuid:
+#endif
+
   cpu_features->family = family;
   cpu_features->model = model;
   cpu_features->kind = kind;
This page took 0.130193 seconds and 5 git commands to generate.