Message ID | 20240813000737.228470-1-richard.henderson@linaro.org |
---|---|
State | New |
Headers | show |
Series | [for-9.1] target/m68k: Always return a temporary from gen_lea_mode | expand |
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>
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;
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(-)