diff options
author | Alan Hayward <alan.hayward@arm.com> | 2019-03-25 10:44:11 +0000 |
---|---|---|
committer | Alan Hayward <alan.hayward@arm.com> | 2019-03-26 16:27:43 +0000 |
commit | 974c89e0882ddb03e294eca76a9e3d3bef90eacf (patch) | |
tree | b90e670ef3e07b1ca0f30c004eb5cd006077f7b5 /gdb/gdbserver/linux-s390-low.c | |
parent | 7ea79cb3affe1ae1d196f511ace044c015e0ccd3 (diff) | |
download | gdb-974c89e0882ddb03e294eca76a9e3d3bef90eacf.zip gdb-974c89e0882ddb03e294eca76a9e3d3bef90eacf.tar.gz gdb-974c89e0882ddb03e294eca76a9e3d3bef90eacf.tar.bz2 |
gdbserver: Add linux_get_hwcap
In gdbserver, Tidy up calls to read HWCAP (and HWCAP2) by adding common
functions, removing the Arm, AArch64, PPC and S390 specific versions.
No functionality differences.
gdb/gdbserver/ChangeLog:
* linux-aarch64-low.c (aarch64_get_hwcap): Remove function.
(aarch64_arch_setup): Call linux_get_hwcap.
* linux-arm-low.c (arm_get_hwcap): Remove function.
(arm_read_description): Call linux_get_hwcap.
* linux-low.c (linux_get_auxv): New function.
(linux_get_hwcap): Likewise.
(linux_get_hwcap2): Likewise.
* linux-low.h (linux_get_hwcap): New declaration.
(linux_get_hwcap2): Likewise.
* linux-ppc-low.c (ppc_get_auxv): Remove function.
(ppc_arch_setup): Call linux_get_hwcap.
* linux-s390-low.c (s390_get_hwcap): Remove function.
(s390_arch_setup): Call linux_get_hwcap.
Diffstat (limited to 'gdb/gdbserver/linux-s390-low.c')
-rw-r--r-- | gdb/gdbserver/linux-s390-low.c | 32 |
1 files changed, 1 insertions, 31 deletions
diff --git a/gdb/gdbserver/linux-s390-low.c b/gdb/gdbserver/linux-s390-low.c index edbef77..f65a1ec 100644 --- a/gdb/gdbserver/linux-s390-low.c +++ b/gdb/gdbserver/linux-s390-low.c @@ -467,36 +467,6 @@ s390_set_pc (struct regcache *regcache, CORE_ADDR newpc) } } -/* Get HWCAP from AUXV, using the given WORDSIZE. Return the HWCAP, or - zero if not found. */ - -static unsigned long -s390_get_hwcap (int wordsize) -{ - gdb_byte *data = (gdb_byte *) alloca (2 * wordsize); - int offset = 0; - - while ((*the_target->read_auxv) (offset, data, 2 * wordsize) == 2 * wordsize) - { - if (wordsize == 4) - { - unsigned int *data_p = (unsigned int *)data; - if (data_p[0] == AT_HWCAP) - return data_p[1]; - } - else - { - unsigned long *data_p = (unsigned long *)data; - if (data_p[0] == AT_HWCAP) - return data_p[1]; - } - - offset += 2 * wordsize; - } - - return 0; -} - /* Determine the word size for the given PID, in bytes. */ #ifdef __s390x__ @@ -548,7 +518,7 @@ s390_arch_setup (void) /* Determine word size and HWCAP. */ int pid = pid_of (current_thread); int wordsize = s390_get_wordsize (pid); - unsigned long hwcap = s390_get_hwcap (wordsize); + unsigned long hwcap = linux_get_hwcap (wordsize); /* Check whether the kernel supports extra register sets. */ int have_regset_last_break |