diff mbox

[RFC,19/34] mb: Enable multi-arch

Message ID 9ddad3a68cd3267286ad83bcac7e9e3cc56447d0.1431322749.git.crosthwaite.peter@gmail.com
State New
Headers show

Commit Message

Peter Crosthwaite May 11, 2015, 6:29 a.m. UTC
Convert Microblaze to a multi-arch enabled architecture.

Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---
 Makefile.target               |  2 +-
 configure                     |  3 ++-
 target-microblaze/cpu.h       | 17 ++---------------
 target-microblaze/translate.c |  4 ++--
 target-multi/helper.h         |  1 +
 5 files changed, 8 insertions(+), 19 deletions(-)
diff mbox

Patch

diff --git a/Makefile.target b/Makefile.target
index 3e5a4f9..0043286 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -13,7 +13,7 @@  QEMU_CFLAGS += -I.. -I$(SRC_PATH)/target-$(TARGET_BASE_ARCH) -DNEED_CPU_H
 
 ARCH_DIRS = $(TARGET_BASE_ARCH)
 ifeq ($(TARGET_BASE_ARCH), multi)
-ARCH_DIRS +=
+ARCH_DIRS += microblaze
 endif
 
 QEMU_CFLAGS+=-I$(SRC_PATH)/include
diff --git a/configure b/configure
index 270a87c..1cce60c 100755
--- a/configure
+++ b/configure
@@ -5281,7 +5281,7 @@  if [ "$HOST_VARIANT_DIR" != "" ]; then
 fi
 case "$target_name" in
   multi)
-    MULTI_TARGETS=""
+    MULTI_TARGETS="microblaze"
 esac
 case "$target_name" in
   i386|x86_64)
@@ -5400,6 +5400,7 @@  for i in $ARCH $TARGET_BASE_ARCH $MULTI_TARGETS; do
     echo "CONFIG_M68K_DIS=y"  >> config-all-disas.mak
   ;;
   microblaze*)
+    echo "CONFIG_ARCH_MULTI=y" >> $config_target_mak
     echo "CONFIG_MICROBLAZE_DIS=y"  >> $config_target_mak
     echo "CONFIG_MICROBLAZE_DIS=y"  >> config-all-disas.mak
   ;;
diff --git a/target-microblaze/cpu.h b/target-microblaze/cpu.h
index 5f15ca9..4244aa0 100644
--- a/target-microblaze/cpu.h
+++ b/target-microblaze/cpu.h
@@ -22,8 +22,9 @@ 
 #include "config.h"
 #include "qemu-common.h"
 
-#define TARGET_LONG_BITS 64
+#include "target-multi/cpu-head.h"
 
+#undef CPUArchState
 #define CPUArchState struct CPUMBState
 
 #include "exec/cpu-defs.h"
@@ -221,8 +222,6 @@  typedef struct CPUMBState CPUMBState;
 #define CC_NE  1
 #define CC_EQ  0
 
-#define NB_MMU_MODES    3
-
 #define STREAM_EXCEPTION (1 << 0)
 #define STREAM_ATOMIC    (1 << 1)
 #define STREAM_TEST      (1 << 2)
@@ -275,12 +274,6 @@  struct CPUMBState {
 void mb_tcg_init(void);
 MicroBlazeCPU *cpu_mb_init(const char *cpu_model);
 
-/* FIXME: MB uses variable pages down to 1K but linux only uses 4k.  */
-#define TARGET_PAGE_BITS 12
-
-#define TARGET_PHYS_ADDR_SPACE_BITS 48
-#define TARGET_VIRT_ADDR_SPACE_BITS 64
-
 #ifdef CONFIG_USER_ONLY
 #define cpu_init(cpu_model) CPU(cpu_mb_init(cpu_model))
 #endif
@@ -306,12 +299,6 @@  void mb_cpu_unassigned_access(CPUState *cpu, hwaddr addr,
                               unsigned size);
 #endif
 
-#define cpu_get_tb_cpu_state(env, pc, cs_base, flags) \
-    (ENV_GET_CPU(env)->cpu_get_tb_cpu_state(ENV_GET_CPU(env), (pc), \
-                                            (cs_base), (flags)))
-
-#define cpu_mmu_index(env) (ENV_GET_CPU(env)->cpu_mmu_index(ENV_GET_CPU(env)))
-
 #include "exec/cpu-all.h"
 #include "exec/exec-all.h"
 
diff --git a/target-microblaze/translate.c b/target-microblaze/translate.c
index 88b35ff..3401799 100644
--- a/target-microblaze/translate.c
+++ b/target-microblaze/translate.c
@@ -28,6 +28,7 @@ 
 
 #include "trace-tcg.h"
 
+#include "target-multi/translate.h"
 
 #define SIM_COMPAT 0
 #define DISAS_GNU 1
@@ -49,7 +50,6 @@ 
  */
 
 static TCGv_i32 env_debug;
-static TCGv_ptr cpu_env;
 static TCGv_i32 cpu_R[32];
 static TCGv_i32 cpu_SR[18];
 static TCGv_i32 env_imm;
@@ -1933,7 +1933,7 @@  void mb_tcg_init(void)
 {
     int i;
 
-    cpu_env = tcg_global_reg_new_ptr(TCG_AREG0, "env");
+    multi_translate_init();
 
     env_debug = tcg_global_mem_new_i32(TCG_AREG0, 
                     offsetof(CPUMBState, debug),
diff --git a/target-multi/helper.h b/target-multi/helper.h
index e69de29..9308cc5 100644
--- a/target-multi/helper.h
+++ b/target-multi/helper.h
@@ -0,0 +1 @@ 
+#include <target-microblaze/helper.h>