From patchwork Thu Dec 11 00:21:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 419909 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0447E140100 for ; Thu, 11 Dec 2014 11:22:39 +1100 (AEDT) Received: from localhost ([::1]:48557 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XyrWf-0004dN-6d for incoming@patchwork.ozlabs.org; Wed, 10 Dec 2014 19:22:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35964) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XyrWD-0004A9-42 for qemu-devel@nongnu.org; Wed, 10 Dec 2014 19:22:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XyrW4-0001jF-SN for qemu-devel@nongnu.org; Wed, 10 Dec 2014 19:22:09 -0500 Received: from relay1.mentorg.com ([192.94.38.131]:59265) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XyrW4-0001j7-Ks for qemu-devel@nongnu.org; Wed, 10 Dec 2014 19:22:00 -0500 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1XyrVx-0000xl-SR from Maciej_Rozycki@mentor.com ; Wed, 10 Dec 2014 16:21:54 -0800 Received: from localhost (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server (TLS) id 14.3.181.6; Thu, 11 Dec 2014 00:21:52 +0000 Date: Thu, 11 Dec 2014 00:21:48 +0000 From: "Maciej W. Rozycki" To: In-Reply-To: Message-ID: References: User-Agent: Alpine 1.10 (DEB 962 2008-03-14) MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic] [fuzzy] X-Received-From: 192.94.38.131 Cc: Leon Alrae , Aurelien Jarno Subject: [Qemu-devel] [PATCH v2 1/2] target-mips: Rework ABIs to allow all required configurations 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 Rework the MIPS ABIs and CPU emulations available according to the following target list: - mips|mipsel -- 32-bit CPUs only, system and user emulation mode, o32 user ABI, - mips64|mips64el -- 32-bit and 64-bit CPUs, system and user emulation mode, o32 user ABI, - mipsn32|mipsn32el -- 64-bit CPUs only, user emulation mode only, n32 user ABI, - mipsn64|mipsn64el -- 64-bit CPUs only, user emulation mode only, n64 user ABI. Signed-off-by: Maciej W. Rozycki --- Changes from v1: - remove n32 and n64 system emulation mode configurations, - fold 1/3 and 2/3 into 1/2. qemu-mips64-abis.diff Index: qemu-git-trunk/bsd-user/elfload.c =================================================================== --- qemu-git-trunk.orig/bsd-user/elfload.c 2014-12-11 00:05:18.000000000 +0000 +++ qemu-git-trunk/bsd-user/elfload.c 2014-12-11 00:05:37.878938825 +0000 @@ -381,7 +381,7 @@ static inline void init_thread(struct ta #define elf_check_arch(x) ( (x) == EM_MIPS ) -#ifdef TARGET_MIPS64 +#ifdef TARGET_ABI_MIPSN64 #define ELF_CLASS ELFCLASS64 #else #define ELF_CLASS ELFCLASS32 Index: qemu-git-trunk/configure =================================================================== --- qemu-git-trunk.orig/configure 2014-12-11 00:05:18.000000000 +0000 +++ qemu-git-trunk/configure 2014-12-11 00:05:37.878938825 +0000 @@ -4982,7 +4982,7 @@ target_name=`echo $target | cut -d '-' - target_bigendian="no" case "$target_name" in - armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or32|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb) + armeb|lm32|m68k|microblaze|mips|mips64|mipsn32|mipsn64|moxie|or32|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb) target_bigendian=yes ;; esac @@ -5057,17 +5057,28 @@ case "$target_name" in ;; mips|mipsel) TARGET_ARCH=mips + echo "TARGET_MIPS32=y" >> $config_target_mak echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak ;; + mips64|mips64el) + TARGET_ARCH=mips64 + TARGET_BASE_ARCH=mips + TARGET_ABI_DIR=mips + echo "TARGET_MIPS32=y" >> $config_target_mak + echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak + echo "TARGET_ABI32=y" >> $config_target_mak + ;; mipsn32|mipsn32el) TARGET_ARCH=mips64 TARGET_BASE_ARCH=mips + TARGET_ABI_DIR=mips64 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak echo "TARGET_ABI32=y" >> $config_target_mak ;; - mips64|mips64el) + mipsn64|mipsn64el) TARGET_ARCH=mips64 TARGET_BASE_ARCH=mips + TARGET_ABI_DIR=mips64 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak ;; tricore) Index: qemu-git-trunk/default-configs/mipsn64-linux-user.mak =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ qemu-git-trunk/default-configs/mipsn64-linux-user.mak 2014-12-11 00:05:45.378923933 +0000 @@ -0,0 +1 @@ +# Default configuration for mipsn64-linux-user Index: qemu-git-trunk/default-configs/mipsn64el-linux-user.mak =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ qemu-git-trunk/default-configs/mipsn64el-linux-user.mak 2014-12-11 00:05:45.378923933 +0000 @@ -0,0 +1 @@ +# Default configuration for mipsn64el-linux-user Index: qemu-git-trunk/include/exec/poison.h =================================================================== --- qemu-git-trunk.orig/include/exec/poison.h 2014-12-11 00:05:18.000000000 +0000 +++ qemu-git-trunk/include/exec/poison.h 2014-12-11 00:05:37.878938825 +0000 @@ -13,7 +13,11 @@ #pragma GCC poison TARGET_LM32 #pragma GCC poison TARGET_M68K #pragma GCC poison TARGET_MIPS +#pragma GCC poison TARGET_MIPS32 #pragma GCC poison TARGET_MIPS64 +#pragma GCC poison TARGET_ABI_MIPSO32 +#pragma GCC poison TARGET_ABI_MIPSN32 +#pragma GCC poison TARGET_ABI_MIPSN64 #pragma GCC poison TARGET_OPENRISC #pragma GCC poison TARGET_PPC #pragma GCC poison TARGET_PPCEMB Index: qemu-git-trunk/linux-user/elfload.c =================================================================== --- qemu-git-trunk.orig/linux-user/elfload.c 2014-12-11 00:05:18.000000000 +0000 +++ qemu-git-trunk/linux-user/elfload.c 2014-12-11 00:05:37.878938825 +0000 @@ -875,7 +875,7 @@ static void elf_core_copy_regs(target_el #define elf_check_arch(x) ( (x) == EM_MIPS ) -#ifdef TARGET_MIPS64 +#ifdef TARGET_ABI_MIPSN64 #define ELF_CLASS ELFCLASS64 #else #define ELF_CLASS ELFCLASS32 @@ -896,10 +896,10 @@ typedef target_elf_greg_t target_elf_gre /* See linux kernel: arch/mips/include/asm/reg.h. */ enum { -#ifdef TARGET_MIPS64 - TARGET_EF_R0 = 0, -#else +#ifdef TARGET_ABI_MIPSO32 TARGET_EF_R0 = 6, +#else + TARGET_EF_R0 = 0, #endif TARGET_EF_R26 = TARGET_EF_R0 + 26, TARGET_EF_R27 = TARGET_EF_R0 + 27, Index: qemu-git-trunk/linux-user/main.c =================================================================== --- qemu-git-trunk.orig/linux-user/main.c 2014-12-11 00:05:18.000000000 +0000 +++ qemu-git-trunk/linux-user/main.c 2014-12-11 00:05:37.878938825 +0000 @@ -3928,7 +3928,7 @@ int main(int argc, char **argv, char **e cpu_model = "Fujitsu MB86904"; #endif #elif defined(TARGET_MIPS) -#if defined(TARGET_ABI_MIPSN32) || defined(TARGET_ABI_MIPSN64) +#ifdef TARGET_MIPS64 cpu_model = "5KEf"; #else cpu_model = "24Kf"; Index: qemu-git-trunk/target-mips/translate_init.c =================================================================== --- qemu-git-trunk.orig/target-mips/translate_init.c 2014-12-11 00:05:18.000000000 +0000 +++ qemu-git-trunk/target-mips/translate_init.c 2014-12-11 00:05:37.878938825 +0000 @@ -107,6 +107,7 @@ struct mips_def_t { /* MIPS CPU definitions */ static const mips_def_t mips_defs[] = { +#if defined(TARGET_MIPS32) { .name = "4Kc", .CP0_PRid = 0x00018000, @@ -421,6 +422,7 @@ static const mips_def_t mips_defs[] = .insn_flags = CPU_MIPS32R5 | ASE_MIPS16 | ASE_MSA, .mmu_type = MMU_TYPE_R4000, }, +#endif #if defined(TARGET_MIPS64) { .name = "R4000",