aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/powerpc/dl-procinfo.h
diff options
context:
space:
mode:
authorRyan S. Arnold <rsa@linux.vnet.ibm.com>2013-06-28 16:52:49 -0500
committerRyan S. Arnold <rsa@linux.vnet.ibm.com>2013-06-28 16:52:49 -0500
commit89cd956937f46e8f4a0374994965f991642dd408 (patch)
treefd9b8989857eeefe3a7573a3aa38d20c880eed55 /sysdeps/powerpc/dl-procinfo.h
parent1ae8bfe07c1ab2444cc1d186321ff1431a1b9f96 (diff)
downloadglibc-89cd956937f46e8f4a0374994965f991642dd408.tar
glibc-89cd956937f46e8f4a0374994965f991642dd408.tar.gz
glibc-89cd956937f46e8f4a0374994965f991642dd408.tar.bz2
glibc-89cd956937f46e8f4a0374994965f991642dd408.zip
PowerPC: Define AT_HWCAP2 bits and AT_HWCAP2 handling for POWER8.
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 9531a2acc7..e7eeed9d28 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