Re: [RFA] Fix Power7 extended floating point pseudo-registers

Ulrich Weigand
2011-02-14T13:47:57Z

Thiago Jung Bauermann wrote:

> 2011-02-09 Thiago Jung Bauermann <bauerman@br.ibm.com>
>
> gdb/
> * rs6000-tdep.c (IS_EFP_PSEUDOREG): Use correct constant for
> the EFP register set size.
> (efpr_pseudo_register_read): Use intermediary buffer to read
> data from the VMX register.
> (efpr_pseudo_register_write): Use intermediary buffer to read
> and write data from/to the VMX register.
>
> gdb/testsuite/
> * gdb.arch/vsx-regs.exp: Add "vector_register1_vr" and
> "vector_register2_vr" test strings. Test the extended floating
> point registers (F32~F63).
> * lib/gdb.exp (skip_vsx_tests): Update compile flags for the
> IBM XL C compiler. Make the test program use a register provided
> by the compiler for the lxvd2x instruction.

This looks good to me, except:

> @@ -2720,10 +2720,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 vr_reg_nr = tdep->ppc_vr0_regnum + reg_index;
> + gdb_byte vr_reg_buf[MAX_REGISTER_SIZE];
>
> - /* Read the portion that overlaps the VMX registers. */
> - regcache_raw_read (regcache, tdep->ppc_vr0_regnum +
> - reg_index, buffer);
> + /* Read the portion that overlaps the VMX register. */
> + regcache_raw_read (regcache, vr_reg_nr, vr_reg_buf);
> + memcpy (buffer, vr_reg_buf, register_size (gdbarch, reg_nr));
> }

This just re-implements regcache_raw_read_part, doesn't it? You should
be just using that routine instead (and likewise for _write).

Bye,
Ulrich

--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com