qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tcg/arm: Fix goto_tb for large translation blocks
@ 2024-02-12 21:56 Richard Henderson
  2024-02-13  7:54 ` Michael Tokarev
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Henderson @ 2024-02-12 21:56 UTC (permalink / raw)
  To: qemu-devel

Correct arithmetic for separating high and low
on a large negative number.

Fixes: 79ffece4447 ("tcg/arm: Implement direct branch for goto_tb")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1714
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 tcg/arm/tcg-target.c.inc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc
index ffd23ef789..6a04c73c76 100644
--- a/tcg/arm/tcg-target.c.inc
+++ b/tcg/arm/tcg-target.c.inc
@@ -1771,9 +1771,9 @@ static void tcg_out_goto_tb(TCGContext *s, int which)
          * shifted immediate from pc.
          */
         int h = -i_disp;
-        int l = h & 0xfff;
+        int l = -(h & 0xfff);
 
-        h = encode_imm_nofail(h - l);
+        h = encode_imm_nofail(h + l);
         tcg_out_dat_imm(s, COND_AL, ARITH_SUB, TCG_REG_R0, TCG_REG_PC, h);
         tcg_out_ld32_12(s, COND_AL, TCG_REG_PC, TCG_REG_R0, l);
     }
-- 
2.34.1



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

* Re: [PATCH] tcg/arm: Fix goto_tb for large translation blocks
  2024-02-12 21:56 [PATCH] tcg/arm: Fix goto_tb for large translation blocks Richard Henderson
@ 2024-02-13  7:54 ` Michael Tokarev
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Tokarev @ 2024-02-13  7:54 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel; +Cc: qemu-stable

13.02.2024 00:56, Richard Henderson:
> Correct arithmetic for separating high and low
> on a large negative number.
> 
> Fixes: 79ffece4447 ("tcg/arm: Implement direct branch for goto_tb")
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1714
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Cc: qemu-stable@
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>

> ---
>   tcg/arm/tcg-target.c.inc | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc
> index ffd23ef789..6a04c73c76 100644
> --- a/tcg/arm/tcg-target.c.inc
> +++ b/tcg/arm/tcg-target.c.inc
> @@ -1771,9 +1771,9 @@ static void tcg_out_goto_tb(TCGContext *s, int which)
>            * shifted immediate from pc.
>            */
>           int h = -i_disp;
> -        int l = h & 0xfff;
> +        int l = -(h & 0xfff);
>   
> -        h = encode_imm_nofail(h - l);
> +        h = encode_imm_nofail(h + l);
>           tcg_out_dat_imm(s, COND_AL, ARITH_SUB, TCG_REG_R0, TCG_REG_PC, h);
>           tcg_out_ld32_12(s, COND_AL, TCG_REG_PC, TCG_REG_R0, l);
>       }



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

end of thread, other threads:[~2024-02-13  7:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-12 21:56 [PATCH] tcg/arm: Fix goto_tb for large translation blocks Richard Henderson
2024-02-13  7:54 ` Michael Tokarev

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).