target/arm: fetch code with translator_ld

Now the arm_ld*_code functions are only used at translate time we can
just pass down to translator_ld functions.

Signed-off-by: Emilio G. Cota <cota@braap.org>
[AJB: convert from plugin_insn_append to translator_ld]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Emilio G. Cota 2018-11-27 20:09:25 -05:00 committed by Alex Bennée
parent 409c1a0bf0
commit ae82adc8e2

View File

@ -20,25 +20,20 @@
#ifndef ARM_LDST_H #ifndef ARM_LDST_H
#define ARM_LDST_H #define ARM_LDST_H
#include "exec/cpu_ldst.h" #include "exec/translator.h"
#include "qemu/bswap.h" #include "qemu/bswap.h"
/* Load an instruction and return it in the standard little-endian order */ /* Load an instruction and return it in the standard little-endian order */
static inline uint32_t arm_ldl_code(CPUARMState *env, target_ulong addr, static inline uint32_t arm_ldl_code(CPUARMState *env, target_ulong addr,
bool sctlr_b) bool sctlr_b)
{ {
uint32_t insn = cpu_ldl_code(env, addr); return translator_ldl_swap(env, addr, bswap_code(sctlr_b));
if (bswap_code(sctlr_b)) {
return bswap32(insn);
}
return insn;
} }
/* Ditto, for a halfword (Thumb) instruction */ /* Ditto, for a halfword (Thumb) instruction */
static inline uint16_t arm_lduw_code(CPUARMState *env, target_ulong addr, static inline uint16_t arm_lduw_code(CPUARMState *env, target_ulong addr,
bool sctlr_b) bool sctlr_b)
{ {
uint16_t insn;
#ifndef CONFIG_USER_ONLY #ifndef CONFIG_USER_ONLY
/* In big-endian (BE32) mode, adjacent Thumb instructions have been swapped /* In big-endian (BE32) mode, adjacent Thumb instructions have been swapped
within each word. Undo that now. */ within each word. Undo that now. */
@ -46,11 +41,7 @@ static inline uint16_t arm_lduw_code(CPUARMState *env, target_ulong addr,
addr ^= 2; addr ^= 2;
} }
#endif #endif
insn = cpu_lduw_code(env, addr); return translator_lduw_swap(env, addr, bswap_code(sctlr_b));
if (bswap_code(sctlr_b)) {
return bswap16(insn);
}
return insn;
} }
#endif #endif