about summary refs log tree commit diff
path: root/sysdeps/powerpc/dl-procinfo.h
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/powerpc/dl-procinfo.h')
-rw-r--r--sysdeps/powerpc/dl-procinfo.h50
1 files changed, 31 insertions, 19 deletions
diff --git a/sysdeps/powerpc/dl-procinfo.h b/sysdeps/powerpc/dl-procinfo.h
index f24a0c6f11..d9cd126722 100644
--- a/sysdeps/powerpc/dl-procinfo.h
+++ b/sysdeps/powerpc/dl-procinfo.h
@@ -20,18 +20,26 @@
 #define _DL_PROCINFO_H 1
 
 #include <ldsodefs.h>
-#include <sysdep.h>	/* This defines the PPC_FEATURE_* macros.  */
+#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
-#define _DL_HWCAP2_FIRST	32
-#define _DL_HWCAP_COUNT		32
+
+/* 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 \
 				+ PPC_FEATURE_HAS_DFP)
 
-#define _DL_PLATFORMS_COUNT	13
+#define _DL_PLATFORMS_COUNT	14
 
 #define _DL_FIRST_PLATFORM	32
 /* Mask to filter out platforms.  */
@@ -52,6 +60,7 @@
 #define PPC_PLATFORM_PPC440		10
 #define PPC_PLATFORM_PPC464		11
 #define PPC_PLATFORM_PPC476		12
+#define PPC_PLATFORM_POWER8		13
 
 static inline const char *
 __attribute__ ((unused))
@@ -112,6 +121,9 @@ _dl_string_platform (const char *str)
 	case '7':
 	  ret = _DL_FIRST_PLATFORM + PPC_PLATFORM_POWER7;
 	  break;
+	case '8':
+	  ret = _DL_FIRST_PLATFORM + PPC_PLATFORM_POWER8;
+	  break;
 	default:
 	  return -1;
 	}
@@ -159,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;