aboutsummaryrefslogtreecommitdiff
path: root/gdb/rs6000-tdep.c
diff options
context:
space:
mode:
authorUlrich Weigand <ulrich.weigand@de.ibm.com>2014-02-04 18:31:38 +0100
committerUlrich Weigand <ulrich.weigand@de.ibm.com>2014-02-04 18:31:38 +0100
commit084ee54552f6c35d740e8b9bc81a4fe8d8bb178b (patch)
tree940b61622f650cb1032840e4c186383b3b15e2aa /gdb/rs6000-tdep.c
parent6ed14ff33979bc48367c35b1b235fef8c5e2229b (diff)
downloadgdb-084ee54552f6c35d740e8b9bc81a4fe8d8bb178b.zip
gdb-084ee54552f6c35d740e8b9bc81a4fe8d8bb178b.tar.gz
gdb-084ee54552f6c35d740e8b9bc81a4fe8d8bb178b.tar.bz2
PowerPC64 little-endian fixes: VSX tests and pseudo-regs
Many VSX test were failing on powerpc64le-linux, since -as opposed to the AltiVec tests- there never were little-endian versions of the test patterns. This patch adds such patterns, along the lines of altivec-regs.exp. In addition, there is an actual code change required: For those VSX registers that overlap a floating-point register, the FP register overlaps the most-significant half of the VSX register both on big- and little-endian systems. However, on little-endian systems, that half is stored at an offset of 8 bytes (not 0). This works already for the "real" FP registers, but current code gets it wrong for the "extended" pseudo FP register GDB generates for the second half of the VSX register bank. This patch updates the corresponding pseudo read/write routines to take the appropriate offset into consideration. gdb/ChangeLog: * rs6000-tdep.c (efpr_pseudo_register_read): Use correct offset of the overlapped FP register within the VSX register on little- endian platforms. (efpr_pseudo_register_write): Likewise. gdb/testsuite/ChangeLog: * gdb.arch/vsx-regs.exp: Check target endianness. Provide variants of the test patterns for use on little-endian systems.
Diffstat (limited to 'gdb/rs6000-tdep.c')
-rw-r--r--gdb/rs6000-tdep.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index d7416e5..adee085 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -2779,10 +2779,12 @@ efpr_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
int reg_index = reg_nr - tdep->ppc_efpr0_regnum;
+ int offset = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? 0 : 8;
/* Read the portion that overlaps the VMX register. */
- return regcache_raw_read_part (regcache, tdep->ppc_vr0_regnum + reg_index, 0,
- register_size (gdbarch, reg_nr), buffer);
+ return regcache_raw_read_part (regcache, tdep->ppc_vr0_regnum + reg_index,
+ offset, register_size (gdbarch, reg_nr),
+ buffer);
}
/* Write method for POWER7 Extended FP pseudo-registers. */
@@ -2792,10 +2794,12 @@ efpr_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
int reg_index = reg_nr - tdep->ppc_efpr0_regnum;
+ int offset = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? 0 : 8;
/* Write the portion that overlaps the VMX register. */
- regcache_raw_write_part (regcache, tdep->ppc_vr0_regnum + reg_index, 0,
- register_size (gdbarch, reg_nr), buffer);
+ regcache_raw_write_part (regcache, tdep->ppc_vr0_regnum + reg_index,
+ offset, register_size (gdbarch, reg_nr),
+ buffer);
}
static enum register_status