qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Sven Schnelle <svens@stackframe.org>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: Helge Deller <deller@gmx.de>,
	Richard Henderson <richard.henderson@linaro.org>,
	qemu-devel@nongnu.org, Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH 2/2] target/hppa: prevent trashing of temporary in do_depw_sar()
Date: Fri, 13 Sep 2019 13:08:00 +0200	[thread overview]
Message-ID: <20190913110800.GA10636@stackframe.org> (raw)
In-Reply-To: <01208241-04a5-0db6-f941-ff9cbc64440f@redhat.com>

Hi Philippe,

On Fri, Sep 13, 2019 at 12:58:14PM +0200, Philippe Mathieu-Daudé wrote:
> Hi Sven,
> 
> On 9/13/19 12:17 PM, Sven Schnelle wrote:
> > nullify_over() calls brcond which destroys all temporaries.
> > 
> > Signed-off-by: Sven Schnelle <svens@stackframe.org>
> > ---
> >  target/hppa/translate.c | 10 ++++++----
> >  1 file changed, 6 insertions(+), 4 deletions(-)
> > 
> > diff --git a/target/hppa/translate.c b/target/hppa/translate.c
> > index b12525d535..c1b2822f60 100644
> > --- a/target/hppa/translate.c
> > +++ b/target/hppa/translate.c
> > @@ -3404,10 +3404,6 @@ static bool do_depw_sar(DisasContext *ctx, unsigned rt, unsigned c,
> >      TCGv_reg mask, tmp, shift, dest;
> >      unsigned msb = 1U << (len - 1);
> >  
> > -    if (c) {
> > -        nullify_over(ctx);
> > -    }
> > -
> >      dest = dest_gpr(ctx, rt);
> >      shift = tcg_temp_new();
> >      tmp = tcg_temp_new();
> > @@ -3440,11 +3436,17 @@ static bool do_depw_sar(DisasContext *ctx, unsigned rt, unsigned c,
> >  
> >  static bool trans_depw_sar(DisasContext *ctx, arg_depw_sar *a)
> >  {
> > +    if (a->c) {
> > +        nullify_over(ctx);
> > +    }
> >      return do_depw_sar(ctx, a->t, a->c, a->nz, a->clen, load_gpr(ctx, a->r));
> >  }
> >  
> >  static bool trans_depwi_sar(DisasContext *ctx, arg_depwi_sar *a)
> >  {
> > +    if (a->c) {
> > +        nullify_over(ctx);
> > +    }
> 
> I don't see how this patch helps or change anything, isn't it the same?
> You clean in the caller rather than the callee.

The Problem is that load_gpr()/load_const() allocate a temporary, which
gets destroyed in do_depw_sar() when nullify_over() is called. If we
move the nullify_over() before doing the load_gpr()/load_const() this
doesn't happen.

> >      return do_depw_sar(ctx, a->t, a->c, a->nz, a->clen, load_const(ctx, a->i));
> >  }
> >  
> >

Regards
Sven


  reply	other threads:[~2019-09-13 11:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-13 10:17 [Qemu-devel] [PATCH 0/2] HPPA tcg fixes Sven Schnelle
2019-09-13 10:17 ` [Qemu-devel] [PATCH 1/2] target/hppa: prevent trashing of temporary in trans_mtctl() Sven Schnelle
2019-09-13 10:17 ` [Qemu-devel] [PATCH 2/2] target/hppa: prevent trashing of temporary in do_depw_sar() Sven Schnelle
2019-09-13 10:58   ` Philippe Mathieu-Daudé
2019-09-13 11:08     ` Sven Schnelle [this message]
2019-09-13 11:16       ` Philippe Mathieu-Daudé
2019-09-13 18:13 ` [Qemu-devel] [PATCH 0/2] HPPA tcg fixes Richard Henderson

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=20190913110800.GA10636@stackframe.org \
    --to=svens@stackframe.org \
    --cc=deller@gmx.de \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=rth@twiddle.net \
    /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;
as well as URLs for NNTP newsgroup(s).