From 974c89e0882ddb03e294eca76a9e3d3bef90eacf Mon Sep 17 00:00:00 2001 From: Alan Hayward Date: Mon, 25 Mar 2019 10:44:11 +0000 Subject: 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. --- gdb/gdbserver/linux-arm-low.c | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) (limited to 'gdb/gdbserver/linux-arm-low.c') diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c index 8cad5c5..ff72a48 100644 --- a/gdb/gdbserver/linux-arm-low.c +++ b/gdb/gdbserver/linux-arm-low.c @@ -847,40 +847,15 @@ get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self) return next_pc; } -static int -arm_get_hwcap (unsigned long *valp) -{ - unsigned char *data = (unsigned char *) alloca (8); - int offset = 0; - - while ((*the_target->read_auxv) (offset, data, 8) == 8) - { - unsigned int *data_p = (unsigned int *)data; - if (data_p[0] == AT_HWCAP) - { - *valp = data_p[1]; - return 1; - } - - offset += 8; - } - - *valp = 0; - return 0; -} - static const struct target_desc * arm_read_description (void) { int pid = lwpid_of (current_thread); - unsigned long arm_hwcap = 0; + unsigned long arm_hwcap = linux_get_hwcap (4); /* Query hardware watchpoint/breakpoint capabilities. */ arm_linux_init_hwbp_cap (pid); - if (arm_get_hwcap (&arm_hwcap) == 0) - return tdesc_arm; - if (arm_hwcap & HWCAP_IWMMXT) return tdesc_arm_with_iwmmxt; -- cgit v1.1