]> git.proxmox.com Git - qemu.git/commitdiff
unicore32-softmmu: Add unicore32-softmmu build support
authorGuan Xuetao <gxt@mprc.pku.edu.cn>
Fri, 10 Aug 2012 06:42:21 +0000 (14:42 +0800)
committerBlue Swirl <blauwirbel@gmail.com>
Sat, 11 Aug 2012 09:36:55 +0000 (09:36 +0000)
This patch adds unicore32-softmmu build support, include configure,
makefile, arch_init, and all missing functions needed by softmmu.
Although all missing functions are empty, unicore32-softmmu could
be build successfully.
By 20120804: change QEMU_ARCH_UNICORE32 to 0x4000

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
arch_init.c
arch_init.h
configure
default-configs/unicore32-softmmu.mak [new file with mode: 0644]
hw/unicore32/Makefile.objs [new file with mode: 0644]
target-unicore32/Makefile.objs
target-unicore32/helper.c
target-unicore32/machine.c [new file with mode: 0644]
target-unicore32/op_helper.c
target-unicore32/softmmu.c [new file with mode: 0644]

index 60823baabda99ac17d73eeffd0152451f8ee14d6..7b65c4888b7151dfb6a7f8e0cd226df3f86037be 100644 (file)
@@ -91,6 +91,8 @@ int graphic_depth = 15;
 #define QEMU_ARCH QEMU_ARCH_SPARC
 #elif defined(TARGET_XTENSA)
 #define QEMU_ARCH QEMU_ARCH_XTENSA
+#elif defined(TARGET_UNICORE32)
+#define QEMU_ARCH QEMU_ARCH_UNICORE32
 #endif
 
 const uint32_t arch_type = QEMU_ARCH;
index 3dfea3b4f3ee35673a1263ca0b1659f86b7df5a1..547f93cd1d43fe4f810fdeaf16456c4fd2445d03 100644 (file)
@@ -17,6 +17,7 @@ enum {
     QEMU_ARCH_SPARC = 2048,
     QEMU_ARCH_XTENSA = 4096,
     QEMU_ARCH_OPENRISC = 8192,
+    QEMU_ARCH_UNICORE32 = 0x4000,
 };
 
 extern const uint32_t arch_type;
index 280726c3f8b31815ec80464679a270aa401685be..efaff0042bd35a5add2f5ac8c7a2f636bdb6e0d8 100755 (executable)
--- a/configure
+++ b/configure
@@ -935,6 +935,7 @@ sparc64-softmmu \
 s390x-softmmu \
 xtensa-softmmu \
 xtensaeb-softmmu \
+unicore32-softmmu \
 "
 fi
 # the following are Linux specific
diff --git a/default-configs/unicore32-softmmu.mak b/default-configs/unicore32-softmmu.mak
new file mode 100644 (file)
index 0000000..5f04fe3
--- /dev/null
@@ -0,0 +1 @@
+# Default configuration for unicore32-softmmu
diff --git a/hw/unicore32/Makefile.objs b/hw/unicore32/Makefile.objs
new file mode 100644 (file)
index 0000000..b6a3383
--- /dev/null
@@ -0,0 +1 @@
+# For UniCore32 machines and boards
index 2e0e093e1f989c1fa4d0922fc4d7efa195d5bc77..6af1089a5eb31b9bd0c99117cde3ed30532b7286 100644 (file)
@@ -1,4 +1,4 @@
 obj-y += translate.o op_helper.o helper.o cpu.o
-obj-$(CONFIG_SOFTMMU) += machine.o
+obj-$(CONFIG_SOFTMMU) += machine.o softmmu.o
 
 $(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
index 9fe4a375e40685caa19d4173e0497fe872abaf75..9b8ff06d5c05eb9cd2343e50796b65587b96422b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2011 GUAN Xue-tao
+ * Copyright (C) 2010-2012 Guan Xuetao
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -45,18 +45,26 @@ uint32_t HELPER(clz)(uint32_t x)
     return clz32(x);
 }
 
+#ifdef CONFIG_USER_ONLY
+void switch_mode(CPUUniCore32State *env, int mode)
+{
+    if (mode != ASR_MODE_USER) {
+        cpu_abort(env, "Tried to switch out of user mode\n");
+    }
+}
+
 void do_interrupt(CPUUniCore32State *env)
 {
-    env->exception_index = -1;
+    cpu_abort(env, "NO interrupt in user mode\n");
 }
 
-int uc32_cpu_handle_mmu_fault(CPUUniCore32State *env, target_ulong address, int rw,
-                              int mmu_idx)
+int uc32_cpu_handle_mmu_fault(CPUUniCore32State *env, target_ulong address,
+                              int access_type, int mmu_idx)
 {
-    env->exception_index = UC32_EXCP_TRAP;
-    env->cp0.c4_faultaddr = address;
+    cpu_abort(env, "NO mmu fault in user mode\n");
     return 1;
 }
+#endif
 
 /* These should probably raise undefined insn exceptions.  */
 void HELPER(set_cp)(CPUUniCore32State *env, uint32_t insn, uint32_t val)
@@ -84,13 +92,6 @@ uint32_t HELPER(get_cp0)(CPUUniCore32State *env, uint32_t insn)
     return 0;
 }
 
-void switch_mode(CPUUniCore32State *env, int mode)
-{
-    if (mode != ASR_MODE_USER) {
-        cpu_abort(env, "Tried to switch out of user mode\n");
-    }
-}
-
 void HELPER(set_r29_banked)(CPUUniCore32State *env, uint32_t mode, uint32_t val)
 {
     cpu_abort(env, "banked r29 write\n");
diff --git a/target-unicore32/machine.c b/target-unicore32/machine.c
new file mode 100644 (file)
index 0000000..60b2ec1
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Generic machine functions for UniCore32 ISA
+ *
+ * Copyright (C) 2010-2012 Guan Xuetao
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation, or any later version.
+ * See the COPYING file in the top-level directory.
+ */
+#include "hw/hw.h"
+
+void cpu_save(QEMUFile *f, void *opaque)
+{
+    hw_error("%s not supported yet.\n", __func__);
+}
+
+int cpu_load(QEMUFile *f, void *opaque, int version_id)
+{
+    hw_error("%s not supported yet.\n", __func__);
+
+    return 0;
+}
index b954c30a84d06111d07798eab5e3e738e8d062c4..6df30db668fe84be27cdd473d70a252e054636d8 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  UniCore32 helper routines
  *
- * Copyright (C) 2010-2011 GUAN Xue-tao
+ * Copyright (C) 2010-2012 Guan Xuetao
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -248,3 +248,25 @@ uint32_t HELPER(ror_cc)(uint32_t x, uint32_t i)
         return ((uint32_t)x >> shift) | (x << (32 - shift));
     }
 }
+
+#ifndef CONFIG_USER_ONLY
+#define MMUSUFFIX _mmu
+
+#define SHIFT 0
+#include "softmmu_template.h"
+
+#define SHIFT 1
+#include "softmmu_template.h"
+
+#define SHIFT 2
+#include "softmmu_template.h"
+
+#define SHIFT 3
+#include "softmmu_template.h"
+
+void tlb_fill(CPUUniCore32State *env1, target_ulong addr, int is_write,
+        int mmu_idx, uintptr_t retaddr)
+{
+    cpu_abort(env, "%s not supported yet\n", __func__);
+}
+#endif
diff --git a/target-unicore32/softmmu.c b/target-unicore32/softmmu.c
new file mode 100644 (file)
index 0000000..6fec77e
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Softmmu related functions
+ *
+ * Copyright (C) 2010-2012 Guan Xuetao
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation, or any later version.
+ * See the COPYING file in the top-level directory.
+ */
+#ifdef CONFIG_USER_ONLY
+#error This file only exist under softmmu circumstance
+#endif
+
+#include <cpu.h>
+
+void switch_mode(CPUUniCore32State *env, int mode)
+{
+    cpu_abort(env, "%s not supported yet\n", __func__);
+}
+
+void do_interrupt(CPUUniCore32State *env)
+{
+    cpu_abort(env, "%s not supported yet\n", __func__);
+}
+
+int uc32_cpu_handle_mmu_fault(CPUUniCore32State *env, target_ulong address,
+                              int access_type, int mmu_idx)
+{
+    cpu_abort(env, "%s not supported yet\n", __func__);
+    return 1;
+}
+
+target_phys_addr_t cpu_get_phys_page_debug(CPUUniCore32State *env,
+        target_ulong addr)
+{
+    cpu_abort(env, "%s not supported yet\n", __func__);
+    return addr;
+}