@@ -3057,6 +3057,13 @@ static inline bool arm_cpu_data_is_big_endian(CPUARMState *env)
}
}
+static inline bool bswap_code(bool sctlr_b);
+
+static inline bool arm_cpu_code_is_big_endian(CPUARMState *env)
+{
+ return bswap_code(arm_sctlr_b(env));
+}
+
#include "exec/cpu-all.h"
/*
@@ -29,7 +29,7 @@
#define get_user_code_u32(x, gaddr, env) \
({ abi_long __r = get_user_u32((x), (gaddr)); \
- if (!__r && bswap_code(arm_sctlr_b(env))) { \
+ if (!__r && arm_cpu_code_is_big_endian(env)) { \
(x) = bswap32(x); \
} \
__r; \
@@ -37,7 +37,7 @@
#define get_user_code_u16(x, gaddr, env) \
({ abi_long __r = get_user_u16((x), (gaddr)); \
- if (!__r && bswap_code(arm_sctlr_b(env))) { \
+ if (!__r && arm_cpu_code_is_big_endian(env)) { \
(x) = bswap16(x); \
} \
__r; \
@@ -29,7 +29,7 @@
#define get_user_code_u32(x, gaddr, env) \
({ abi_long __r = get_user_u32((x), (gaddr)); \
- if (!__r && bswap_code(arm_sctlr_b(env))) { \
+ if (!__r && arm_cpu_code_is_big_endian(env)) { \
(x) = bswap32(x); \
} \
__r; \
@@ -37,7 +37,7 @@
#define get_user_code_u16(x, gaddr, env) \
({ abi_long __r = get_user_u16((x), (gaddr)); \
- if (!__r && bswap_code(arm_sctlr_b(env))) { \
+ if (!__r && arm_cpu_code_is_big_endian(env)) { \
(x) = bswap16(x); \
} \
__r; \
@@ -1167,7 +1167,6 @@ static void arm_disas_set_info(CPUState *cpu, disassemble_info *info)
{
ARMCPU *ac = ARM_CPU(cpu);
CPUARMState *env = &ac->env;
- bool sctlr_b;
if (is_a64(env)) {
info->cap_arch = CS_ARCH_ARM64;
@@ -1194,8 +1193,7 @@ static void arm_disas_set_info(CPUState *cpu, disassemble_info *info)
info->cap_mode = cap_mode;
}
- sctlr_b = arm_sctlr_b(env);
- if (bswap_code(sctlr_b)) {
+ if (arm_cpu_code_is_big_endian(env)) {
#if TARGET_BIG_ENDIAN
info->endian = BFD_ENDIAN_LITTLE;
#else
@@ -1204,7 +1202,7 @@ static void arm_disas_set_info(CPUState *cpu, disassemble_info *info)
}
info->flags &= ~INSN_ARM_BE32;
#ifndef CONFIG_USER_ONLY
- if (sctlr_b) {
+ if (arm_sctlr_b(env)) {
info->flags |= INSN_ARM_BE32;
}
#endif
Expose arm_cpu_code_is_big_endian() so it can be used by hw/ code. Use it in few places where it was open coded. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- target/arm/cpu.h | 7 +++++++ linux-user/aarch64/cpu_loop.c | 4 ++-- linux-user/arm/cpu_loop.c | 4 ++-- target/arm/cpu.c | 6 ++---- 4 files changed, 13 insertions(+), 8 deletions(-)