[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-arm] [PATCH v2 02/18] linux-user: arm: pass env to get_user_code_*
From: |
Peter Crosthwaite |
Subject: |
[Qemu-arm] [PATCH v2 02/18] linux-user: arm: pass env to get_user_code_* |
Date: |
Tue, 1 Mar 2016 22:56:06 -0800 |
From: Paolo Bonzini <address@hidden>
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 <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Peter Crosthwaite <address@hidden>
---
TEST result: 0 (log@ logs/qemu-armeb-BE32-)
TEST result: 0 (log@ logs/qemu-armeb-BE8-)
TEST result: 0 (log@ logs/qemu-arm-LE-)
TEST result: 0 (log@ logs/qemu-system-arm-LE-)
linux-user/main.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/linux-user/main.c b/linux-user/main.c
index 700724e..bcb9f66 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -435,17 +435,17 @@ void cpu_loop(CPUX86State *env)
#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)); \
- if (!__r && (doswap)) { \
+ if (!__r && (env)->bswap_code) { \
(x) = bswap32(x); \
} \
__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)); \
- if (!__r && (doswap)) { \
+ if (!__r && (env)->bswap_code) { \
(x) = bswap16(x); \
} \
__r; \
@@ -692,7 +692,7 @@ void cpu_loop(CPUARMState *env)
/* we handle the FPU emulation here, as Linux */
/* we get the opcode */
/* 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);
if (rc == 0) { /* illegal instruction */
@@ -762,25 +762,23 @@ void cpu_loop(CPUARMState *env)
if (trapnr == EXCP_BKPT) {
if (env->thumb) {
/* 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;
env->regs[15] += 2;
} else {
/* 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);
env->regs[15] += 4;
}
} else {
if (env->thumb) {
/* FIXME - what to do if get_user() fails? */
- get_user_code_u16(insn, env->regs[15] - 2,
- env->bswap_code);
+ get_user_code_u16(insn, env->regs[15] - 2, env);
n = insn & 0xff;
} else {
/* FIXME - what to do if get_user() fails? */
- get_user_code_u32(insn, env->regs[15] - 4,
- env->bswap_code);
+ get_user_code_u32(insn, env->regs[15] - 4, env);
n = insn & 0xffffff;
}
}
--
1.9.1
- [Qemu-arm] [PATCH v2 00/18] ARM big-endian and setend support, Peter Crosthwaite, 2016/03/02
- [Qemu-arm] [PATCH v2 01/18] linux-user: arm: fix coding style for some linux-user signal functions, Peter Crosthwaite, 2016/03/02
- [Qemu-arm] [PATCH v2 02/18] linux-user: arm: pass env to get_user_code_*,
Peter Crosthwaite <=
- [Qemu-arm] [PATCH v2 04/18] target-arm: cpu: Move cpu_is_big_endian to header, Peter Crosthwaite, 2016/03/02
- [Qemu-arm] [PATCH v2 05/18] arm: cpu: handle BE32 user-mode as BE, Peter Crosthwaite, 2016/03/02
- [Qemu-arm] [PATCH v2 03/18] target-arm: implement SCTLR.B, drop bswap_code, Peter Crosthwaite, 2016/03/02
- [Qemu-arm] [PATCH v2 08/18] target-arm: implement SCTLR.EE, Peter Crosthwaite, 2016/03/02
- [Qemu-arm] [PATCH v2 06/18] linux-user: arm: set CPSR.E/SCTLR.E0E correctly for BE mode, Peter Crosthwaite, 2016/03/02
- [Qemu-arm] [PATCH v2 07/18] linux-user: arm: handle CPSR.E correctly in strex emulation, Peter Crosthwaite, 2016/03/02
- [Qemu-arm] [PATCH v2 10/18] target-arm: introduce disas flag for endianness, Peter Crosthwaite, 2016/03/02
- [Qemu-arm] [PATCH v2 11/18] target-arm: a64: Add endianness support, Peter Crosthwaite, 2016/03/02
- [Qemu-arm] [PATCH v2 09/18] target-arm: pass DisasContext to gen_aa32_ld*/st*, Peter Crosthwaite, 2016/03/02