qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH for-9.1] target/m68k: Always return a temporary from gen_lea_mode
@ 2024-08-13  0:07 Richard Henderson
  2024-08-13  8:40 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Henderson @ 2024-08-13  0:07 UTC (permalink / raw)
  To: qemu-devel

Returning a raw areg does not preserve the value if the areg
is subsequently modified.  Fixes, e.g. "jsr (sp)", where the
return address is pushed before the branch.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2483
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/m68k/translate.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/target/m68k/translate.c b/target/m68k/translate.c
index fb5ecce0c3..5e2be846b7 100644
--- a/target/m68k/translate.c
+++ b/target/m68k/translate.c
@@ -723,7 +723,9 @@ static TCGv gen_lea_mode(CPUM68KState *env, DisasContext *s,
         }
         /* fallthru */
     case 2: /* Indirect register */
-        return get_areg(s, reg0);
+        tmp = tcg_temp_new();
+        tcg_gen_mov_i32(tmp, get_areg(s, reg0));
+        return tmp;
     case 4: /* Indirect predecrememnt.  */
         if (opsize == OS_UNSIZED) {
             return NULL_QREG;
-- 
2.43.0



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

* Re: [PATCH for-9.1] target/m68k: Always return a temporary from gen_lea_mode
  2024-08-13  0:07 [PATCH for-9.1] target/m68k: Always return a temporary from gen_lea_mode Richard Henderson
@ 2024-08-13  8:40 ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-08-13  8:40 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel

On 13/8/24 02:07, Richard Henderson wrote:
> Returning a raw areg does not preserve the value if the areg
> is subsequently modified.  Fixes, e.g. "jsr (sp)", where the
> return address is pushed before the branch.
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2483
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/m68k/translate.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>




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

end of thread, other threads:[~2024-08-13  8:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-13  0:07 [PATCH for-9.1] target/m68k: Always return a temporary from gen_lea_mode Richard Henderson
2024-08-13  8:40 ` Philippe Mathieu-Daudé

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