All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/2] target/hppa updates
@ 2019-03-08  1:58 Richard Henderson
  2019-03-08  1:58 ` [Qemu-devel] [PULL 1/2] target/hppa: Do not return freed temporary Richard Henderson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Richard Henderson @ 2019-03-08  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell

The following changes since commit 6cb4f6db4f4367faa33da85b15f75bbbd2bed2a6:

  Merge remote-tracking branch 'remotes/cleber/tags/python-next-pull-request' into staging (2019-03-07 16:16:02 +0000)

are available in the Git repository at:

  https://github.com/rth7680/qemu.git tags/pull-hppa-20190307

for you to fetch changes up to b35aec8597e86911d5553c94769f914a52a8b389:

  target/hppa: Optimize blr r0,rn (2019-03-07 17:43:12 -0800)

----------------------------------------------------------------
Fix use after free on temporary.
Optmize branch to next insn via br r0.

----------------------------------------------------------------
Richard Henderson (2):
      target/hppa: Do not return freed temporary
      target/hppa: Optimize blr r0,rn

 target/hppa/translate.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PULL 1/2] target/hppa: Do not return freed temporary
  2019-03-08  1:58 [Qemu-devel] [PULL 0/2] target/hppa updates Richard Henderson
@ 2019-03-08  1:58 ` Richard Henderson
  2019-03-08  1:58 ` [Qemu-devel] [PULL 2/2] target/hppa: Optimize blr r0,rn Richard Henderson
  2019-03-08 16:28 ` [Qemu-devel] [PULL 0/2] target/hppa updates Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2019-03-08  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell

For priv levels 1 & 2, we were doing so from do_ibranch_priv.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/hppa/translate.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/target/hppa/translate.c b/target/hppa/translate.c
index b4fd307b77..dad8ce563c 100644
--- a/target/hppa/translate.c
+++ b/target/hppa/translate.c
@@ -2007,16 +2007,15 @@ static TCGv_reg do_ibranch_priv(DisasContext *ctx, TCGv_reg offset)
         /* Privilege 0 is maximum and is allowed to decrease.  */
         return offset;
     case 3:
-        /* Privilege 3 is minimum and is never allowed increase.  */
+        /* Privilege 3 is minimum and is never allowed to increase.  */
         dest = get_temp(ctx);
         tcg_gen_ori_reg(dest, offset, 3);
         break;
     default:
-        dest = tcg_temp_new();
+        dest = get_temp(ctx);
         tcg_gen_andi_reg(dest, offset, -4);
         tcg_gen_ori_reg(dest, dest, ctx->privilege);
         tcg_gen_movcond_reg(TCG_COND_GTU, dest, dest, offset, dest, offset);
-        tcg_temp_free(dest);
         break;
     }
     return dest;
-- 
2.17.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PULL 2/2] target/hppa: Optimize blr r0,rn
  2019-03-08  1:58 [Qemu-devel] [PULL 0/2] target/hppa updates Richard Henderson
  2019-03-08  1:58 ` [Qemu-devel] [PULL 1/2] target/hppa: Do not return freed temporary Richard Henderson
@ 2019-03-08  1:58 ` Richard Henderson
  2019-03-08 16:28 ` [Qemu-devel] [PULL 0/2] target/hppa updates Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2019-03-08  1:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell

We can eliminate an extra TB in this case, which merely
loads a "return address" into rn.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/hppa/translate.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/target/hppa/translate.c b/target/hppa/translate.c
index dad8ce563c..dc5636fe94 100644
--- a/target/hppa/translate.c
+++ b/target/hppa/translate.c
@@ -3488,12 +3488,16 @@ static bool trans_b_gate(DisasContext *ctx, arg_b_gate *a)
 
 static bool trans_blr(DisasContext *ctx, arg_blr *a)
 {
-    TCGv_reg tmp = get_temp(ctx);
-
-    tcg_gen_shli_reg(tmp, load_gpr(ctx, a->x), 3);
-    tcg_gen_addi_reg(tmp, tmp, ctx->iaoq_f + 8);
-    /* The computation here never changes privilege level.  */
-    return do_ibranch(ctx, tmp, a->l, a->n);
+    if (a->x) {
+        TCGv_reg tmp = get_temp(ctx);
+        tcg_gen_shli_reg(tmp, load_gpr(ctx, a->x), 3);
+        tcg_gen_addi_reg(tmp, tmp, ctx->iaoq_f + 8);
+        /* The computation here never changes privilege level.  */
+        return do_ibranch(ctx, tmp, a->l, a->n);
+    } else {
+        /* BLR R0,RX is a good way to load PC+8 into RX.  */
+        return do_dbranch(ctx, ctx->iaoq_f + 8, a->l, a->n);
+    }
 }
 
 static bool trans_bv(DisasContext *ctx, arg_bv *a)
-- 
2.17.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PULL 0/2] target/hppa updates
  2019-03-08  1:58 [Qemu-devel] [PULL 0/2] target/hppa updates Richard Henderson
  2019-03-08  1:58 ` [Qemu-devel] [PULL 1/2] target/hppa: Do not return freed temporary Richard Henderson
  2019-03-08  1:58 ` [Qemu-devel] [PULL 2/2] target/hppa: Optimize blr r0,rn Richard Henderson
@ 2019-03-08 16:28 ` Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2019-03-08 16:28 UTC (permalink / raw)
  To: Richard Henderson; +Cc: QEMU Developers

On Fri, 8 Mar 2019 at 01:58, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> The following changes since commit 6cb4f6db4f4367faa33da85b15f75bbbd2bed2a6:
>
>   Merge remote-tracking branch 'remotes/cleber/tags/python-next-pull-request' into staging (2019-03-07 16:16:02 +0000)
>
> are available in the Git repository at:
>
>   https://github.com/rth7680/qemu.git tags/pull-hppa-20190307
>
> for you to fetch changes up to b35aec8597e86911d5553c94769f914a52a8b389:
>
>   target/hppa: Optimize blr r0,rn (2019-03-07 17:43:12 -0800)
>
> ----------------------------------------------------------------
> Fix use after free on temporary.
> Optmize branch to next insn via br r0.
>

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/4.0
for any user-visible changes.

-- PMM

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-03-08 16:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-08  1:58 [Qemu-devel] [PULL 0/2] target/hppa updates Richard Henderson
2019-03-08  1:58 ` [Qemu-devel] [PULL 1/2] target/hppa: Do not return freed temporary Richard Henderson
2019-03-08  1:58 ` [Qemu-devel] [PULL 2/2] target/hppa: Optimize blr r0,rn Richard Henderson
2019-03-08 16:28 ` [Qemu-devel] [PULL 0/2] target/hppa updates Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.