From d078308a2ed1290e587b4365e2d7382d951a26af Mon Sep 17 00:00:00 2001 From: Pedro Franco de Carvalho Date: Tue, 22 May 2018 11:09:05 -0300 Subject: [PowerPC] Consolidate linux vector regset sizes This patch defines constants for the sizes of the two vector regsets (vector-scalar registers and regular vector registers). The native, gdbserver and core file targets are changed to use these constants. The Linux ptrace calls return (or read) a smaller regset than the one found in core files for vector registers, because ptrace uses a single 4-byte quantity for vrsave at the end of the regset, while the core-file regset uses a full 16-byte field for vrsave. For simplicity, the larger size is used in both cases, and so a buffer with 12 unused additional bytes is passed to ptrace in the native target. gdb/ChangeLog: 2018-05-22 Pedro Franco de Carvalho * arch/ppc-linux-common.h (PPC_LINUX_SIZEOF_VRREGSET) (PPC_LINUX_SIZEOF_VSXREGSET): Define. * ppc-linux-nat.c (SIZEOF_VSXREGS, SIZEOF_VRREGS): Remove. (gdb_vrregset_t): Change array type size to PPC_LINUX_SIZEOF_VRREGSET. (gdb_vsxregset_t): Change array type size to PPC_LINUX_SIZEOF_VSXREGSET. * ppc-linux-tdep.c (ppc_linux_iterate_over_regset_sections): Change integer literals to PPC_LINUX_SIZEOF_VRREGSET and PPC_LINUX_SIZEOF_VSXREGSET. gdb/gdbserver/ChangeLog: 2018-05-22 Pedro Franco de Carvalho * linux-ppc-low.c (SIZEOF_VSXREGS, SIZEOF_VRREGS): Remove. (ppc_arch_setup): Change SIZEOF_VRREGS and SIZEOF_VSXREGS to PPC_LINUX_SIZEOF_VRREGSET and PPC_LINUX_SIZEOF_VSXREGSET. --- gdb/arch/ppc-linux-common.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'gdb/arch') diff --git a/gdb/arch/ppc-linux-common.h b/gdb/arch/ppc-linux-common.h index b82adc4..798781c 100644 --- a/gdb/arch/ppc-linux-common.h +++ b/gdb/arch/ppc-linux-common.h @@ -22,6 +22,15 @@ struct target_desc; +/* The core file VMX regset has 34 16-byte fields (32 16-byte vector + registers, plus two fields containing 4-byte registers, VSCR and + VRSAVE), while the ptrace calls return or read 33 16-byte fields + plus a 4-byte field for VRSAVE. For simplicity we use the longer + length for both cases. */ +#define PPC_LINUX_SIZEOF_VRREGSET 544 + +#define PPC_LINUX_SIZEOF_VSXREGSET 256 + /* Check if the hwcap auxv entry indicates that isa205 is supported. */ bool ppc_linux_has_isa205 (unsigned long hwcap); -- cgit v1.1