target/ppc: introduce do_ea_calc
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. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Fernando Eckhardt Valle (pherde) <phervalle@gmail.com> Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br> Message-Id: <20211029202424.175401-2-matheus.ferst@eldorado.org.br> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
114f3c8cc4
commit
eb63efd9f6
@ -3197,6 +3197,20 @@ static inline void gen_align_no_le(DisasContext *ctx)
|
||||
(ctx->opcode & 0x03FF0000) | POWERPC_EXCP_ALIGN_LE);
|
||||
}
|
||||
|
||||
static TCGv do_ea_calc(DisasContext *ctx, int ra, TCGv displ)
|
||||
{
|
||||
TCGv 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);
|
||||
}
|
||||
return 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))
|
||||
|
@ -51,15 +51,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);
|
||||
}
|
||||
ea = do_ea_calc(ctx, ra, displ);
|
||||
mop ^= ctx->default_tcg_memop_mask;
|
||||
if (store) {
|
||||
tcg_gen_qemu_st_tl(cpu_gpr[rt], ea, ctx->mem_idx, mop);
|
||||
|
Loading…
Reference in New Issue
Block a user