]> git.proxmox.com Git - mirror_qemu.git/commitdiff
target/hppa: Skeleton support for hppa-softmmu
authorHelge Deller <deller@gmx.de>
Sun, 1 Oct 2017 20:11:45 +0000 (22:11 +0200)
committerRichard Henderson <richard.henderson@linaro.org>
Tue, 30 Jan 2018 18:08:18 +0000 (10:08 -0800)
With the addition of default-configs/hppa-softmmu.mak, this
will compile.  It is not enabled with this patch, however.

Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
arch_init.c
hw/hppa/Makefile.objs [new file with mode: 0644]
hw/hppa/machine.c [new file with mode: 0644]
include/sysemu/arch_init.h
target/hppa/Makefile.objs
target/hppa/cpu.c
target/hppa/cpu.h
target/hppa/helper.c
target/hppa/mem_helper.c [new file with mode: 0644]
target/hppa/op_helper.c

index a0b8ed616757b030861dc2362dda6b6cf8ecaa5c..4c36f2b076d74ad03823fc451accb1ce0f2c0f9d 100644 (file)
@@ -53,6 +53,8 @@ int graphic_depth = 32;
 #define QEMU_ARCH QEMU_ARCH_CRIS
 #elif defined(TARGET_I386)
 #define QEMU_ARCH QEMU_ARCH_I386
+#elif defined(TARGET_HPPA)
+#define QEMU_ARCH QEMU_ARCH_HPPA
 #elif defined(TARGET_M68K)
 #define QEMU_ARCH QEMU_ARCH_M68K
 #elif defined(TARGET_LM32)
diff --git a/hw/hppa/Makefile.objs b/hw/hppa/Makefile.objs
new file mode 100644 (file)
index 0000000..46b2ae1
--- /dev/null
@@ -0,0 +1 @@
+obj-y += machine.o
diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
new file mode 100644 (file)
index 0000000..79958da
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * QEMU HPPA hardware system emulator.
+ * Copyright 2018 Helge Deller <deller@gmx.de>
+ */
+
+#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
+#include "hw/hw.h"
+#include "elf.h"
+#include "hw/loader.h"
+#include "hw/boards.h"
+#include "qemu/error-report.h"
+#include "sysemu/sysemu.h"
+#include "hw/timer/mc146818rtc.h"
+#include "hw/ide.h"
+#include "hw/timer/i8254.h"
+#include "hw/char/serial.h"
+#include "qemu/cutils.h"
+#include "qapi/error.h"
+
+
+static void machine_hppa_init(MachineState *machine)
+{
+}
+
+static void machine_hppa_machine_init(MachineClass *mc)
+{
+    mc->desc = "HPPA generic machine";
+    mc->init = machine_hppa_init;
+    mc->block_default_type = IF_SCSI;
+    mc->max_cpus = 1;
+    mc->is_default = 1;
+    mc->default_ram_size = 512 * M_BYTE;
+    mc->default_boot_order = "cd";
+}
+
+DEFINE_MACHINE("hppa", machine_hppa_machine_init)
index 8751c468eddd48cae58bc5074a1401b90702357f..f999bfd3bec51ea023fa9ce0f98b1b7c6e8a3d8e 100644 (file)
@@ -24,6 +24,7 @@ enum {
     QEMU_ARCH_MOXIE = (1 << 15),
     QEMU_ARCH_TRICORE = (1 << 16),
     QEMU_ARCH_NIOS2 = (1 << 17),
+    QEMU_ARCH_HPPA = (1 << 18),
 };
 
 extern const uint32_t arch_type;
index 263446fa0b0eb2f91f3f1a1fcdd0983b968f6375..d89285307ba5e663c928f75eeb1b60591642f551 100644 (file)
@@ -1 +1 @@
-obj-y += translate.o helper.o cpu.o op_helper.o gdbstub.o
+obj-y += translate.o helper.o cpu.o op_helper.o gdbstub.o mem_helper.o
index 9e7b0d4ccbd9b26d1acd8d125e17b26405be5c03..f6d92de9727a01af51f19766d98e173ccc54e1e3 100644 (file)
@@ -132,7 +132,12 @@ static void hppa_cpu_class_init(ObjectClass *oc, void *data)
     cc->synchronize_from_tb = hppa_cpu_synchronize_from_tb;
     cc->gdb_read_register = hppa_cpu_gdb_read_register;
     cc->gdb_write_register = hppa_cpu_gdb_write_register;
+#ifdef CONFIG_USER_ONLY
     cc->handle_mmu_fault = hppa_cpu_handle_mmu_fault;
+#else
+    cc->get_phys_page_debug = hppa_cpu_get_phys_page_debug;
+#endif
+
     cc->disas_set_info = hppa_cpu_disas_set_info;
     cc->tcg_initialize = hppa_translate_init;
 
index 1a35eae1fa5456c8df5c315d209a6e69c1d4b828..3d170c3cf72a6f29b150f0ede442ce5564da63a0 100644 (file)
@@ -134,6 +134,7 @@ void cpu_hppa_loaded_fr0(CPUHPPAState *env);
 int cpu_hppa_signal_handler(int host_signum, void *pinfo, void *puc);
 int hppa_cpu_handle_mmu_fault(CPUState *cpu, vaddr address, int size,
                               int rw, int midx);
+hwaddr hppa_cpu_get_phys_page_debug(CPUState *cs, vaddr addr);
 int hppa_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
 int hppa_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
 void hppa_cpu_do_interrupt(CPUState *cpu);
index 23f7af7018a6bad0f5425077d4e8cf856f062eed..d6d6f06cb0619ff42beb58f53513f1dcdc0a215b 100644 (file)
@@ -65,16 +65,6 @@ void cpu_hppa_put_psw(CPUHPPAState *env, target_ulong psw)
     env->psw_cb = cb;
 }
 
-int hppa_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size,
-                              int rw, int mmu_idx)
-{
-    HPPACPU *cpu = HPPA_CPU(cs);
-
-    cs->exception_index = EXCP_SIGSEGV;
-    cpu->env.ior = address;
-    return 1;
-}
-
 void hppa_cpu_do_interrupt(CPUState *cs)
 {
     HPPACPU *cpu = HPPA_CPU(cs);
diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c
new file mode 100644 (file)
index 0000000..a3e576f
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ *  HPPA memory access helper routines
+ *
+ *  Copyright (c) 2017 Helge Deller
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "qemu/osdep.h"
+#include "cpu.h"
+#include "exec/exec-all.h"
+#include "exec/helper-proto.h"
+#include "qom/cpu.h"
+
+#ifdef CONFIG_USER_ONLY
+int hppa_cpu_handle_mmu_fault(CPUState *cs, vaddr address,
+                              int size, int rw, int mmu_idx)
+{
+    HPPACPU *cpu = HPPA_CPU(cs);
+
+    cs->exception_index = EXCP_SIGSEGV;
+    cpu->env.ior = address;
+    return 1;
+}
+#else
+hwaddr hppa_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
+{
+    /* Stub */
+    return addr;
+}
+
+void tlb_fill(CPUState *cs, target_ulong addr, MMUAccessType type,
+              int mmu_idx, uintptr_t retaddr)
+{
+    /* Stub */
+    int prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
+    hwaddr phys = addr;
+
+    /* Success!  Store the translation into the QEMU TLB.  */
+    tlb_set_page(cs, addr & TARGET_PAGE_MASK, phys & TARGET_PAGE_MASK,
+                 prot, mmu_idx, TARGET_PAGE_SIZE);
+}
+#endif /* CONFIG_USER_ONLY */
index fdbf64ae3c9b7121bad2880316e0735fa6660185..9076ee998d6ba59aac04e9c77e8aade9e2047c6c 100644 (file)
@@ -58,9 +58,9 @@ void HELPER(tcond)(CPUHPPAState *env, target_ulong cond)
 static void atomic_store_3(CPUHPPAState *env, target_ulong addr, uint32_t val,
                            uint32_t mask, uintptr_t ra)
 {
+#ifdef CONFIG_USER_ONLY
     uint32_t old, new, cmp;
 
-#ifdef CONFIG_USER_ONLY
     uint32_t *haddr = g2h(addr - 1);
     old = *haddr;
     while (1) {
@@ -72,7 +72,8 @@ static void atomic_store_3(CPUHPPAState *env, target_ulong addr, uint32_t val,
         old = cmp;
     }
 #else
-#error "Not implemented."
+    /* FIXME -- we can do better.  */
+    cpu_loop_exit_atomic(ENV_GET_CPU(env), ra);
 #endif
 }
 
@@ -158,12 +159,20 @@ void HELPER(stby_e_parallel)(CPUHPPAState *env, target_ulong addr,
 
 target_ulong HELPER(probe_r)(target_ulong addr)
 {
+#ifdef CONFIG_USER_ONLY
     return page_check_range(addr, 1, PAGE_READ);
+#else
+    return 1; /* FIXME */
+#endif
 }
 
 target_ulong HELPER(probe_w)(target_ulong addr)
 {
+#ifdef CONFIG_USER_ONLY
     return page_check_range(addr, 1, PAGE_WRITE);
+#else
+    return 1; /* FIXME */
+#endif
 }
 
 void HELPER(loaded_fr0)(CPUHPPAState *env)