From: pherde <pherva...@gmail.com> The do_ea_calc function will calculate the effective address(EA) according to PowerIsa 3.1. With that, it was replaced part of do_ldst() that calculates the EA by this new function.
Signed-off-by: Fernando Eckhardt Valle (pherde) <pherva...@gmail.com> Signed-off-by: Matheus Ferst <matheus.fe...@eldorado.org.br> --- target/ppc/translate.c | 12 ++++++++++++ target/ppc/translate/fixedpoint-impl.c.inc | 9 +-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 62414adb75..bb8edd9d8f 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -3197,6 +3197,18 @@ static inline void gen_align_no_le(DisasContext *ctx) (ctx->opcode & 0x03FF0000) | POWERPC_EXCP_ALIGN_LE); } +static inline void do_ea_calc(DisasContext *ctx, int ra, TCGv displ, TCGv ea) +{ + if (ra) { + tcg_gen_add_tl(ea, cpu_gpr[ra], displ); + } else { + tcg_gen_mov_tl(ea, displ); + } + if (NARROW_MODE(ctx)) { + tcg_gen_ext32u_tl(ea, ea); + } +} + /*** Integer load ***/ #define DEF_MEMOP(op) ((op) | ctx->default_tcg_memop_mask) #define BSWAP_MEMOP(op) ((op) | (ctx->default_tcg_memop_mask ^ MO_BSWAP)) diff --git a/target/ppc/translate/fixedpoint-impl.c.inc b/target/ppc/translate/fixedpoint-impl.c.inc index 2e2518ee15..53d8fbdcfe 100644 --- a/target/ppc/translate/fixedpoint-impl.c.inc +++ b/target/ppc/translate/fixedpoint-impl.c.inc @@ -52,14 +52,7 @@ static bool do_ldst(DisasContext *ctx, int rt, int ra, TCGv displ, bool update, gen_set_access_type(ctx, ACCESS_INT); ea = tcg_temp_new(); - if (ra) { - tcg_gen_add_tl(ea, cpu_gpr[ra], displ); - } else { - tcg_gen_mov_tl(ea, displ); - } - if (NARROW_MODE(ctx)) { - tcg_gen_ext32u_tl(ea, ea); - } + do_ea_calc(ctx, ra, displ, ea); mop ^= ctx->default_tcg_memop_mask; if (store) { tcg_gen_qemu_st_tl(cpu_gpr[rt], ea, ctx->mem_idx, mop); -- 2.25.1