In preparation of removing the cpu_ldl_code wrapper, inline it.
Get the runtime endianness with mo_endian_env(), passing it
to cpu_ldl_code_mmu(). No need to swap versus qemu-system binary
anymore.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/ppc/tcg-excp_helper.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/target/ppc/tcg-excp_helper.c b/target/ppc/tcg-excp_helper.c
index 77d21523a5b..955afc40a83 100644
--- a/target/ppc/tcg-excp_helper.c
+++ b/target/ppc/tcg-excp_helper.c
@@ -428,22 +428,13 @@ G_NORETURN void powerpc_checkstop(CPUPPCState *env, const char *reason)
cpu_loop_exit_noexc(cs);
}
-/* Return true iff byteswap is needed to load instruction */
-static inline bool insn_need_byteswap(CPUArchState *env)
-{
- /* SYSTEM builds TARGET_BIG_ENDIAN. Need to swap when MSR[LE] is set */
- return !!(env->msr & ((target_ulong)1 << MSR_LE));
-}
-
uint32_t ppc_ldl_code(CPUArchState *env, target_ulong addr)
{
- uint32_t insn = cpu_ldl_code(env, addr);
+ CPUState *cs = env_cpu(env);
+ MemOp op_end = mo_endian_env(env);
+ MemOpIdx oi = make_memop_idx(MO_UL | op_end, cpu_mmu_index(cs, true));
- if (insn_need_byteswap(env)) {
- insn = bswap32(insn);
- }
-
- return insn;
+ return cpu_ldl_code_mmu(env, addr, oi, 0);
}
#if defined(TARGET_PPC64)
--
2.52.0