aboutsummaryrefslogtreecommitdiff
path: root/gdb/ppc-linux-tdep.h
diff options
context:
space:
mode:
authorPedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>2018-05-22 11:09:05 -0300
committerPedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>2018-05-22 11:52:03 -0300
commit1d75a65809b49d41e97518b99c551a4bb2517500 (patch)
treefa78d1d569616d20b3ad13629d870d53bbc13a06 /gdb/ppc-linux-tdep.h
parentd078308a2ed1290e587b4365e2d7382d951a26af (diff)
downloadgdb-1d75a65809b49d41e97518b99c551a4bb2517500.zip
gdb-1d75a65809b49d41e97518b99c551a4bb2517500.tar.gz
gdb-1d75a65809b49d41e97518b99c551a4bb2517500.tar.bz2
[PowerPC] Fix access to VSCR in linux targets
The 4-byte VSCR register is found inside a 16-byte field in the regset returned by ptrace and in core files. The position of VSCR depends on the endianess of the target, which was previously assumed to be big-endian for the purpose of getting VSCR. This patch removes this assumption to fix access to VSCR in little-endian mode. gdb/ChangeLog: 2018-05-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com> * ppc-tdep.h (struct ppc_reg_offsets): Remove vector register offset fields. * ppc-fbsd-tdep.c (ppc32_fbsd_reg_offsets): Remove initializers for vector register offset fields. (ppc64_fbsd_reg_offsets): Likewise. * ppc-nbsd-tdep.c (_initialize_ppcnbsd_tdep): Remove assignment to vector register offset fields. * ppc-obsd-tdep.c (_initialize_ppcnbsd_tdep): Remove assignment to vector register offset fields. * ppc-obsd-nat.c (_initialize_ppcobsd_nat): Remove assignment to vector register offset fields. * rs6000-aix-tdep.c (rs6000_aix32_reg_offsets): Remove initializers for vector register offset fields. (rs6000_aix64_reg_offsets): Likewise. * rs6000-tdep.c (ppc_vrreg_offset): Remove. (ppc_supply_vrregset): Remove. (ppc_collect_vrregset): Remove. * ppc-linux-tdep.c (ppc_linux_collect_vrregset): New function. (ppc_linux_vrregset) : New function. (ppc32_le_linux_vrregmap, ppc32_be_linux_vrregmap) (ppc32_le_linux_vrregset, ppc32_be_linux_vrregset): New globals. (ppc32_linux_vrregset): Remove. (ppc_linux_iterate_over_regset_sections): Call ppc_linux_vrregset and use result instead of ppc32_linux_vrregset. (ppc32_linux_reg_offsets): Remove initializers for vector register offset fields. (ppc64_linux_reg_offsets): Likewise. * ppc-linux-tdep.h (ppc_linux_vrregset): New declaration. * ppc-linux-nat.c: Include regset.h. (gdb_vrregset_t): Adjust comment to account for little-endian mode. (supply_vrregset, fill_vrregset): Remove. (fetch_altivec_register, store_altivec_register): Remove. (fetch_altivec_registers): Add regno parameter. Get regset using ppc_linux_vrregset. Use regset to supply registers. (store_altivec_registers): Add regno parameter. Get regset using ppc_linux_vrregset. Use regset to collect registers. (fetch_register): Call fetch_altivec_registers instead of fetch_altivec_register. (store_register): Call store_altivec_registers instead of store_altivec_register. (fetch_ppc_registers): Call fetch_altivec_registers with -1 for the new regno parameter. (store_ppc_registers): Call store_altivec_registers with -1 for the new regno parameter. gdb/gdbserver/ChangeLog: 2018-05-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com> * linux-ppc-low.c (ppc_fill_vrregset): Add vscr_offset variable. Set vscr_offset to 0 in little-endian mode and 12 in big-endian mode. Call collect_register_by_name with vscr using vscr_offset. Zero-pad vscr and vrsave fields in collector buffer. (ppc_store_vrregset): Add and set vscr_offset variable as in ppc_fill_vrregset. Call supply_register_by_name with vscr using vscr_offset.
Diffstat (limited to 'gdb/ppc-linux-tdep.h')
-rw-r--r--gdb/ppc-linux-tdep.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/gdb/ppc-linux-tdep.h b/gdb/ppc-linux-tdep.h
index 5e7c4be..a8715bd 100644
--- a/gdb/ppc-linux-tdep.h
+++ b/gdb/ppc-linux-tdep.h
@@ -28,6 +28,9 @@ struct regset;
const struct regset *ppc_linux_gregset (int);
const struct regset *ppc_linux_fpregset (void);
+/* Get the vector regset that matches the target byte order. */
+const struct regset *ppc_linux_vrregset (struct gdbarch *gdbarch);
+
/* Extra register number constants. The Linux kernel stores a
"trap" code and the original value of r3 into special "registers";
these need to be saved and restored when performing an inferior