[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-arm] [PATCH v2 12/18] target-arm: introduce tbflag for endianness
From: |
Peter Crosthwaite |
Subject: |
[Qemu-arm] [PATCH v2 12/18] target-arm: introduce tbflag for endianness |
Date: |
Tue, 1 Mar 2016 22:56:16 -0800 |
From: Peter Crosthwaite <address@hidden>
Introduce a tbflags for endianness, set based upon the CPUs current
endianness. This in turn propagates through to the disas endianness
flag.
Signed-off-by: Peter Crosthwaite <address@hidden>
---
changed since v1:
s/MOE/BE_DATA (PMM review)
target-arm/cpu.h | 7 +++++++
target-arm/translate-a64.c | 2 +-
target-arm/translate.c | 2 +-
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/target-arm/cpu.h b/target-arm/cpu.h
index cbf171c..279c91f 100644
--- a/target-arm/cpu.h
+++ b/target-arm/cpu.h
@@ -1985,6 +1985,8 @@ static inline bool arm_cpu_data_is_big_endian(CPUARMState
*env)
*/
#define ARM_TBFLAG_NS_SHIFT 19
#define ARM_TBFLAG_NS_MASK (1 << ARM_TBFLAG_NS_SHIFT)
+#define ARM_TBFLAG_BE_DATA_SHIFT 20
+#define ARM_TBFLAG_BE_DATA_MASK (1 << ARM_TBFLAG_BE_DATA_SHIFT)
/* Bit usage when in AArch64 state: currently we have no A64 specific bits */
@@ -2015,6 +2017,8 @@ static inline bool arm_cpu_data_is_big_endian(CPUARMState
*env)
(((F) & ARM_TBFLAG_XSCALE_CPAR_MASK) >> ARM_TBFLAG_XSCALE_CPAR_SHIFT)
#define ARM_TBFLAG_NS(F) \
(((F) & ARM_TBFLAG_NS_MASK) >> ARM_TBFLAG_NS_SHIFT)
+#define ARM_TBFLAG_BE_DATA(F) \
+ (((F) & ARM_TBFLAG_BE_DATA_MASK) >> ARM_TBFLAG_BE_DATA_SHIFT)
static inline bool bswap_code(bool sctlr_b)
{
@@ -2157,6 +2161,9 @@ static inline void cpu_get_tb_cpu_state(CPUARMState *env,
target_ulong *pc,
}
}
}
+ if (arm_cpu_data_is_big_endian(env)) {
+ *flags |= ARM_TBFLAG_BE_DATA_MASK;
+ }
*flags |= fp_exception_el(env) << ARM_TBFLAG_FPEXC_EL_SHIFT;
*cs_base = 0;
diff --git a/target-arm/translate-a64.c b/target-arm/translate-a64.c
index 539e6d9..f0c73df 100644
--- a/target-arm/translate-a64.c
+++ b/target-arm/translate-a64.c
@@ -11043,7 +11043,7 @@ void gen_intermediate_code_a64(ARMCPU *cpu,
TranslationBlock *tb)
!arm_el_is_aa64(env, 3);
dc->thumb = 0;
dc->sctlr_b = 0;
- dc->be_data = MO_TE;
+ dc->be_data = ARM_TBFLAG_BE_DATA(tb->flags) ? MO_BE : MO_LE;
dc->condexec_mask = 0;
dc->condexec_cond = 0;
dc->mmu_idx = ARM_TBFLAG_MMUIDX(tb->flags);
diff --git a/target-arm/translate.c b/target-arm/translate.c
index 88f24cb..fe0be00 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -11330,7 +11330,7 @@ void gen_intermediate_code(CPUARMState *env,
TranslationBlock *tb)
!arm_el_is_aa64(env, 3);
dc->thumb = ARM_TBFLAG_THUMB(tb->flags);
dc->sctlr_b = ARM_TBFLAG_SCTLR_B(tb->flags);
- dc->be_data = MO_TE;
+ dc->be_data = ARM_TBFLAG_BE_DATA(tb->flags) ? MO_BE : MO_LE;
dc->condexec_mask = (ARM_TBFLAG_CONDEXEC(tb->flags) & 0xf) << 1;
dc->condexec_cond = ARM_TBFLAG_CONDEXEC(tb->flags) >> 4;
dc->mmu_idx = ARM_TBFLAG_MMUIDX(tb->flags);
--
1.9.1
- [Qemu-arm] [PATCH v2 04/18] target-arm: cpu: Move cpu_is_big_endian to header, (continued)
- [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
- [Qemu-arm] [PATCH v2 12/18] target-arm: introduce tbflag for endianness,
Peter Crosthwaite <=
- [Qemu-arm] [PATCH v2 13/18] target-arm: implement setend, Peter Crosthwaite, 2016/03/02
- [Qemu-arm] [PATCH v2 15/18] loader: add API to load elf header, Peter Crosthwaite, 2016/03/02
- [Qemu-arm] [PATCH v2 16/18] loader: load_elf(): Add doc comment, Peter Crosthwaite, 2016/03/02
- [Qemu-arm] [PATCH v2 18/18] arm: boot: Support big-endian elfs, Peter Crosthwaite, 2016/03/02
- [Qemu-arm] [PATCH v2 17/18] loader: Add data swap option to load-elf, Peter Crosthwaite, 2016/03/02
- Re: [Qemu-arm] [PATCH v2 00/18] ARM big-endian and setend support, Peter Maydell, 2016/03/03
- Message not available