qemu-arm.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Crosthwaite <crosthwaitepeter@gmail.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org,
	Peter Crosthwaite <peter.crosthwaite@xilinx.com>,
	alistair.francis@xilinx.com, sridhar_kulk@yahoo.com,
	qemu-arm@nongnu.org, pbonzini@redhat.com, piotr.krol@3mdeb.com
Subject: [Qemu-arm] [PATCH v1 09/17] target-arm: introduce tbflag for endianness
Date: Sun, 17 Jan 2016 23:12:36 -0800	[thread overview]
Message-ID: <c0f5e1844b6f9e40de952e8ae01fe53e76a9e03c.1453100525.git.crosthwaite.peter@gmail.com> (raw)
In-Reply-To: <cover.1453100525.git.crosthwaite.peter@gmail.com>
In-Reply-To: <cover.1453100525.git.crosthwaite.peter@gmail.com>

From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

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 <peter.crosthwaite@xilinx.com>
---

 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 54675c7..74048d1 100644
--- a/target-arm/cpu.h
+++ b/target-arm/cpu.h
@@ -1857,6 +1857,8 @@ static bool arm_cpu_is_big_endian(CPUARMState *env)
  */
 #define ARM_TBFLAG_NS_SHIFT         19
 #define ARM_TBFLAG_NS_MASK          (1 << ARM_TBFLAG_NS_SHIFT)
+#define ARM_TBFLAG_MOE_SHIFT        20
+#define ARM_TBFLAG_MOE_MASK         (1 << ARM_TBFLAG_MOE_SHIFT)
 
 /* Bit usage when in AArch64 state: currently we have no A64 specific bits */
 
@@ -1887,6 +1889,8 @@ static bool arm_cpu_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_MOE(F) \
+    (((F) & ARM_TBFLAG_MOE_MASK) >> ARM_TBFLAG_MOE_SHIFT)
 
 /* Return the exception level to which FP-disabled exceptions should
  * be taken, or 0 if FP is enabled.
@@ -2018,6 +2022,9 @@ static inline void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
             }
         }
     }
+    if (arm_cpu_is_big_endian(env)) {
+        *flags |= ARM_TBFLAG_MOE_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 59026b6..db68662 100644
--- a/target-arm/translate-a64.c
+++ b/target-arm/translate-a64.c
@@ -11044,7 +11044,7 @@ void gen_intermediate_code_a64(ARMCPU *cpu, TranslationBlock *tb)
                                !arm_el_is_aa64(env, 3);
     dc->thumb = 0;
     dc->bswap_code = 0;
-    dc->mo_endianness = MO_TE;
+    dc->mo_endianness = ARM_TBFLAG_MOE(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 e1679d3..cb925ef 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -11274,7 +11274,7 @@ void gen_intermediate_code(CPUARMState *env, TranslationBlock *tb)
                                !arm_el_is_aa64(env, 3);
     dc->thumb = ARM_TBFLAG_THUMB(tb->flags);
     dc->bswap_code = ARM_TBFLAG_BSWAP_CODE(tb->flags);
-    dc->mo_endianness = MO_TE;
+    dc->mo_endianness = ARM_TBFLAG_MOE(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


  parent reply	other threads:[~2016-01-18  7:16 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-18  7:12 [Qemu-devel] [PATCH v1 00/17] ARM big-endian and setend support Peter Crosthwaite
2016-01-18  7:12 ` [Qemu-devel] [PATCH v1 01/17] linux-user: arm: fix coding style for some linux-user signal functions Peter Crosthwaite
2016-01-18  7:12 ` [Qemu-devel] [PATCH v1 02/17] linux-user: arm: set CPSR.E/SCTLR.E0E correctly for BE mode Peter Crosthwaite
2016-01-19 16:22   ` Peter Maydell
2016-01-18  7:12 ` [Qemu-devel] [PATCH v1 03/17] linux-user: arm: handle CPSR.E correctly in strex emulation Peter Crosthwaite
2016-01-19 16:24   ` Peter Maydell
2016-01-18  7:12 ` [Qemu-devel] [PATCH v1 04/17] target-arm: implement SCTLR.EE Peter Crosthwaite
2016-01-19 15:58   ` Peter Maydell
2016-02-27 21:56     ` [Qemu-arm] " Peter Crosthwaite
2016-01-18  7:12 ` [Qemu-arm] [PATCH v1 05/17] target-arm: pass DisasContext to gen_aa32_ld*/st* Peter Crosthwaite
2016-01-19 16:08   ` Peter Maydell
2016-01-18  7:12 ` [Qemu-arm] [PATCH v1 06/17] target-arm: introduce disas flag for endianness Peter Crosthwaite
2016-01-19 16:08   ` Peter Maydell
2016-01-18  7:12 ` [Qemu-arm] [PATCH v1 07/17] target-arm: a64: Add endianness support Peter Crosthwaite
2016-01-19 16:09   ` Peter Maydell
2016-01-18  7:12 ` [Qemu-devel] [PATCH v1 08/17] target-arm: cpu: Move cpu_is_big_endian to header Peter Crosthwaite
2016-01-18 21:52   ` [Qemu-arm] " Alistair Francis
2016-01-19 16:11   ` Peter Maydell
2016-02-27 22:02     ` [Qemu-arm] " Peter Crosthwaite
2016-01-18  7:12 ` Peter Crosthwaite [this message]
2016-01-19 16:15   ` [Qemu-arm] [PATCH v1 09/17] target-arm: introduce tbflag for endianness Peter Maydell
2016-01-18  7:12 ` [Qemu-devel] [PATCH v1 10/17] target-arm: implement setend Peter Crosthwaite
2016-01-19 16:29   ` [Qemu-arm] " Peter Maydell
2016-02-27 22:14     ` Peter Crosthwaite
2016-01-18  7:12 ` [Qemu-arm] [PATCH v1 11/17] linux-user: arm: pass env to get_user_code_* Peter Crosthwaite
2016-01-18  7:12 ` [Qemu-arm] [PATCH v1 12/17] target-arm: implement SCTLR.B, drop bswap_code Peter Crosthwaite
2016-01-19 17:21   ` Peter Maydell
2016-01-18  7:12 ` [Qemu-devel] [PATCH v1 13/17] arm: linux-user: don't set CPSR.E in BE32 mode Peter Crosthwaite
2016-01-19 17:26   ` [Qemu-arm] " Peter Maydell
2016-01-19 17:35     ` Peter Maydell
2016-02-27 22:22       ` Peter Crosthwaite
2016-01-18  7:12 ` [Qemu-devel] [PATCH v1 14/17] target-arm: implement BE32 mode in system emulation Peter Crosthwaite
2016-01-19 17:39   ` [Qemu-arm] " Peter Maydell
2016-01-18  7:12 ` [Qemu-devel] [PATCH v1 15/17] loader: add API to load elf header Peter Crosthwaite
2016-01-19 17:50   ` [Qemu-arm] " Peter Maydell
2016-02-27 22:46     ` Peter Crosthwaite
2016-01-18  7:12 ` [Qemu-devel] [PATCH v1 16/17] loader: Add data swap option to load-elf Peter Crosthwaite
2016-01-19 17:53   ` [Qemu-arm] " Peter Maydell
2016-02-27 23:14     ` Peter Crosthwaite
2016-02-28 15:28       ` Peter Maydell
2016-02-28 20:16         ` Peter Crosthwaite
2016-01-18  7:12 ` [Qemu-devel] [PATCH v1 17/17] arm: boot: Support big-endian elfs Peter Crosthwaite
2016-01-19 18:06   ` [Qemu-arm] " Peter Maydell
2016-02-27 23:59     ` Peter Crosthwaite
2016-01-19 18:06 ` [Qemu-arm] [PATCH v1 00/17] ARM big-endian and setend support Peter Maydell
2016-03-01  5:27 ` [Qemu-devel] " Stefan Weil
2016-03-01 18:26   ` [Qemu-arm] " Peter Crosthwaite
2016-03-01 18:43   ` Peter Crosthwaite
2016-03-01 21:03     ` [Qemu-arm] " Paolo Bonzini
2016-03-01 21:34     ` [Qemu-arm] [Qemu-devel] " Andrew Baumann
2016-03-02  5:31       ` Peter Crosthwaite

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c0f5e1844b6f9e40de952e8ae01fe53e76a9e03c.1453100525.git.crosthwaite.peter@gmail.com \
    --to=crosthwaitepeter@gmail.com \
    --cc=alistair.francis@xilinx.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=peter.maydell@linaro.org \
    --cc=piotr.krol@3mdeb.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sridhar_kulk@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).