aboutsummaryrefslogtreecommitdiff
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.h53
1 files changed, 39 insertions, 14 deletions
diff --git a/sysdeps/powerpc/dl-procinfo.h b/sysdeps/powerpc/dl-procinfo.h
index 9531a2a..e7eeed9 100644
--- a/sysdeps/powerpc/dl-procinfo.h
+++ b/sysdeps/powerpc/dl-procinfo.h
@@ -20,11 +20,21 @@
#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, but they are bits 7..31. */
#define _DL_HWCAP_FIRST 7
-#define _DL_HWCAP_COUNT 32
+
+/* The total number of available bits (including those prior to
+ _DL_HWCAP_FIRST). Some of these bits might not be used. */
+#define _DL_HWCAP_COUNT 64
+
+/* Features started at bit 31 and decremented as new features were added. */
+#define _DL_HWCAP_LAST 31
+
+/* AT_HWCAP2 features started at bit 31 and decremented as new features were
+ added. HWCAP2 feature bits start at bit 0. */
+#define _DL_HWCAP2_LAST 31
/* These bits influence library search. */
#define HWCAP_IMPORTANT (PPC_FEATURE_HAS_ALTIVEC \
@@ -161,18 +171,33 @@ static inline int
__attribute__ ((unused))
_dl_procinfo (unsigned int type, unsigned long int word)
{
- /* Fallback to unknown output mechanism. */
- if (type == AT_HWCAP2)
- return -1;
-
- _dl_printf ("AT_HWCAP: ");
-
- for (int i = _DL_HWCAP_FIRST; i < _DL_HWCAP_COUNT; ++i)
- if (word & (1 << i))
- _dl_printf (" %s", _dl_hwcap_string (i));
-
- _dl_printf ("\n");
-
+ switch(type)
+ {
+ case AT_HWCAP:
+ _dl_printf ("AT_HWCAP: ");
+
+ 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:
+ {
+ unsigned int offset = _DL_HWCAP_LAST + 1;
+
+ _dl_printf ("AT_HWCAP2: ");
+
+ /* We have to go through them all because the kernel added the
+ AT_HWCAP2 features starting with the high bits. */
+ 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;
+ }
+ _dl_printf ("\n");
return 0;
}
#endif