linux-user: arm: pass env to get_user_code_*

This matches the idiom used by get_user_data_* later in the series,
and will help when bswap_code will be replaced by SCTLR.B.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Paolo Bonzini 2016-03-04 11:30:18 +00:00 committed by Peter Maydell
parent a0e1e6d705
commit 49017bd8b4

View File

@ -435,17 +435,17 @@ void cpu_loop(CPUX86State *env)
#ifdef TARGET_ARM #ifdef TARGET_ARM
#define get_user_code_u32(x, gaddr, doswap) \ #define get_user_code_u32(x, gaddr, env) \
({ abi_long __r = get_user_u32((x), (gaddr)); \ ({ abi_long __r = get_user_u32((x), (gaddr)); \
if (!__r && (doswap)) { \ if (!__r && (env)->bswap_code) { \
(x) = bswap32(x); \ (x) = bswap32(x); \
} \ } \
__r; \ __r; \
}) })
#define get_user_code_u16(x, gaddr, doswap) \ #define get_user_code_u16(x, gaddr, env) \
({ abi_long __r = get_user_u16((x), (gaddr)); \ ({ abi_long __r = get_user_u16((x), (gaddr)); \
if (!__r && (doswap)) { \ if (!__r && (env)->bswap_code) { \
(x) = bswap16(x); \ (x) = bswap16(x); \
} \ } \
__r; \ __r; \
@ -692,7 +692,7 @@ void cpu_loop(CPUARMState *env)
/* we handle the FPU emulation here, as Linux */ /* we handle the FPU emulation here, as Linux */
/* we get the opcode */ /* we get the opcode */
/* FIXME - what to do if get_user() fails? */ /* FIXME - what to do if get_user() fails? */
get_user_code_u32(opcode, env->regs[15], env->bswap_code); get_user_code_u32(opcode, env->regs[15], env);
rc = EmulateAll(opcode, &ts->fpa, env); rc = EmulateAll(opcode, &ts->fpa, env);
if (rc == 0) { /* illegal instruction */ if (rc == 0) { /* illegal instruction */
@ -762,25 +762,23 @@ void cpu_loop(CPUARMState *env)
if (trapnr == EXCP_BKPT) { if (trapnr == EXCP_BKPT) {
if (env->thumb) { if (env->thumb) {
/* FIXME - what to do if get_user() fails? */ /* FIXME - what to do if get_user() fails? */
get_user_code_u16(insn, env->regs[15], env->bswap_code); get_user_code_u16(insn, env->regs[15], env);
n = insn & 0xff; n = insn & 0xff;
env->regs[15] += 2; env->regs[15] += 2;
} else { } else {
/* FIXME - what to do if get_user() fails? */ /* FIXME - what to do if get_user() fails? */
get_user_code_u32(insn, env->regs[15], env->bswap_code); get_user_code_u32(insn, env->regs[15], env);
n = (insn & 0xf) | ((insn >> 4) & 0xff0); n = (insn & 0xf) | ((insn >> 4) & 0xff0);
env->regs[15] += 4; env->regs[15] += 4;
} }
} else { } else {
if (env->thumb) { if (env->thumb) {
/* FIXME - what to do if get_user() fails? */ /* FIXME - what to do if get_user() fails? */
get_user_code_u16(insn, env->regs[15] - 2, get_user_code_u16(insn, env->regs[15] - 2, env);
env->bswap_code);
n = insn & 0xff; n = insn & 0xff;
} else { } else {
/* FIXME - what to do if get_user() fails? */ /* FIXME - what to do if get_user() fails? */
get_user_code_u32(insn, env->regs[15] - 4, get_user_code_u32(insn, env->regs[15] - 4, env);
env->bswap_code);
n = insn & 0xffffff; n = insn & 0xffffff;
} }
} }