[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-9.0.4 15/57] target/m68k: Always return a temporary from gen_lea
From: |
Michael Tokarev |
Subject: |
[Stable-9.0.4 15/57] target/m68k: Always return a temporary from gen_lea_mode |
Date: |
Sat, 9 Nov 2024 15:07:17 +0300 |
From: Richard Henderson <richard.henderson@linaro.org>
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>
Message-Id: <20240813000737.228470-1-richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
(cherry picked from commit 352cc9f300d83ea48b8154bfd2ff985fece887d0)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/target/m68k/translate.c b/target/m68k/translate.c
index 8a194f2f21..f2420b92e1 100644
--- a/target/m68k/translate.c
+++ b/target/m68k/translate.c
@@ -722,7 +722,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;
@@ -749,20 +751,23 @@ static TCGv gen_lea_mode(CPUM68KState *env, DisasContext
*s,
switch (reg0) {
case 0: /* Absolute short. */
offset = (int16_t)read_im16(env, s);
- return tcg_constant_i32(offset);
+ break;
case 1: /* Absolute long. */
offset = read_im32(env, s);
- return tcg_constant_i32(offset);
+ break;
case 2: /* pc displacement */
offset = s->pc;
offset += (int16_t)read_im16(env, s);
- return tcg_constant_i32(offset);
+ break;
case 3: /* pc index+displacement. */
return gen_lea_indexed(env, s, NULL_QREG);
case 4: /* Immediate. */
default:
return NULL_QREG;
}
+ tmp = tcg_temp_new();
+ tcg_gen_movi_i32(tmp, offset);
+ return tmp;
}
/* Should never happen. */
return NULL_QREG;
--
2.39.5
- [Stable-9.0.4 04/57] target/ppc: Fix lxvx/stxvx facility check, (continued)
- [Stable-9.0.4 04/57] target/ppc: Fix lxvx/stxvx facility check, Michael Tokarev, 2024/11/09
- [Stable-9.0.4 05/57] hw/mips/jazz: fix typo in in-built NIC alias, Michael Tokarev, 2024/11/09
- [Stable-9.0.4 06/57] block/reqlist: allow adding overlapping requests, Michael Tokarev, 2024/11/09
- [Stable-9.0.4 07/57] target/arm: Avoid target_ulong for physical address lookups, Michael Tokarev, 2024/11/09
- [Stable-9.0.4 08/57] fuzz: disable leak-detection for oss-fuzz builds, Michael Tokarev, 2024/11/09
- [Stable-9.0.4 09/57] testing: bump mips64el cross to bookworm and fix package list, Michael Tokarev, 2024/11/09
- [Stable-9.0.4 10/57] vnc: fix crash when no console attached, Michael Tokarev, 2024/11/09
- [Stable-9.0.4 11/57] linux-user/flatload: Take mmap_lock in load_flt_binary(), Michael Tokarev, 2024/11/09
- [Stable-9.0.4 13/57] tcg/ppc: Use TCG_REG_TMP2 for scratch tcg_out_qemu_st, Michael Tokarev, 2024/11/09
- [Stable-9.0.4 12/57] linux-user: Fix parse_elf_properties GNU0_MAGIC check, Michael Tokarev, 2024/11/09
- [Stable-9.0.4 15/57] target/m68k: Always return a temporary from gen_lea_mode,
Michael Tokarev <=
- [Stable-9.0.4 14/57] tcg/ppc: Use TCG_REG_TMP2 for scratch index in prepare_host_addr, Michael Tokarev, 2024/11/09
- [Stable-9.0.4 16/57] hw/intc/arm_gicv3_cpuif: Add cast to match the documentation, Michael Tokarev, 2024/11/09
- [Stable-9.0.4 17/57] hw/audio/hda: free timer on exit, Michael Tokarev, 2024/11/09
- [Stable-9.0.4 18/57] ui/dbus: fix leak on message filtering, Michael Tokarev, 2024/11/09
- [Stable-9.0.4 19/57] ui/win32: fix potential use-after-free with dbus shared memory, Michael Tokarev, 2024/11/09
- [Stable-9.0.4 20/57] ui/dbus: fix filtering all update messages, Michael Tokarev, 2024/11/09
- [Stable-9.0.4 21/57] tcg/s390x: fix constraint for 32-bit TSTEQ/TSTNE, Michael Tokarev, 2024/11/09
- [Stable-9.0.4 23/57] tests: Wait for migration completion on destination QEMU to avoid failures, Michael Tokarev, 2024/11/09
- [Stable-9.0.4 24/57] Revert "hw/sh4/r2d: Realize IDE controller before accessing it", Michael Tokarev, 2024/11/09
- [Stable-9.0.4 25/57] tests/qemu-iotests/211.out: Update to expect MapEntry 'compressed' field, Michael Tokarev, 2024/11/09