From patchwork Fri Jun 15 09:47:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guan Xuetao X-Patchwork-Id: 165072 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 14B9BB7067 for ; Fri, 15 Jun 2012 19:51:04 +1000 (EST) Received: from localhost ([::1]:41178 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfTBF-0007qg-NO for incoming@patchwork.ozlabs.org; Fri, 15 Jun 2012 05:51:01 -0400 Received: from eggs.gnu.org ([208.118.235.92]:33846) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfTAZ-0006Wn-O0 for qemu-devel@nongnu.org; Fri, 15 Jun 2012 05:50:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SfTAX-000110-Fy for qemu-devel@nongnu.org; Fri, 15 Jun 2012 05:50:19 -0400 Received: from mprc.pku.edu.cn ([162.105.203.9]:52955) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfTAW-00010l-Ku for qemu-devel@nongnu.org; Fri, 15 Jun 2012 05:50:17 -0400 Received: from linuxdev-32 ([162.105.203.8]) by mprc.pku.edu.cn (8.13.8/8.13.8) with ESMTP id q5FAQ3Aw006935; Fri, 15 Jun 2012 18:26:03 +0800 Received: by linuxdev-32 (Postfix, from userid 1000) id 167EE146026D; Fri, 15 Jun 2012 17:47:58 +0800 (CST) From: Guan Xuetao To: qemu-devel@nongnu.org Date: Fri, 15 Jun 2012 17:47:34 +0800 Message-Id: X-Mailer: git-send-email 1.7.0.4 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 162.105.203.9 Cc: blauwirbel@gmail.com, Guan Xuetao , afaerber@suse.de, chenwj@iis.sinica.edu.tw Subject: [Qemu-devel] [PATCHv2 01/13] unicore32-softmmu: Add unicore32-softmmu build support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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. Signed-off-by: Guan Xuetao --- Makefile.target | 2 + arch_init.c | 2 + arch_init.h | 1 + configure | 1 + default-configs/unicore32-softmmu.mak | 1 + target-unicore32/helper.c | 25 +++++++++++---------- target-unicore32/machine.c | 23 +++++++++++++++++++ target-unicore32/op_helper.c | 24 +++++++++++++++++++- target-unicore32/softmmu.c | 39 +++++++++++++++++++++++++++++++++ 9 files changed, 105 insertions(+), 13 deletions(-) create mode 100644 default-configs/unicore32-softmmu.mak create mode 100644 target-unicore32/machine.c create mode 100644 target-unicore32/softmmu.c diff --git a/Makefile.target b/Makefile.target index 1582904..7d3b1fd 100644 --- a/Makefile.target +++ b/Makefile.target @@ -387,6 +387,8 @@ obj-xtensa-y += core-dc232b.o obj-xtensa-y += core-dc233c.o obj-xtensa-y += core-fsf.o +obj-unicore32-y += softmmu.o + main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS) monitor.o: hmp-commands.h qmp-commands-old.h diff --git a/arch_init.c b/arch_init.c index 988adca..9314025 100644 --- a/arch_init.c +++ b/arch_init.c @@ -81,6 +81,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; diff --git a/arch_init.h b/arch_init.h index c7cb94a..5298139 100644 --- a/arch_init.h +++ b/arch_init.h @@ -16,6 +16,7 @@ enum { QEMU_ARCH_SH4 = 1024, QEMU_ARCH_SPARC = 2048, QEMU_ARCH_XTENSA = 4096, + QEMU_ARCH_UNICORE32 = 8192, }; extern const uint32_t arch_type; diff --git a/configure b/configure index b55a792..795b7d9 100755 --- a/configure +++ b/configure @@ -934,6 +934,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 index 0000000..5f04fe3 --- /dev/null +++ b/default-configs/unicore32-softmmu.mak @@ -0,0 +1 @@ +# Default configuration for unicore32-softmmu diff --git a/target-unicore32/helper.c b/target-unicore32/helper.c index 9fe4a37..17d9b41 100644 --- a/target-unicore32/helper.c +++ b/target-unicore32/helper.c @@ -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 index 0000000..60b2ec1 --- /dev/null +++ b/target-unicore32/machine.c @@ -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; +} diff --git a/target-unicore32/op_helper.c b/target-unicore32/op_helper.c index b954c30..d96d2c8 100644 --- a/target-unicore32/op_helper.c +++ b/target-unicore32/op_helper.c @@ -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 index 0000000..6fec77e --- /dev/null +++ b/target-unicore32/softmmu.c @@ -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 + +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; +}