From patchwork Fri Sep 7 17:43:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Fredrik Noring X-Patchwork-Id: 10606149 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1F7CB14BD for ; Wed, 19 Sep 2018 18:17:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 12D6B2CAA5 for ; Wed, 19 Sep 2018 18:17:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10ED52CAB7; Wed, 19 Sep 2018 18:17:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.5 required=2.0 tests=BAYES_00,DATE_IN_PAST_96_XX, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8A23C2CA71 for ; Wed, 19 Sep 2018 18:17:21 +0000 (UTC) Received: from localhost ([::1]:46654 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2h2O-0007kV-HI for patchwork-qemu-devel@patchwork.kernel.org; Wed, 19 Sep 2018 14:17:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47468) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2h0T-0005p7-He for qemu-devel@nongnu.org; Wed, 19 Sep 2018 14:15:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g2h0H-0004Z5-Tl for qemu-devel@nongnu.org; Wed, 19 Sep 2018 14:15:17 -0400 Received: from pio-pvt-msa2.bahnhof.se ([79.136.2.41]:47283) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g2h0H-0004UJ-Hf for qemu-devel@nongnu.org; Wed, 19 Sep 2018 14:15:09 -0400 Received: from localhost (localhost [127.0.0.1]) by pio-pvt-msa2.bahnhof.se (Postfix) with ESMTP id 32A053F32B; Wed, 19 Sep 2018 20:15:08 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at bahnhof.se X-Amavis-Alert: BAD HEADER SECTION, Non-encoded 8-bit data (char C3 hex): To: ...>, \n \tPhilippe Mathieu-Daud\303\203\302\251 Received: from pio-pvt-msa2.bahnhof.se ([127.0.0.1]) by localhost (pio-pvt-msa2.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BgVtiPnnrkAa; Wed, 19 Sep 2018 20:14:59 +0200 (CEST) Received: from localhost (h-155-4-135-114.NA.cust.bahnhof.se [155.4.135.114]) (Authenticated sender: mb547485) by pio-pvt-msa2.bahnhof.se (Postfix) with ESMTPA id 041963F5EC; Wed, 19 Sep 2018 20:14:58 +0200 (CEST) X-Mailbox-Line: From 2569492bc07f1a5c2d0d749a7f3173981dacbfcf Mon Sep 17 00:00:00 2001 Message-Id: <2569492bc07f1a5c2d0d749a7f3173981dacbfcf.1537379317.git.noring@nocrew.org> In-Reply-To: References: From: Fredrik Noring Date: Fri, 7 Sep 2018 19:43:36 +0200 MIME-Version: 1.0 To: =?unknown-8bit?q?Aleksandar_Markovic_=3Camarkovic=40wavecomp=2Ecom=3E=2C?= =?unknown-8bit?q?_=22Maciej_W=2E_Rozycki=22_=3Cmacro=40linux-mips=2Eorg=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Philippe_Mathieu-Daud=C3=A9_=3Cf4bug=40amsat=2Eorg=3E?= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 79.136.2.41 Subject: [Qemu-devel] [PATCH v5 1/8] target/mips: Define R5900 instructions and CPU preprocessor constants X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?unknown-8bit?q?Peter_Maydell_=3Cpeter=2Emaydell=40linaro=2Eorg=3E=2C_R?= =?unknown-8bit?q?ichard_Henderson_=3Crichard=2Ehenderson=40linaro=2Eorg=3E?= =?unknown-8bit?q?=2C_qemu-devel=40nongnu=2Eorg=2C_J=C3=BCrgen_Urban_=3CJuer?= =?unknown-8bit?q?genUrban=40gmx=2Ede=3E=2C_Petar_Jovanovic_=3Cpjovanovic=40?= =?unknown-8bit?q?wavecomp=2Ecom=3E=2C_Aurelien_Jarno_=3Caurelien=40aurel32?= =?unknown-8bit?q?=2Enet=3E?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The R5900 implements the 64-bit MIPS III instruction set except DMULT, DMULTU, DDIV, DDIVU, LL, SC, LLD and SCD. The MIPS IV instructions MOVN, MOVZ and PREF are implemented. It has the R5900 specific three-operand instructions MADD, MADDU, MULT and MULTU as well as pipeline 1 versions MULT1, MULTU1, DIV1, DIVU1, MADD1, MADDU1, MFHI1, MFLO1, MTHI1 and MTLO1. A set of 93 128-bit multimedia instructions specific to the R5900 is also implemented. The Toshiba TX System RISC TX79 Core Architecture manual describes the R5900 processor: http://www.lukasz.dk/files/tx79architecture.pdf Signed-off-by: Fredrik Noring Reviewed-by: Philippe Mathieu-Daudé --- target/mips/mips-defs.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/mips/mips-defs.h b/target/mips/mips-defs.h index c8e99791ad..76550de2da 100644 --- a/target/mips/mips-defs.h +++ b/target/mips/mips-defs.h @@ -53,6 +53,7 @@ #define ASE_MSA 0x01000000 /* Chip specific instructions. */ +#define INSN_R5900 0x10000000 #define INSN_LOONGSON2E 0x20000000 #define INSN_LOONGSON2F 0x40000000 #define INSN_VR54XX 0x80000000 @@ -63,6 +64,7 @@ #define CPU_MIPS3 (CPU_MIPS2 | ISA_MIPS3) #define CPU_MIPS4 (CPU_MIPS3 | ISA_MIPS4) #define CPU_VR54XX (CPU_MIPS4 | INSN_VR54XX) +#define CPU_R5900 (CPU_MIPS3 | INSN_R5900) #define CPU_LOONGSON2E (CPU_MIPS3 | INSN_LOONGSON2E) #define CPU_LOONGSON2F (CPU_MIPS3 | INSN_LOONGSON2F) From patchwork Sat Sep 15 09:25:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fredrik Noring X-Patchwork-Id: 10606157 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 23F8014BD for ; Wed, 19 Sep 2018 18:20:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 179F52C63D for ; Wed, 19 Sep 2018 18:20:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0BC7B2CA61; Wed, 19 Sep 2018 18:20:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.5 required=2.0 tests=BAYES_00,DATE_IN_PAST_96_XX, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4A81C2C63D for ; Wed, 19 Sep 2018 18:20:28 +0000 (UTC) Received: from localhost ([::1]:46671 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2h5F-0001ts-IQ for patchwork-qemu-devel@patchwork.kernel.org; Wed, 19 Sep 2018 14:20:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47599) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2h0d-0005vR-7h for qemu-devel@nongnu.org; Wed, 19 Sep 2018 14:15:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g2h0Y-0004tt-BZ for qemu-devel@nongnu.org; Wed, 19 Sep 2018 14:15:31 -0400 Received: from pio-pvt-msa3.bahnhof.se ([79.136.2.42]:41549) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g2h0X-0004c6-Pi for qemu-devel@nongnu.org; Wed, 19 Sep 2018 14:15:26 -0400 Received: from localhost (localhost [127.0.0.1]) by pio-pvt-msa3.bahnhof.se (Postfix) with ESMTP id CCF7E3F4A5; Wed, 19 Sep 2018 20:15:07 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at bahnhof.se X-Amavis-Alert: BAD HEADER SECTION, Non-encoded 8-bit data (char C3 hex): To: ...>, \n \tPhilippe Mathieu-Daud\303\203\302\251 Received: from pio-pvt-msa3.bahnhof.se ([127.0.0.1]) by localhost (pio-pvt-msa3.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wbj14LFySQal; Wed, 19 Sep 2018 20:15:02 +0200 (CEST) Received: from localhost (h-155-4-135-114.NA.cust.bahnhof.se [155.4.135.114]) (Authenticated sender: mb547485) by pio-pvt-msa3.bahnhof.se (Postfix) with ESMTPA id 4ED693F6C3; Wed, 19 Sep 2018 20:15:02 +0200 (CEST) X-Mailbox-Line: From fd1b1f640912284963bb1d9974a80f35cc1d4a72 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Fredrik Noring Date: Sat, 15 Sep 2018 11:25:37 +0200 To: =?unknown-8bit?q?Aleksandar_Markovic_=3Camarkovic=40wavecomp=2Ecom=3E=2C?= =?unknown-8bit?q?_=22Maciej_W=2E_Rozycki=22_=3Cmacro=40linux-mips=2Eorg=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Philippe_Mathieu-Daud=C3=A9_=3Cf4bug=40amsat=2Eorg=3E?= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 79.136.2.42 Subject: [Qemu-devel] [PATCH v5 2/8] target/mips: Support R5900 specific three-operand MULT and MULTU X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?unknown-8bit?q?Peter_Maydell_=3Cpeter=2Emaydell=40linaro=2Eorg=3E=2C_R?= =?unknown-8bit?q?ichard_Henderson_=3Crichard=2Ehenderson=40linaro=2Eorg=3E?= =?unknown-8bit?q?=2C_qemu-devel=40nongnu=2Eorg=2C_J=C3=BCrgen_Urban_=3CJuer?= =?unknown-8bit?q?genUrban=40gmx=2Ede=3E=2C_Petar_Jovanovic_=3Cpjovanovic=40?= =?unknown-8bit?q?wavecomp=2Ecom=3E=2C_Aurelien_Jarno_=3Caurelien=40aurel32?= =?unknown-8bit?q?=2Enet=3E?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Fredrik Noring --- target/mips/translate.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/target/mips/translate.c b/target/mips/translate.c index ab16cdb911..fb571e278e 100644 --- a/target/mips/translate.c +++ b/target/mips/translate.c @@ -3768,6 +3768,57 @@ static void gen_muldiv(DisasContext *ctx, uint32_t opc, tcg_temp_free(t1); } +static void gen_mul_r5900(DisasContext *ctx, uint32_t opc, + int acc, int rd, int rs, int rt) +{ + TCGv t0 = tcg_temp_new(); + TCGv t1 = tcg_temp_new(); + + gen_load_gpr(t0, rs); + gen_load_gpr(t1, rt); + + switch (opc) { + case OPC_MULT: + { + TCGv_i32 t2 = tcg_temp_new_i32(); + TCGv_i32 t3 = tcg_temp_new_i32(); + tcg_gen_trunc_tl_i32(t2, t0); + tcg_gen_trunc_tl_i32(t3, t1); + tcg_gen_muls2_i32(t2, t3, t2, t3); + if (rd) + tcg_gen_ext_i32_tl(cpu_gpr[rd], t2); + tcg_gen_ext_i32_tl(cpu_LO[acc], t2); + tcg_gen_ext_i32_tl(cpu_HI[acc], t3); + tcg_temp_free_i32(t2); + tcg_temp_free_i32(t3); + } + break; + case OPC_MULTU: + { + TCGv_i32 t2 = tcg_temp_new_i32(); + TCGv_i32 t3 = tcg_temp_new_i32(); + tcg_gen_trunc_tl_i32(t2, t0); + tcg_gen_trunc_tl_i32(t3, t1); + tcg_gen_mulu2_i32(t2, t3, t2, t3); + if (rd) + tcg_gen_ext_i32_tl(cpu_gpr[rd], t2); + tcg_gen_ext_i32_tl(cpu_LO[acc], t2); + tcg_gen_ext_i32_tl(cpu_HI[acc], t3); + tcg_temp_free_i32(t2); + tcg_temp_free_i32(t3); + } + break; + default: + MIPS_INVAL("mul R5900"); + generate_exception_end(ctx, EXCP_RI); + goto out; + } + + out: + tcg_temp_free(t0); + tcg_temp_free(t1); +} + static void gen_mul_vr54xx (DisasContext *ctx, uint32_t opc, int rd, int rs, int rt) { @@ -22378,6 +22429,8 @@ static void decode_opc_special_legacy(CPUMIPSState *env, DisasContext *ctx) check_insn(ctx, INSN_VR54XX); op1 = MASK_MUL_VR54XX(ctx->opcode); gen_mul_vr54xx(ctx, op1, rd, rs, rt); + } else if (ctx->insn_flags & INSN_R5900) { + gen_mul_r5900(ctx, op1, 0, rd, rs, rt); } else { gen_muldiv(ctx, op1, rd & 3, rs, rt); } From patchwork Sat Sep 15 08:43:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Fredrik Noring X-Patchwork-Id: 10606163 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D5E2114BD for ; Wed, 19 Sep 2018 18:22:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CAB5D2C644 for ; Wed, 19 Sep 2018 18:22:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE82D2CA5F; Wed, 19 Sep 2018 18:22:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.5 required=2.0 tests=BAYES_00,DATE_IN_PAST_96_XX, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6A4B32C644 for ; Wed, 19 Sep 2018 18:22:44 +0000 (UTC) Received: from localhost ([::1]:46677 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2h7b-0002oI-Fr for patchwork-qemu-devel@patchwork.kernel.org; Wed, 19 Sep 2018 14:22:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47613) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2h0d-0005vs-Od for qemu-devel@nongnu.org; Wed, 19 Sep 2018 14:15:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g2h0a-0004vi-G5 for qemu-devel@nongnu.org; Wed, 19 Sep 2018 14:15:31 -0400 Received: from pio-pvt-msa1.bahnhof.se ([79.136.2.40]:60571) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g2h0Y-0004mP-HI for qemu-devel@nongnu.org; Wed, 19 Sep 2018 14:15:28 -0400 Received: from localhost (localhost [127.0.0.1]) by pio-pvt-msa1.bahnhof.se (Postfix) with ESMTP id D1DB53F4EE; Wed, 19 Sep 2018 20:15:12 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at bahnhof.se X-Amavis-Alert: BAD HEADER SECTION, Non-encoded 8-bit data (char C3 hex): To: ...>, \n \tPhilippe Mathieu-Daud\303\203\302\251 Received: from pio-pvt-msa1.bahnhof.se ([127.0.0.1]) by localhost (pio-pvt-msa1.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id q1bXeIQ0dbY5; Wed, 19 Sep 2018 20:15:05 +0200 (CEST) Received: from localhost (h-155-4-135-114.NA.cust.bahnhof.se [155.4.135.114]) (Authenticated sender: mb547485) by pio-pvt-msa1.bahnhof.se (Postfix) with ESMTPA id AB4DB3F492; Wed, 19 Sep 2018 20:15:05 +0200 (CEST) X-Mailbox-Line: From d99c246f316b91f2b24d915f3ee6b9ecb1fe78b3 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Fredrik Noring Date: Sat, 15 Sep 2018 10:43:26 +0200 MIME-Version: 1.0 To: =?unknown-8bit?q?Aleksandar_Markovic_=3Camarkovic=40wavecomp=2Ecom=3E=2C?= =?unknown-8bit?q?_=22Maciej_W=2E_Rozycki=22_=3Cmacro=40linux-mips=2Eorg=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Philippe_Mathieu-Daud=C3=A9_=3Cf4bug=40amsat=2Eorg=3E?= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 79.136.2.40 Subject: [Qemu-devel] [PATCH v5 3/8] target/mips: Support R5900 instructions MOVN, MOVZ and PREF from MIPS IV X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?unknown-8bit?q?Peter_Maydell_=3Cpeter=2Emaydell=40linaro=2Eorg=3E=2C_R?= =?unknown-8bit?q?ichard_Henderson_=3Crichard=2Ehenderson=40linaro=2Eorg=3E?= =?unknown-8bit?q?=2C_qemu-devel=40nongnu=2Eorg=2C_J=C3=BCrgen_Urban_=3CJuer?= =?unknown-8bit?q?genUrban=40gmx=2Ede=3E=2C_Petar_Jovanovic_=3Cpjovanovic=40?= =?unknown-8bit?q?wavecomp=2Ecom=3E=2C_Aurelien_Jarno_=3Caurelien=40aurel32?= =?unknown-8bit?q?=2Enet=3E?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP CPU_R5900 is defined as CPU_MIPS3 but it has the MIPS IV instructions MOVN, MOVZ and PREF as well. Signed-off-by: Fredrik Noring Reviewed-by: Philippe Mathieu-Daudé --- target/mips/translate.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/target/mips/translate.c b/target/mips/translate.c index fb571e278e..c35be0053b 100644 --- a/target/mips/translate.c +++ b/target/mips/translate.c @@ -22402,7 +22402,7 @@ static void decode_opc_special_legacy(CPUMIPSState *env, DisasContext *ctx) case OPC_MOVN: /* Conditional move */ case OPC_MOVZ: check_insn(ctx, ISA_MIPS4 | ISA_MIPS32 | - INSN_LOONGSON2E | INSN_LOONGSON2F); + INSN_LOONGSON2E | INSN_LOONGSON2F | INSN_R5900); gen_cond_move(ctx, op1, rd, rs, rt); break; case OPC_MFHI: /* Move from HI/LO */ @@ -24986,7 +24986,8 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx) break; case OPC_PREF: check_insn_opc_removed(ctx, ISA_MIPS32R6); - check_insn(ctx, ISA_MIPS4 | ISA_MIPS32); + check_insn(ctx, ISA_MIPS4 | ISA_MIPS32 | + INSN_R5900); /* Treat as NOP. */ break; From patchwork Sun Sep 16 15:04:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Fredrik Noring X-Patchwork-Id: 10606155 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0A6ED14BD for ; Wed, 19 Sep 2018 18:19:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F0D3E2CA5F for ; Wed, 19 Sep 2018 18:19:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4EBC2CA71; Wed, 19 Sep 2018 18:19:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8E3ED2CA5F for ; Wed, 19 Sep 2018 18:19:52 +0000 (UTC) Received: from localhost ([::1]:46665 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2h4p-0001YX-OT for patchwork-qemu-devel@patchwork.kernel.org; Wed, 19 Sep 2018 14:19:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47551) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2h0b-0005uG-LH for qemu-devel@nongnu.org; Wed, 19 Sep 2018 14:15:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g2h0a-0004vW-EK for qemu-devel@nongnu.org; Wed, 19 Sep 2018 14:15:29 -0400 Received: from pio-pvt-msa2.bahnhof.se ([79.136.2.41]:47293) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g2h0Y-0004rT-GR for qemu-devel@nongnu.org; Wed, 19 Sep 2018 14:15:28 -0400 Received: from localhost (localhost [127.0.0.1]) by pio-pvt-msa2.bahnhof.se (Postfix) with ESMTP id CCFD63F66A; Wed, 19 Sep 2018 20:15:17 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at bahnhof.se X-Amavis-Alert: BAD HEADER SECTION, Non-encoded 8-bit data (char C3 hex): To: ...>, \n \tPhilippe Mathieu-Daud\303\203\302\251 Received: from pio-pvt-msa2.bahnhof.se ([127.0.0.1]) by localhost (pio-pvt-msa2.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dtiSpKxtxu1J; Wed, 19 Sep 2018 20:15:09 +0200 (CEST) Received: from localhost (h-155-4-135-114.NA.cust.bahnhof.se [155.4.135.114]) (Authenticated sender: mb547485) by pio-pvt-msa2.bahnhof.se (Postfix) with ESMTPA id 0A8133F5EC; Wed, 19 Sep 2018 20:15:09 +0200 (CEST) X-Mailbox-Line: From 3645d754c001aa9ae3f4f363bf5d53f1fa1b2044 Mon Sep 17 00:00:00 2001 Message-Id: <3645d754c001aa9ae3f4f363bf5d53f1fa1b2044.1537379317.git.noring@nocrew.org> In-Reply-To: References: From: Fredrik Noring Date: Sun, 16 Sep 2018 17:04:12 +0200 MIME-Version: 1.0 To: =?unknown-8bit?q?Aleksandar_Markovic_=3Camarkovic=40wavecomp=2Ecom=3E=2C?= =?unknown-8bit?q?_=22Maciej_W=2E_Rozycki=22_=3Cmacro=40linux-mips=2Eorg=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Philippe_Mathieu-Daud=C3=A9_=3Cf4bug=40amsat=2Eorg=3E?= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 79.136.2.41 Subject: [Qemu-devel] [PATCH v5 4/8] target/mips: Add function to signal RI exception unless user only X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?unknown-8bit?q?Peter_Maydell_=3Cpeter=2Emaydell=40linaro=2Eorg=3E=2C_R?= =?unknown-8bit?q?ichard_Henderson_=3Crichard=2Ehenderson=40linaro=2Eorg=3E?= =?unknown-8bit?q?=2C_qemu-devel=40nongnu=2Eorg=2C_J=C3=BCrgen_Urban_=3CJuer?= =?unknown-8bit?q?genUrban=40gmx=2Ede=3E=2C_Petar_Jovanovic_=3Cpjovanovic=40?= =?unknown-8bit?q?wavecomp=2Ecom=3E=2C_Aurelien_Jarno_=3Caurelien=40aurel32?= =?unknown-8bit?q?=2Enet=3E?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The Linux kernel traps and emulates certain instructions. For user only, QEMU is the kernel, so we emulate those traps by simply emulating the instructions directly. Signed-off-by: Fredrik Noring Reviewed-by: Philippe Mathieu-Daudé --- target/mips/translate.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/target/mips/translate.c b/target/mips/translate.c index c35be0053b..2fe46f8775 100644 --- a/target/mips/translate.c +++ b/target/mips/translate.c @@ -1887,6 +1887,18 @@ static inline void check_insn_opc_removed(DisasContext *ctx, int flags) } } +/* + * Unless user only, when the kernel emulates the code, a "reserved + * instruction" exception is generated if the CPU has corresponding + * flag set which indicates that the instruction has been removed. + */ +static inline void check_insn_opc_user_only(DisasContext *ctx, int flags) +{ +#ifndef CONFIG_USER_ONLY + check_insn_opc_removed(ctx, flags); +#endif +} + /* This code generates a "reserved instruction" exception if the CPU does not support 64-bit paired-single (PS) floating point data type */ static inline void check_ps(DisasContext *ctx) From patchwork Sun Sep 16 15:13:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Fredrik Noring X-Patchwork-Id: 10606153 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 78F9E14BD for ; Wed, 19 Sep 2018 18:18:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A8D82BA19 for ; Wed, 19 Sep 2018 18:18:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5D6802BA2C; Wed, 19 Sep 2018 18:18:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F2C642BA19 for ; Wed, 19 Sep 2018 18:18:09 +0000 (UTC) Received: from localhost ([::1]:46656 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2h3B-0000J6-7g for patchwork-qemu-devel@patchwork.kernel.org; Wed, 19 Sep 2018 14:18:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47617) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2h0d-0005vu-Q6 for qemu-devel@nongnu.org; Wed, 19 Sep 2018 14:15:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g2h0b-0004wq-1o for qemu-devel@nongnu.org; Wed, 19 Sep 2018 14:15:31 -0400 Received: from pio-pvt-msa1.bahnhof.se ([79.136.2.40]:60598) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g2h0a-0004uy-LZ for qemu-devel@nongnu.org; Wed, 19 Sep 2018 14:15:28 -0400 Received: from localhost (localhost [127.0.0.1]) by pio-pvt-msa1.bahnhof.se (Postfix) with ESMTP id 751AF3F492; Wed, 19 Sep 2018 20:15:17 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at bahnhof.se X-Amavis-Alert: BAD HEADER SECTION, Non-encoded 8-bit data (char C3 hex): To: ...>, \n \tPhilippe Mathieu-Daud\303\203\302\251 Received: from pio-pvt-msa1.bahnhof.se ([127.0.0.1]) by localhost (pio-pvt-msa1.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3N-lPAkqTQaq; Wed, 19 Sep 2018 20:15:12 +0200 (CEST) Received: from localhost (h-155-4-135-114.NA.cust.bahnhof.se [155.4.135.114]) (Authenticated sender: mb547485) by pio-pvt-msa1.bahnhof.se (Postfix) with ESMTPA id 5B82D3F4A5; Wed, 19 Sep 2018 20:15:12 +0200 (CEST) X-Mailbox-Line: From 3aa7b117fffbe430dd3115716b0251b855e68ced Mon Sep 17 00:00:00 2001 Message-Id: <3aa7b117fffbe430dd3115716b0251b855e68ced.1537379317.git.noring@nocrew.org> In-Reply-To: References: From: Fredrik Noring Date: Sun, 16 Sep 2018 17:13:03 +0200 MIME-Version: 1.0 To: =?unknown-8bit?q?Aleksandar_Markovic_=3Camarkovic=40wavecomp=2Ecom=3E=2C?= =?unknown-8bit?q?_=22Maciej_W=2E_Rozycki=22_=3Cmacro=40linux-mips=2Eorg=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Philippe_Mathieu-Daud=C3=A9_=3Cf4bug=40amsat=2Eorg=3E?= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 79.136.2.40 Subject: [Qemu-devel] [PATCH v5 5/8] target/mips: R5900 DMULT[U], DDIV[U], LL[D] and SC[D] are user only X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?unknown-8bit?q?Peter_Maydell_=3Cpeter=2Emaydell=40linaro=2Eorg=3E=2C_R?= =?unknown-8bit?q?ichard_Henderson_=3Crichard=2Ehenderson=40linaro=2Eorg=3E?= =?unknown-8bit?q?=2C_qemu-devel=40nongnu=2Eorg=2C_J=C3=BCrgen_Urban_=3CJuer?= =?unknown-8bit?q?genUrban=40gmx=2Ede=3E=2C_Petar_Jovanovic_=3Cpjovanovic=40?= =?unknown-8bit?q?wavecomp=2Ecom=3E=2C_Aurelien_Jarno_=3Caurelien=40aurel32?= =?unknown-8bit?q?=2Enet=3E?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP These MIPS III instructions are unavailable and therefore trapped and emulated by the Linux kernel. Signed-off-by: Fredrik Noring Reviewed-by: Philippe Mathieu-Daudé --- target/mips/translate.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/target/mips/translate.c b/target/mips/translate.c index 2fe46f8775..67a6070e4f 100644 --- a/target/mips/translate.c +++ b/target/mips/translate.c @@ -22457,6 +22457,7 @@ static void decode_opc_special_legacy(CPUMIPSState *env, DisasContext *ctx) case OPC_DDIV: case OPC_DDIVU: check_insn(ctx, ISA_MIPS3); + check_insn_opc_user_only(ctx, INSN_R5900); check_mips_64(ctx); gen_muldiv(ctx, op1, 0, rs, rt); break; @@ -24960,6 +24961,7 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx) break; case OPC_LL: /* Load and stores */ check_insn(ctx, ISA_MIPS2); + check_insn_opc_user_only(ctx, INSN_R5900); /* Fallthrough */ case OPC_LWL: case OPC_LWR: @@ -24985,6 +24987,7 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx) case OPC_SC: check_insn(ctx, ISA_MIPS2); check_insn_opc_removed(ctx, ISA_MIPS32R6); + check_insn_opc_user_only(ctx, INSN_R5900); gen_st_cond(ctx, op, rt, rs, imm); break; case OPC_CACHE: @@ -25251,9 +25254,11 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx) #if defined(TARGET_MIPS64) /* MIPS64 opcodes */ + case OPC_LLD: + check_insn_opc_user_only(ctx, INSN_R5900); + /* fall through */ case OPC_LDL: case OPC_LDR: - case OPC_LLD: check_insn_opc_removed(ctx, ISA_MIPS32R6); /* fall through */ case OPC_LWU: @@ -25274,6 +25279,7 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx) case OPC_SCD: check_insn_opc_removed(ctx, ISA_MIPS32R6); check_insn(ctx, ISA_MIPS3); + check_insn_opc_user_only(ctx, INSN_R5900); check_mips_64(ctx); gen_st_cond(ctx, op, rt, rs, imm); break; From patchwork Sat Sep 15 09:50:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Fredrik Noring X-Patchwork-Id: 10606151 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AFC766CB for ; Wed, 19 Sep 2018 18:17:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A456C2CA99 for ; Wed, 19 Sep 2018 18:17:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A25592CABB; Wed, 19 Sep 2018 18:17:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.5 required=2.0 tests=BAYES_00,DATE_IN_PAST_96_XX, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 453E92CAAD for ; Wed, 19 Sep 2018 18:17:27 +0000 (UTC) Received: from localhost ([::1]:46655 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2h2U-000890-FC for patchwork-qemu-devel@patchwork.kernel.org; Wed, 19 Sep 2018 14:17:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47590) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2h0d-0005vL-3H for qemu-devel@nongnu.org; Wed, 19 Sep 2018 14:15:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g2h0Y-0004ta-8j for qemu-devel@nongnu.org; Wed, 19 Sep 2018 14:15:30 -0400 Received: from pio-pvt-msa1.bahnhof.se ([79.136.2.40]:60564) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g2h0V-0004kd-Ej for qemu-devel@nongnu.org; Wed, 19 Sep 2018 14:15:25 -0400 Received: from localhost (localhost [127.0.0.1]) by pio-pvt-msa1.bahnhof.se (Postfix) with ESMTP id 97CFF3F551; Wed, 19 Sep 2018 20:15:16 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at bahnhof.se X-Amavis-Alert: BAD HEADER SECTION, Non-encoded 8-bit data (char C3 hex): To: ...>, \n \tPhilippe Mathieu-Daud\303\203\302\251 Received: from pio-pvt-msa1.bahnhof.se ([127.0.0.1]) by localhost (pio-pvt-msa1.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MBs5xQY39GyH; Wed, 19 Sep 2018 20:15:15 +0200 (CEST) Received: from localhost (h-155-4-135-114.NA.cust.bahnhof.se [155.4.135.114]) (Authenticated sender: mb547485) by pio-pvt-msa1.bahnhof.se (Postfix) with ESMTPA id C33063F492; Wed, 19 Sep 2018 20:15:15 +0200 (CEST) X-Mailbox-Line: From b4a7f8e59ba8f6eaa03e7fe24690df7b39b17e8d Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Fredrik Noring Date: Sat, 15 Sep 2018 11:50:32 +0200 To: =?unknown-8bit?q?Aleksandar_Markovic_=3Camarkovic=40wavecomp=2Ecom=3E=2C?= =?unknown-8bit?q?_=22Maciej_W=2E_Rozycki=22_=3Cmacro=40linux-mips=2Eorg=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Philippe_Mathieu-Daud=C3=A9_=3Cf4bug=40amsat=2Eorg=3E?= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 79.136.2.40 Subject: [Qemu-devel] [PATCH v5 6/8] target/mips: Define the R5900 CPU X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?unknown-8bit?q?Peter_Maydell_=3Cpeter=2Emaydell=40linaro=2Eorg=3E=2C_R?= =?unknown-8bit?q?ichard_Henderson_=3Crichard=2Ehenderson=40linaro=2Eorg=3E?= =?unknown-8bit?q?=2C_qemu-devel=40nongnu=2Eorg=2C_J=C3=BCrgen_Urban_=3CJuer?= =?unknown-8bit?q?genUrban=40gmx=2Ede=3E=2C_Petar_Jovanovic_=3Cpjovanovic=40?= =?unknown-8bit?q?wavecomp=2Ecom=3E=2C_Aurelien_Jarno_=3Caurelien=40aurel32?= =?unknown-8bit?q?=2Enet=3E?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The primary purpose of this change is to support programs compiled by GCC for the R5900 target and thereby run R5900 Linux distributions, for example Gentoo. In particular, this avoids issues with cross compilation. This change has been tested with Gentoo compiled for R5900, including native compilation of several packages under QEMU. Signed-off-by: Fredrik Noring Reviewed-by: Philippe Mathieu-Daudé --- target/mips/translate_init.inc.c | 47 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/target/mips/translate_init.inc.c b/target/mips/translate_init.inc.c index b3320b9dc7..71fd83de06 100644 --- a/target/mips/translate_init.inc.c +++ b/target/mips/translate_init.inc.c @@ -410,6 +410,53 @@ const mips_def_t mips_defs[] = .insn_flags = CPU_MIPS32R5 | ASE_MSA, .mmu_type = MMU_TYPE_R4000, }, + { + .name = "R5900", + .CP0_PRid = 0x00003800, + /* No L2 cache, icache size 32k, dcache size 32k, uncached coherency. */ + .CP0_Config0 = (0x3 << 9) | (0x3 << 6) | (0x2 << CP0C0_K0), + .CP0_Status_rw_bitmask = 0xF4C79C1F, +#ifdef CONFIG_USER_ONLY + /* + * R5900 hardware traps to the Linux kernel for IEEE 754-1985 and LL/SC + * emulation. For user only, QEMU is the kernel, so we emulate the traps + * by simply emulating the instructions directly. + * + * Note: Config1 is only used internally, the R5900 has only Config0. + */ + .CP0_Config1 = (1 << CP0C1_FP) | (47 << CP0C1_MMU), + .CP0_LLAddr_rw_bitmask = 0xFFFFFFFF, + .CP0_LLAddr_shift = 4, + .CP1_fcr0 = (0x38 << FCR0_PRID) | (0x0 << FCR0_REV), + .CP1_fcr31 = 0, + .CP1_fcr31_rw_bitmask = 0x0183FFFF, +#else + /* + * The R5900 COP1 FPU implements single-precision floating-point + * operations but is not entirely IEEE 754-1985 compatible. In + * particular, + * + * - NaN (not a number) and plus/minus infinities are not supported; + * - exception mechanisms are not fully supported; + * - denormalized numbers are not supported; + * - rounding towards nearest and plus/minus infinities are not supported; + * - computed results usually differs in the least significant bit; + * - saturating instructions can differ more than the least significant bit. + * + * Since only rounding towards zero is supported, the two least + * significant bits of FCR31 are hardwired to 01. + * + * FPU emulation is disabled here until it is implemented. + * + * Note: Config1 is only used internally, the R5900 has only Config0. + */ + .CP0_Config1 = (47 << CP0C1_MMU), +#endif /* !CONFIG_USER_ONLY */ + .SEGBITS = 32, + .PABITS = 32, + .insn_flags = CPU_R5900, + .mmu_type = MMU_TYPE_R4000, + }, { /* A generic CPU supporting MIPS32 Release 6 ISA. FIXME: Support IEEE 754-2008 FP. From patchwork Sat Sep 15 09:08:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Fredrik Noring X-Patchwork-Id: 10606161 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4B15C6CB for ; Wed, 19 Sep 2018 18:22:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F3062CA44 for ; Wed, 19 Sep 2018 18:22:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 333442C644; Wed, 19 Sep 2018 18:22:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.5 required=2.0 tests=BAYES_00,DATE_IN_PAST_96_XX, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A6EF22C644 for ; Wed, 19 Sep 2018 18:22:21 +0000 (UTC) Received: from localhost ([::1]:46681 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2h7E-0003UJ-7w for patchwork-qemu-devel@patchwork.kernel.org; Wed, 19 Sep 2018 14:22:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47787) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2h0k-00060o-AR for qemu-devel@nongnu.org; Wed, 19 Sep 2018 14:15:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g2h0i-0005AJ-PA for qemu-devel@nongnu.org; Wed, 19 Sep 2018 14:15:37 -0400 Received: from pio-pvt-msa3.bahnhof.se ([79.136.2.42]:41592) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g2h0h-00057B-NJ for qemu-devel@nongnu.org; Wed, 19 Sep 2018 14:15:36 -0400 Received: from localhost (localhost [127.0.0.1]) by pio-pvt-msa3.bahnhof.se (Postfix) with ESMTP id 542933F4A5; Wed, 19 Sep 2018 20:15:29 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at bahnhof.se X-Amavis-Alert: BAD HEADER SECTION, Non-encoded 8-bit data (char C3 hex): To: ...>, \n \tPhilippe Mathieu-Daud\303\203\302\251 Received: from pio-pvt-msa3.bahnhof.se ([127.0.0.1]) by localhost (pio-pvt-msa3.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5OrbqxUk7MyJ; Wed, 19 Sep 2018 20:15:19 +0200 (CEST) Received: from localhost (h-155-4-135-114.NA.cust.bahnhof.se [155.4.135.114]) (Authenticated sender: mb547485) by pio-pvt-msa3.bahnhof.se (Postfix) with ESMTPA id 2E73C3F6C3; Wed, 19 Sep 2018 20:15:19 +0200 (CEST) X-Mailbox-Line: From cc78058bdd47364567d6cacc2bf19569fb358179 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Fredrik Noring Date: Sat, 15 Sep 2018 11:08:54 +0200 MIME-Version: 1.0 To: =?unknown-8bit?q?Aleksandar_Markovic_=3Camarkovic=40wavecomp=2Ecom=3E=2C?= =?unknown-8bit?q?_=22Maciej_W=2E_Rozycki=22_=3Cmacro=40linux-mips=2Eorg=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Philippe_Mathieu-Daud=C3=A9_=3Cf4bug=40amsat=2Eorg=3E?= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 79.136.2.42 Subject: [Qemu-devel] [PATCH v5 7/8] linux-user/mips: Recognise the R5900 CPU model X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?unknown-8bit?q?Peter_Maydell_=3Cpeter=2Emaydell=40linaro=2Eorg=3E=2C_R?= =?unknown-8bit?q?ichard_Henderson_=3Crichard=2Ehenderson=40linaro=2Eorg=3E?= =?unknown-8bit?q?=2C_qemu-devel=40nongnu=2Eorg=2C_J=C3=BCrgen_Urban_=3CJuer?= =?unknown-8bit?q?genUrban=40gmx=2Ede=3E=2C_Petar_Jovanovic_=3Cpjovanovic=40?= =?unknown-8bit?q?wavecomp=2Ecom=3E=2C_Aurelien_Jarno_=3Caurelien=40aurel32?= =?unknown-8bit?q?=2Enet=3E?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Fredrik Noring Reviewed-by: Philippe Mathieu-Daudé --- linux-user/mips/target_elf.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/linux-user/mips/target_elf.h b/linux-user/mips/target_elf.h index fa5d30bf99..a98c9bd6ad 100644 --- a/linux-user/mips/target_elf.h +++ b/linux-user/mips/target_elf.h @@ -12,6 +12,9 @@ static inline const char *cpu_get_model(uint32_t eflags) if ((eflags & EF_MIPS_ARCH) == EF_MIPS_ARCH_32R6) { return "mips32r6-generic"; } + if ((eflags & EF_MIPS_MACH) == EF_MIPS_MACH_5900) { + return "R5900"; + } return "24Kf"; } #endif From patchwork Sat Sep 15 10:28:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Fredrik Noring X-Patchwork-Id: 10606159 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 202D314BD for ; Wed, 19 Sep 2018 18:20:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14BC82CA44 for ; Wed, 19 Sep 2018 18:20:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 08BAB2CA72; Wed, 19 Sep 2018 18:20:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.5 required=2.0 tests=BAYES_00,DATE_IN_PAST_96_XX, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0592A2CA5F for ; Wed, 19 Sep 2018 18:20:54 +0000 (UTC) Received: from localhost ([::1]:46672 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2h5q-0002KN-6R for patchwork-qemu-devel@patchwork.kernel.org; Wed, 19 Sep 2018 14:20:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47904) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2h0o-00063o-16 for qemu-devel@nongnu.org; Wed, 19 Sep 2018 14:15:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g2h0j-0005CP-PX for qemu-devel@nongnu.org; Wed, 19 Sep 2018 14:15:41 -0400 Received: from pio-pvt-msa3.bahnhof.se ([79.136.2.42]:41601) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g2h0i-00058S-G2 for qemu-devel@nongnu.org; Wed, 19 Sep 2018 14:15:37 -0400 Received: from localhost (localhost [127.0.0.1]) by pio-pvt-msa3.bahnhof.se (Postfix) with ESMTP id 0171A3F6C3; Wed, 19 Sep 2018 20:15:35 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at bahnhof.se X-Amavis-Alert: BAD HEADER SECTION, Non-encoded 8-bit data (char C3 hex): To: ...>, \n \tPhilippe Mathieu-Daud\303\203\302\251 Received: from pio-pvt-msa3.bahnhof.se ([127.0.0.1]) by localhost (pio-pvt-msa3.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qbXQuwrULSc2; Wed, 19 Sep 2018 20:15:22 +0200 (CEST) Received: from localhost (h-155-4-135-114.NA.cust.bahnhof.se [155.4.135.114]) (Authenticated sender: mb547485) by pio-pvt-msa3.bahnhof.se (Postfix) with ESMTPA id 7C35E3F73A; Wed, 19 Sep 2018 20:15:22 +0200 (CEST) X-Mailbox-Line: From f4f656135c07d1595c11a24a0c4301d5f2ec805e Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Fredrik Noring Date: Sat, 15 Sep 2018 12:28:05 +0200 MIME-Version: 1.0 To: =?unknown-8bit?q?Aleksandar_Markovic_=3Camarkovic=40wavecomp=2Ecom=3E=2C?= =?unknown-8bit?q?_=22Maciej_W=2E_Rozycki=22_=3Cmacro=40linux-mips=2Eorg=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Philippe_Mathieu-Daud=C3=A9_=3Cf4bug=40amsat=2Eorg=3E?= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 79.136.2.42 Subject: [Qemu-devel] [PATCH v5 8/8] elf: Toshiba/Sony rather than MIPS are the implementors of the R5900 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?unknown-8bit?q?Peter_Maydell_=3Cpeter=2Emaydell=40linaro=2Eorg=3E=2C_R?= =?unknown-8bit?q?ichard_Henderson_=3Crichard=2Ehenderson=40linaro=2Eorg=3E?= =?unknown-8bit?q?=2C_qemu-devel=40nongnu=2Eorg=2C_J=C3=BCrgen_Urban_=3CJuer?= =?unknown-8bit?q?genUrban=40gmx=2Ede=3E=2C_Petar_Jovanovic_=3Cpjovanovic=40?= =?unknown-8bit?q?wavecomp=2Ecom=3E=2C_Aurelien_Jarno_=3Caurelien=40aurel32?= =?unknown-8bit?q?=2Enet=3E?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Sources [1][2] indicate that the Emotion Engine was designed by Toshiba and licensed to Sony. Others [3][4] claim it was a joint effort. It may therefore make sense to refer to the CPU as "Toshiba/Sony R5900". [1] http://cs.nyu.edu/courses/spring02/V22.0480-002/projects/aldrich/emotionengine.ppt [2] http://archive.arstechnica.com/reviews/1q00/playstation2/m-ee-3.html [3] http://docencia.ac.upc.edu/ETSETB/SEGPAR/microprocessors/emotionengine%20(mpr).pdf [4] http://www.eetimes.com/document.asp?doc_id=1144055 Reported-by: Maciej W. Rozycki Signed-off-by: Fredrik Noring Reviewed-by: Philippe Mathieu-Daudé --- include/elf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/elf.h b/include/elf.h index 312f68af81..2510fc7be4 100644 --- a/include/elf.h +++ b/include/elf.h @@ -76,7 +76,7 @@ typedef int64_t Elf64_Sxword; #define EF_MIPS_MACH_OCTEON2 0x008d0000 /* Cavium Networks Octeon2 */ #define EF_MIPS_MACH_OCTEON3 0x008e0000 /* Cavium Networks Octeon3 */ #define EF_MIPS_MACH_5400 0x00910000 /* NEC VR5400 */ -#define EF_MIPS_MACH_5900 0x00920000 /* MIPS R5900 */ +#define EF_MIPS_MACH_5900 0x00920000 /* Toshiba/Sony R5900 */ #define EF_MIPS_MACH_5500 0x00980000 /* NEC VR5500 */ #define EF_MIPS_MACH_9000 0x00990000 /* PMC-Sierra's RM9000 */ #define EF_MIPS_MACH_LS2E 0x00a00000 /* ST Microelectronics Loongson 2E */