]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
PowerPC: Fix AT_HWCAP2 feature bit string output in _dl_procinfo. rsa/hwcap2_v3
authorRyan S. Arnold <rsa@linux.vnet.ibm.com>
Wed, 15 May 2013 20:48:17 +0000 (15:48 -0500)
committerRyan S. Arnold <rsa@linux.vnet.ibm.com>
Wed, 15 May 2013 20:48:17 +0000 (15:48 -0500)
ChangeLog
sysdeps/powerpc/dl-procinfo.c
sysdeps/powerpc/dl-procinfo.h

index cc1b0d31e2d4a28c4ff969cb8b766f246ce860ef..17911d920af04461f201bd2618e2280abee4960f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2013-05-14  Ryan S. Arnold  <rsa@linux.vnet.ibm.com>
+
+       * sysdeps/powerpc/dl-procinfo.c (_dl_powerpc_cap_flags): Properly
+       placed power8 hwcap strings to fix code that assumed bits incremented
+       from 0 to 31.
+       * sysdeps/powerpc/dl-procinfo.h (_dl_procinfo): Eliminate confusing
+       conditional variable definitions used to re-use a single loop
+       definition.  Replace with simpler redundant loops.  Account for
+       AT_HWCAP2 feature bits starting at bit 31 and decrementing.
+       [_DL_HWCAP_LAST]: New definition.
+       [_DL_HWCAP2_LAST]: New definition.
+       [_DL_HWCAP_COUNT]: Update to 64 to account for available bits, not
+       number of actual hwcap bits that are defined.
+
 2013-05-14  Ryan S. Arnold  <rsa@linux.vnet.ibm.com>
 
        * sysdeps/powerpc/bits/hwcap.h: Add new AT_HWCAP2 features.
index 0fbbc8081058be576d74609bb8ebfce662b7e694..1c87fb00f99add5469a25d0e0a5c19f735472e53 100644 (file)
 #if !defined PROCINFO_DECL && defined SHARED
   ._dl_powerpc_cap_flags
 #else
-PROCINFO_CLASS const char _dl_powerpc_cap_flags[31][10]
+PROCINFO_CLASS const char _dl_powerpc_cap_flags[57][10]
 #endif
 #ifndef PROCINFO_DECL
 = {
-    "ebb", "isel", "tar",
-    "vsx", "arch_2_07", "htm", "dscr",
+    "vsx",
     "arch_2_06", "power6x", "dfp", "pa6t",
     "arch_2_05", "ic_snoop", "smt", "booke",
     "cellbe", "power5+", "power5", "power4",
     "notb", "efpdouble", "efpsingle", "spe",
     "ucache", "4xxmac", "mmu", "fpu",
     "altivec", "ppc601", "ppc64", "ppc32",
+    "", "", "", "",
+    "", "", "", "",
+    "", "", "", "",
+    "", "", "", "",
+    "", "", "", "",
+    "", "", "", "",
+    "", "", "tar", "isel",
+    "ebb", "dscr", "htm", "arch_2_07",
   }
 #endif
 #if !defined SHARED || defined PROCINFO_DECL
index 3a5ce12c469f1e5b2799832f1831bf9cb3d8d363..d9cd12672293a7f371e1425ffd80175b45eff71a 100644 (file)
 #include <ldsodefs.h>
 #include <sysdep.h>    /* This defines the PPC_FEATURE[2]_* macros.  */
 
-/* There are 25 bits used in AT_HWCAP, but they are bits 7..31.  */
+/* There are 25 bits used in AT_HWCAP, but they are bits 7..31.  The feature
+ * definitions started at bit 31 and decremented as new features were added.
+ */
+#define _DL_HWCAP_LAST         31
 #define _DL_HWCAP_FIRST                7
-/* Where AT_HWCAP2 starts relative to _DL_HWCAP_FIRST.  */
-#define _DL_HWCAP2_FIRST       32
 
-/* The total number of used bits relative to _DL_HWCAP_FIRST.  */
-#define _DL_HWCAP_COUNT                38
+/* AT_HWCAP2 feature bits similarily started at bit 31 and decremented as new
+ * features were added.  */
+#define _DL_HWCAP2_LAST                31
+
+/* The total number of available bits relative to (minus) _DL_HWCAP_FIRST.  */
+#define _DL_HWCAP_COUNT                64
 
 /* These bits influence library search.  */
 #define HWCAP_IMPORTANT                (PPC_FEATURE_HAS_ALTIVEC \
@@ -166,31 +171,31 @@ static inline int
 __attribute__ ((unused))
 _dl_procinfo (unsigned int type, int word)
 {
-  unsigned int first, count, str_offset;
-
   switch(type)
     {
     case AT_HWCAP:
       _dl_printf ("AT_HWCAP:       ");
-      first = _DL_HWCAP_FIRST;
-      count = MIN(_DL_HWCAP_COUNT, _DL_HWCAP2_FIRST);
-      str_offset = 0;
+
+      for (int i = _DL_HWCAP_FIRST; i <= _DL_HWCAP_LAST; ++i)
+       if (word & (1 << i))
+         _dl_printf (" %s", _dl_hwcap_string (i));
       break;
     case AT_HWCAP2:
-      _dl_printf ("AT_HWCAP2:      ");
-      first = 0;
-      count = _DL_HWCAP_COUNT - _DL_HWCAP2_FIRST;
-      str_offset = _DL_HWCAP2_FIRST;
-      break;
+      {
+       unsigned int offset = _DL_HWCAP_LAST + 1;
+
+       _dl_printf ("AT_HWCAP2:      ");
+
+       for (int i = 0; i <= _DL_HWCAP2_LAST; ++i)
+         if (word & (1 << i))
+           _dl_printf (" %s", _dl_hwcap_string (offset + i));
+       break;
+      }
     default:
       /* This should not happen.  */
       return -1;
     }
 
-  for (int i = first; i < count; ++i)
-    if (word & (1 << i))
-      _dl_printf (" %s", _dl_hwcap_string (str_offset + i));
-
   _dl_printf ("\n");
 
   return 0;