diff options
Diffstat (limited to 'sysdeps/powerpc/dl-procinfo.h')
-rw-r--r-- | sysdeps/powerpc/dl-procinfo.h | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/sysdeps/powerpc/dl-procinfo.h b/sysdeps/powerpc/dl-procinfo.h index 3a5ce12c46..d9cd126722 100644 --- a/sysdeps/powerpc/dl-procinfo.h +++ b/sysdeps/powerpc/dl-procinfo.h @@ -22,13 +22,18 @@ #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; |