peterdelevoryas / rpms / qemu

Forked from rpms/qemu 2 years ago
Clone

Blame 0033-target-arm-final-conversion-to-AREG0-free-mode.patch

5544c1
From 28b8f097f9fb107882aa51bd25ba87619beb033e Mon Sep 17 00:00:00 2001
5544c1
From: Blue Swirl <blauwirbel@gmail.com>
5544c1
Date: Tue, 4 Sep 2012 20:25:59 +0000
5544c1
Subject: [PATCH] target-arm: final conversion to AREG0 free mode
5544c1
5544c1
Convert code load functions and switch to AREG0 free mode.
5544c1
5544c1
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
5544c1
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5544c1
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5544c1
---
5544c1
 configure                |  2 +-
5544c1
 target-arm/Makefile.objs |  2 --
5544c1
 target-arm/cpu.h         | 10 ++++++----
5544c1
 target-arm/helper.c      |  9 +++++----
5544c1
 target-arm/op_helper.c   |  8 +-------
5544c1
 target-arm/translate.c   |  6 +++---
5544c1
 6 files changed, 16 insertions(+), 21 deletions(-)
5544c1
5544c1
diff --git a/configure b/configure
5544c1
index a8827ba..e8806f0 100755
5544c1
--- a/configure
5544c1
+++ b/configure
5544c1
@@ -3839,7 +3839,7 @@ symlink "$source_path/Makefile.target" "$target_dir/Makefile"
5544c1
 
5544c1
 
5544c1
 case "$target_arch2" in
5544c1
-  alpha | i386 | lm32 | m68k | or32 | s390x | sparc* | unicore32 | x86_64 | xtensa* | ppc*)
5544c1
+  alpha | arm* | i386 | lm32 | m68k | or32 | s390x | sparc* | unicore32 | x86_64 | xtensa* | ppc*)
5544c1
     echo "CONFIG_TCG_PASS_AREG0=y" >> $config_target_mak
5544c1
   ;;
5544c1
 esac
5544c1
diff --git a/target-arm/Makefile.objs b/target-arm/Makefile.objs
5544c1
index f447c4f..b6f1a9e 100644
5544c1
--- a/target-arm/Makefile.objs
5544c1
+++ b/target-arm/Makefile.objs
5544c1
@@ -2,5 +2,3 @@ obj-y += arm-semi.o
5544c1
 obj-$(CONFIG_SOFTMMU) += machine.o
5544c1
 obj-y += translate.o op_helper.o helper.o cpu.o
5544c1
 obj-y += neon_helper.o iwmmxt_helper.o
5544c1
-
5544c1
-$(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
5544c1
diff --git a/target-arm/cpu.h b/target-arm/cpu.h
5544c1
index d7f93d9..7fac94f 100644
5544c1
--- a/target-arm/cpu.h
5544c1
+++ b/target-arm/cpu.h
5544c1
@@ -734,9 +734,10 @@ static inline void cpu_pc_from_tb(CPUARMState *env, TranslationBlock *tb)
5544c1
 }
5544c1
 
5544c1
 /* Load an instruction and return it in the standard little-endian order */
5544c1
-static inline uint32_t arm_ldl_code(uint32_t addr, bool do_swap)
5544c1
+static inline uint32_t arm_ldl_code(CPUARMState *env, uint32_t addr,
5544c1
+                                    bool do_swap)
5544c1
 {
5544c1
-    uint32_t insn = ldl_code(addr);
5544c1
+    uint32_t insn = cpu_ldl_code(env, addr);
5544c1
     if (do_swap) {
5544c1
         return bswap32(insn);
5544c1
     }
5544c1
@@ -744,9 +745,10 @@ static inline uint32_t arm_ldl_code(uint32_t addr, bool do_swap)
5544c1
 }
5544c1
 
5544c1
 /* Ditto, for a halfword (Thumb) instruction */
5544c1
-static inline uint16_t arm_lduw_code(uint32_t addr, bool do_swap)
5544c1
+static inline uint16_t arm_lduw_code(CPUARMState *env, uint32_t addr,
5544c1
+                                     bool do_swap)
5544c1
 {
5544c1
-    uint16_t insn = lduw_code(addr);
5544c1
+    uint16_t insn = cpu_lduw_code(env, addr);
5544c1
     if (do_swap) {
5544c1
         return bswap16(insn);
5544c1
     }
5544c1
diff --git a/target-arm/helper.c b/target-arm/helper.c
5544c1
index e27df96..58340bd 100644
5544c1
--- a/target-arm/helper.c
5544c1
+++ b/target-arm/helper.c
5544c1
@@ -1756,7 +1756,7 @@ static void do_interrupt_v7m(CPUARMState *env)
5544c1
     case EXCP_BKPT:
5544c1
         if (semihosting_enabled) {
5544c1
             int nr;
5544c1
-            nr = arm_lduw_code(env->regs[15], env->bswap_code) & 0xff;
5544c1
+            nr = arm_lduw_code(env, env->regs[15], env->bswap_code) & 0xff;
5544c1
             if (nr == 0xab) {
5544c1
                 env->regs[15] += 2;
5544c1
                 env->regs[0] = do_arm_semihosting(env);
5544c1
@@ -1828,9 +1828,10 @@ void do_interrupt(CPUARMState *env)
5544c1
         if (semihosting_enabled) {
5544c1
             /* Check for semihosting interrupt.  */
5544c1
             if (env->thumb) {
5544c1
-                mask = arm_lduw_code(env->regs[15] - 2, env->bswap_code) & 0xff;
5544c1
+                mask = arm_lduw_code(env, env->regs[15] - 2, env->bswap_code)
5544c1
+                    & 0xff;
5544c1
             } else {
5544c1
-                mask = arm_ldl_code(env->regs[15] - 4, env->bswap_code)
5544c1
+                mask = arm_ldl_code(env, env->regs[15] - 4, env->bswap_code)
5544c1
                     & 0xffffff;
5544c1
             }
5544c1
             /* Only intercept calls from privileged modes, to provide some
5544c1
@@ -1851,7 +1852,7 @@ void do_interrupt(CPUARMState *env)
5544c1
     case EXCP_BKPT:
5544c1
         /* See if this is a semihosting syscall.  */
5544c1
         if (env->thumb && semihosting_enabled) {
5544c1
-            mask = arm_lduw_code(env->regs[15], env->bswap_code) & 0xff;
5544c1
+            mask = arm_lduw_code(env, env->regs[15], env->bswap_code) & 0xff;
5544c1
             if (mask == 0xab
5544c1
                   && (env->uncached_cpsr & CPSR_M) != ARM_CPU_MODE_USR) {
5544c1
                 env->regs[15] += 2;
5544c1
diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c
5544c1
index 5b868bf..f13fc3a 100644
5544c1
--- a/target-arm/op_helper.c
5544c1
+++ b/target-arm/op_helper.c
5544c1
@@ -17,7 +17,6 @@
5544c1
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
5544c1
  */
5544c1
 #include "cpu.h"
5544c1
-#include "dyngen-exec.h"
5544c1
 #include "helper.h"
5544c1
 
5544c1
 #define SIGNBIT (uint32_t)0x80000000
5544c1
@@ -72,16 +71,12 @@ uint32_t HELPER(neon_tbl)(CPUARMState *env, uint32_t ireg, uint32_t def,
5544c1
 /* try to fill the TLB and return an exception if error. If retaddr is
5544c1
    NULL, it means that the function was called in C code (i.e. not
5544c1
    from generated code or from helper.c) */
5544c1
-/* XXX: fix it to restore all registers */
5544c1
-void tlb_fill(CPUARMState *env1, target_ulong addr, int is_write, int mmu_idx,
5544c1
+void tlb_fill(CPUARMState *env, target_ulong addr, int is_write, int mmu_idx,
5544c1
               uintptr_t retaddr)
5544c1
 {
5544c1
     TranslationBlock *tb;
5544c1
-    CPUARMState *saved_env;
5544c1
     int ret;
5544c1
 
5544c1
-    saved_env = env;
5544c1
-    env = env1;
5544c1
     ret = cpu_arm_handle_mmu_fault(env, addr, is_write, mmu_idx);
5544c1
     if (unlikely(ret)) {
5544c1
         if (retaddr) {
5544c1
@@ -95,7 +90,6 @@ void tlb_fill(CPUARMState *env1, target_ulong addr, int is_write, int mmu_idx,
5544c1
         }
5544c1
         raise_exception(env, env->exception_index);
5544c1
     }
5544c1
-    env = saved_env;
5544c1
 }
5544c1
 #endif
5544c1
 
5544c1
diff --git a/target-arm/translate.c b/target-arm/translate.c
5544c1
index 9ae3b26..f4b447a 100644
5544c1
--- a/target-arm/translate.c
5544c1
+++ b/target-arm/translate.c
5544c1
@@ -6534,7 +6534,7 @@ static void disas_arm_insn(CPUARMState * env, DisasContext *s)
5544c1
     TCGv addr;
5544c1
     TCGv_i64 tmp64;
5544c1
 
5544c1
-    insn = arm_ldl_code(s->pc, s->bswap_code);
5544c1
+    insn = arm_ldl_code(env, s->pc, s->bswap_code);
5544c1
     s->pc += 4;
5544c1
 
5544c1
     /* M variants do not implement ARM mode.  */
5544c1
@@ -7962,7 +7962,7 @@ static int disas_thumb2_insn(CPUARMState *env, DisasContext *s, uint16_t insn_hw
5544c1
         /* Fall through to 32-bit decode.  */
5544c1
     }
5544c1
 
5544c1
-    insn = arm_lduw_code(s->pc, s->bswap_code);
5544c1
+    insn = arm_lduw_code(env, s->pc, s->bswap_code);
5544c1
     s->pc += 2;
5544c1
     insn |= (uint32_t)insn_hw1 << 16;
5544c1
 
5544c1
@@ -8992,7 +8992,7 @@ static void disas_thumb_insn(CPUARMState *env, DisasContext *s)
5544c1
         }
5544c1
     }
5544c1
 
5544c1
-    insn = arm_lduw_code(s->pc, s->bswap_code);
5544c1
+    insn = arm_lduw_code(env, s->pc, s->bswap_code);
5544c1
     s->pc += 2;
5544c1
 
5544c1
     switch (insn >> 12) {
5544c1
-- 
5544c1
1.7.12.1
5544c1