Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Pedro Franco de Carvalho <pedromfc@linux.ibm.com>,
	gdb-patches@sourceware.org
Cc: uweigand@de.ibm.com, edjunior@gmail.com
Subject: Re: [PATCH v5 12/12] [PowerPC] Add support for HTM registers
Date: Sat, 09 Feb 2019 05:51:00 -0000	[thread overview]
Message-ID: <d4b94047-ff61-69eb-e421-2a053484d52e@simark.ca> (raw)
In-Reply-To: <20181022223242.7858-13-pedromfc@linux.ibm.com>

On 2018-10-22 6:32 p.m., Pedro Franco de Carvalho wrote:
>  /* Write method for POWER7 Extended FP pseudo-registers.  */
>  static void
> -efpr_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
> +efp_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
>  			    int reg_nr, const gdb_byte *buffer)
>  {
>    struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
> -  int reg_index = reg_nr - tdep->ppc_efpr0_regnum;
> +  int reg_index, vr0;
>    int offset = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? 0 : 8;
>  
> +  if (IS_EFP_PSEUDOREG (tdep, reg_nr))
> +    {
> +      reg_index = reg_nr - tdep->ppc_efpr0_regnum;
> +      vr0 = PPC_VR0_REGNUM;
> +    }
> +  else
> +    {
> +      gdb_assert (IS_CEFP_PSEUDOREG (tdep, reg_nr));
> +
> +      reg_index = reg_nr - tdep->ppc_cefpr0_regnum;
> +      vr0 = PPC_CVR0_REGNUM;
> +
> +      /* The call to raw_write_part fails silently if the initial read
> +	 of the read-update-write sequence returns an invalid status,
> +	 so we check this manually and throw an error if needed.  */
> +      regcache->raw_update (vr0 + reg_index);
> +      if (regcache->get_register_status (vr0 + reg_index) != REG_VALID)
> +	error (_("Cannot write to the checkpointed EFP register, "
> +		 "the corresponding vector register is unavailable."));
> +    }
> +
>    /* Write the portion that overlaps the VMX register.  */
> -  regcache->raw_write_part (tdep->ppc_vr0_regnum + reg_index, offset,
> +  regcache->raw_write_part (vr0 + reg_index, offset,
>  			    register_size (gdbarch, reg_nr), buffer);
>  }

Hi Pedro,

I am trying to rebase this patch series [1], and I am having a small issue with
the code above.  I am introducing an abstraction layer on top of a regcache, so
that we are able to read and write registers from and to regcaches as well as from
and to frames.  The abstraction layer that replaces the regcache in this function
(register_readwrite) does not contain raw_update nor get_register_status.  I don't
think it would be right to add it, because it's quite specific to how the regcache
is implemented, so it would be a leaky abstraction.

From what I understand from the comment above, the problem is that raw_write_part
does not return any feedback.  Would it be fine to make raw_write_part return
a value (probably a bool) to say whether it succeeded, and replace the current
error handling code with a check of that return value?  Something like:

bool success = regcache->raw_write_part (vr0 + reg_index, offset,
					 register_size (gdbarch, reg_nr), buffer);
if (!success)
  error (_("Cannot write to the checkpointed EFP register, "
	   "the corresponding vector register is unavailable."));

Simon

[1] https://sourceware.org/ml/gdb-patches/2018-10/msg00532.html


  reply	other threads:[~2019-02-09  5:51 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-22 22:33 [PATCH v5 00/12] GDB support for more powerpc registers on linux Pedro Franco de Carvalho
2018-10-22 22:33 ` [PATCH v5 01/12] Zero-initialize linux note sections Pedro Franco de Carvalho
2018-10-22 22:33 ` [PATCH v5 02/12] [PowerPC] Don't zero-initialize vector register buffers Pedro Franco de Carvalho
2018-10-22 22:33 ` [PATCH v5 05/12] [PowerPC] Fix two if statements in gdb/ppc-linux-nat.c Pedro Franco de Carvalho
2018-10-22 22:33 ` [PATCH v5 07/12] [PowerPC] Refactor have_ initializers in rs6000-tdep.c Pedro Franco de Carvalho
2018-10-22 22:33 ` [PATCH v5 06/12] [PowerPC] Fix indentation in arch/ppc-linux-common.c Pedro Franco de Carvalho
2018-10-22 22:33 ` [PATCH v5 03/12] Add decfloat registers to float reggroup Pedro Franco de Carvalho
2018-10-22 22:33 ` [PATCH v5 04/12] [PowerPC] Remove rs6000_pseudo_register_reggroup_p Pedro Franco de Carvalho
2018-10-22 22:54 ` [PATCH v5 10/12] [PowerPC] Add support for EBB and PMU registers Pedro Franco de Carvalho
2018-10-22 22:56 ` [PATCH v5 11/12] [PowerPC] Reject tdescs with VSX and no FPU or Altivec Pedro Franco de Carvalho
2018-10-23 16:05   ` Pedro Alves
2018-10-23 18:46     ` Pedro Franco de Carvalho
2018-10-25 15:45       ` Pedro Alves
2018-10-22 22:58 ` [PATCH v5 09/12] [PowerPC] Add support for TAR Pedro Franco de Carvalho
2018-10-23  2:34   ` Eli Zaretskii
2018-10-23 18:50     ` Pedro Franco de Carvalho
2018-10-22 23:05 ` [PATCH v5 12/12] [PowerPC] Add support for HTM registers Pedro Franco de Carvalho
2019-02-09  5:51   ` Simon Marchi [this message]
2019-02-11 19:10     ` Pedro Franco de Carvalho
2018-10-22 23:16 ` [PATCH v5 08/12] [PowerPC] Add support for PPR and DSCR Pedro Franco de Carvalho
2018-10-23 15:37 ` [PATCH v5 00/12] GDB support for more powerpc registers on linux Pedro Alves
2018-10-23 18:42   ` Pedro Franco de Carvalho
2018-10-24 17:59     ` Ulrich Weigand
2018-10-25 20:05       ` Pedro Franco de Carvalho
2018-10-26 11:01         ` Ulrich Weigand
2018-10-26 10:57       ` Pedro Alves
2018-10-26 11:00         ` Ulrich Weigand
2018-10-26 15:16         ` Pedro Franco de Carvalho
2018-10-29 14:20           ` Regression on old kernels (Re: [PATCH v5 00/12] GDB support for more powerpc registers on linux) Ulrich Weigand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d4b94047-ff61-69eb-e421-2a053484d52e@simark.ca \
    --to=simark@simark.ca \
    --cc=edjunior@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedromfc@linux.ibm.com \
    --cc=uweigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox