diff options
author | Ryan S. Arnold <rsa@linux.vnet.ibm.com> | 2013-06-28 16:52:49 -0500 |
---|---|---|
committer | Ryan S. Arnold <rsa@linux.vnet.ibm.com> | 2013-06-28 16:52:49 -0500 |
commit | 89cd956937f46e8f4a0374994965f991642dd408 (patch) | |
tree | fd9b8989857eeefe3a7573a3aa38d20c880eed55 | |
parent | 1ae8bfe07c1ab2444cc1d186321ff1431a1b9f96 (diff) | |
download | glibc-89cd956937f46e8f4a0374994965f991642dd408.tar glibc-89cd956937f46e8f4a0374994965f991642dd408.tar.gz glibc-89cd956937f46e8f4a0374994965f991642dd408.tar.bz2 glibc-89cd956937f46e8f4a0374994965f991642dd408.zip |
PowerPC: Define AT_HWCAP2 bits and AT_HWCAP2 handling for POWER8.
-rw-r--r-- | ChangeLog | 18 | ||||
-rw-r--r-- | sysdeps/powerpc/Makefile | 2 | ||||
-rw-r--r-- | sysdeps/powerpc/bits/hwcap.h | 23 | ||||
-rw-r--r-- | sysdeps/powerpc/dl-procinfo.c | 10 | ||||
-rw-r--r-- | sysdeps/powerpc/dl-procinfo.h | 53 | ||||
-rw-r--r-- | sysdeps/powerpc/rtld-global-offsets.sym | 1 |
6 files changed, 85 insertions, 22 deletions
@@ -1,5 +1,23 @@ 2013-06-28 Ryan S. Arnold <rsa@linux.vnet.ibm.com> + * sysdeps/powerpc/Makefile: Add comment about generating an offset to + rtld_global._dl_hwcap2. + * sysdeps/powerpc/bits/hwcap.h: Added PPC_FEATURE2_* definitions for + POWER8. + * sysdeps/powerpc/dl-procinfo.c (_dl_powerpc_cap_flags): Extend for + POWER8 feature descriptions defined in _dl_hwcap2. + * sysdeps/powerpc/dl-procinfo.h (_dl_procinfo): Implement AT_HWCAP2 + string handling for POWER8 feature bits. + (_DL_HWCAP_COUNT): Increment to 64 to cover AT_HWCAP2 bits. + (_DL_HWCAP_LAST): New definition for position of last AT_HWCAP bit in + _dl_powerpc_cap_flags. + (_DL_HWCAP2_LAST): New definition for last usable bit of AT_HWCAP2. + * sysdeps/powerpc/rtld-global-offsets.sym + (RTLD_GLOBAL_RO_DL_HWCAP2_OFFSET): New offset macro to locate + _dl_hwcap2 in the rtld_global_ro structure. + +2013-06-28 Ryan S. Arnold <rsa@linux.vnet.ibm.com> + * elf/dl-support.c (_dl_hwcap2): Add a new hwcap field for more hardware capabilities in support of AT_HWCAP2. (_dl_aux_init): Read AT_HWCAP2 into GLRO(dl_hwcap2). diff --git a/sysdeps/powerpc/Makefile b/sysdeps/powerpc/Makefile index 7442b6709a..f75e62523c 100644 --- a/sysdeps/powerpc/Makefile +++ b/sysdeps/powerpc/Makefile @@ -17,7 +17,7 @@ endif endif ifeq ($(subdir),csu) -# get offset to rtld_global._dl_hwcap +# get offset to rtld_global._dl_hwcap and rtld_global._dl_hwcap2 gen-as-const-headers += rtld-global-offsets.sym # get offset to __locale_struct.__ctype_tolower gen-as-const-headers += locale-defines.sym diff --git a/sysdeps/powerpc/bits/hwcap.h b/sysdeps/powerpc/bits/hwcap.h index 783138a0e6..0c02fc68e8 100644 --- a/sysdeps/powerpc/bits/hwcap.h +++ b/sysdeps/powerpc/bits/hwcap.h @@ -1,4 +1,4 @@ -/* Defines for bits in AT_HWCAP. +/* Defines for bits in AT_HWCAP and AT_HWCAP2. Copyright (C) 2012-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -20,9 +20,9 @@ # error "Never include <bits/hwcap.h> directly; use <sys/auxv.h> instead." #endif -/* - * The following must match the kernels asm/cputable.h. - */ +/* The bit numbers must match those in the kernel's asm/cputable.h. */ + +/* Feature definitions in AT_HWCAP. */ #define PPC_FEATURE_32 0x80000000 /* 32-bit mode. */ #define PPC_FEATURE_64 0x40000000 /* 64-bit mode. */ #define PPC_FEATURE_601_INSTR 0x20000000 /* 601 chip, Old POWER ISA. */ @@ -39,8 +39,9 @@ #define PPC_FEATURE_POWER5 0x00040000 /* POWER5 ISA 2.02 */ #define PPC_FEATURE_POWER5_PLUS 0x00020000 /* POWER5+ ISA 2.03 */ #define PPC_FEATURE_CELL_BE 0x00010000 /* CELL Broadband Engine */ -#define PPC_FEATURE_BOOKE 0x00008000 -#define PPC_FEATURE_SMT 0x00004000 /* Simultaneous Multi-Threading */ +#define PPC_FEATURE_BOOKE 0x00008000 /* ISA Category Embedded */ +#define PPC_FEATURE_SMT 0x00004000 /* Simultaneous + Multi-Threading */ #define PPC_FEATURE_ICACHE_SNOOP 0x00002000 #define PPC_FEATURE_ARCH_2_05 0x00001000 /* ISA 2.05 */ #define PPC_FEATURE_PA6T 0x00000800 /* PA Semi 6T Core */ @@ -51,3 +52,13 @@ #define PPC_FEATURE_PSERIES_PERFMON_COMPAT 0x00000040 #define PPC_FEATURE_TRUE_LE 0x00000002 #define PPC_FEATURE_PPC_LE 0x00000001 + +/* Feature definitions in AT_HWCAP2. */ +#define PPC_FEATURE2_ARCH_2_07 0x80000000 /* ISA 2.07 */ +#define PPC_FEATURE2_HAS_HTM 0x40000000 /* Hardware Transactional + Memory */ +#define PPC_FEATURE2_HAS_DSCR 0x20000000 /* Data Stream Control + Register */ +#define PPC_FEATURE2_HAS_EBB 0x10000000 /* Event Base Branching */ +#define PPC_FEATURE2_HAS_ISEL 0x08000000 /* Integer Select */ +#define PPC_FEATURE2_HAS_TAR 0x04000000 /* Target Address Register */ diff --git a/sysdeps/powerpc/dl-procinfo.c b/sysdeps/powerpc/dl-procinfo.c index 96549844eb..2984af197c 100644 --- a/sysdeps/powerpc/dl-procinfo.c +++ b/sysdeps/powerpc/dl-procinfo.c @@ -45,7 +45,7 @@ #if !defined PROCINFO_DECL && defined SHARED ._dl_powerpc_cap_flags #else -PROCINFO_CLASS const char _dl_powerpc_cap_flags[25][10] +PROCINFO_CLASS const char _dl_powerpc_cap_flags[57][10] #endif #ifndef PROCINFO_DECL = { @@ -56,6 +56,14 @@ PROCINFO_CLASS const char _dl_powerpc_cap_flags[25][10] "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 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 diff --git a/sysdeps/powerpc/rtld-global-offsets.sym b/sysdeps/powerpc/rtld-global-offsets.sym index ff4e97f2a6..f5ea5a1466 100644 --- a/sysdeps/powerpc/rtld-global-offsets.sym +++ b/sysdeps/powerpc/rtld-global-offsets.sym @@ -5,3 +5,4 @@ #define rtld_global_ro_offsetof(mem) offsetof (struct rtld_global_ro, mem) RTLD_GLOBAL_RO_DL_HWCAP_OFFSET rtld_global_ro_offsetof (_dl_hwcap) +RTLD_GLOBAL_RO_DL_HWCAP2_OFFSET rtld_global_ro_offsetof (_dl_hwcap2) |