gen_callr wrote the link register before consuming the target, so "callr r31" jumped to the new return address instead of the old LR value. Copy the target to a temporary first.
Reviewed-by: Pierrick Bouvier <[email protected]> Reviewed-by: Marco Liebel <[email protected]> Signed-off-by: Brian Cain <[email protected]> --- target/hexagon/genptr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/hexagon/genptr.c b/target/hexagon/genptr.c index d234f994f46..f1d0529d0c8 100644 --- a/target/hexagon/genptr.c +++ b/target/hexagon/genptr.c @@ -1059,6 +1059,8 @@ static void gen_call(DisasContext *ctx, int pc_off) static void gen_callr(DisasContext *ctx, TCGv new_pc) { TCGv lr = get_result_gpr(ctx, HEX_REG_LR); + + new_pc = gen_unalias_gpr_src(new_pc, lr); tcg_gen_movi_tl(lr, ctx->next_PC); gen_write_new_pc_addr(ctx, new_pc, TCG_COND_ALWAYS, NULL); } -- 2.34.1
