From nobody Tue Feb 10 22:17:22 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529497790861333.66363440522264; Wed, 20 Jun 2018 05:29:50 -0700 (PDT) Received: from localhost ([::1]:49114 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVcFC-0005Cc-48 for importer@patchew.org; Wed, 20 Jun 2018 08:29:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36137) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVbyg-0007Jm-DT for qemu-devel@nongnu.org; Wed, 20 Jun 2018 08:12:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVbyd-0006ni-7E for qemu-devel@nongnu.org; Wed, 20 Jun 2018 08:12:46 -0400 Received: from 9pmail.ess.barracuda.com ([64.235.154.211]:43704) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fVbyc-0006fu-UV for qemu-devel@nongnu.org; Wed, 20 Jun 2018 08:12:43 -0400 Received: from mipsdag02.mipstec.com (mail2.mips.com [12.201.5.32]) by mx1403.ess.rzc.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA256 bits=128 verify=NO); Wed, 20 Jun 2018 12:12:33 +0000 Received: from ubuntu1404.mipstec.com (192.168.40.13) by mipsdag02.mipstec.com (10.20.40.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1415.2; Wed, 20 Jun 2018 05:12:10 -0700 From: Yongbok Kim To: Date: Wed, 20 Jun 2018 13:06:08 +0100 Message-ID: <20180620120620.12806-24-yongbok.kim@mips.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20180620120620.12806-1-yongbok.kim@mips.com> References: <20180620120620.12806-1-yongbok.kim@mips.com> MIME-Version: 1.0 X-Originating-IP: [192.168.40.13] X-ClientProxiedBy: mipsdag02.mipstec.com (10.20.40.47) To mipsdag02.mipstec.com (10.20.40.47) X-BESS-ID: 1529496721-321459-12806-48465-4 X-BESS-VER: 2018.7-r1806151722 X-BESS-Apparent-Source-IP: 12.201.5.32 X-BESS-Envelope-From: Yongbok.Kim@mips.com X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.194221 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS59374 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-Orig-Rcpt: qemu-devel@nongnu.org,aurelien@aurel32.net X-BESS-BRTS-Status: 1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 64.235.154.211 Subject: [Qemu-devel] [PATCH 23/35] target/mips: Update BadInstr{P} regs on nanoMIPS 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: Aleksandar.Markovic@mips.com, Paul.Burton@mips.com, Stefan.Markovic@mips.com, Matthew.Fortune@mips.com, James.Hogan@mips.com, aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Yongbok Kim Update BadInstr{P} registers on nanoMIPS Signed-off-by: Yongbok Kim --- target/mips/helper.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/target/mips/helper.c b/target/mips/helper.c index e215af9..5299f21 100644 --- a/target/mips/helper.c +++ b/target/mips/helper.c @@ -683,7 +683,28 @@ static void set_hflags_for_handler (CPUMIPSState *env) static inline void set_badinstr_registers(CPUMIPSState *env) { if (env->hflags & MIPS_HFLAG_M16) { - /* TODO: add BadInstr support for microMIPS */ + uint32_t instr; + if (!(env->insn_flags & ISA_NANOMIPS32)) { + /* TODO: add BadInstr support for pre-nanoMIPS */ + return; + } + if (env->CP0_Config3 & (1 << CP0C3_BI)) { + instr =3D (cpu_lduw_code(env, env->active_tc.PC)) << 16; + if ((env->insn_flags & ISA_NANOMIPS32) && + ((instr & 0x10000000) =3D=3D 0)) { + instr |=3D cpu_lduw_code(env, env->active_tc.PC + 2); + } + env->CP0_BadInstr =3D instr; + } + if ((env->CP0_Config3 & (1 << CP0C3_BP)) && + (env->hflags & MIPS_HFLAG_BMASK)) { + if (!(env->hflags & MIPS_HFLAG_B16)) { + env->CP0_BadInstrP =3D cpu_ldl_code(env, env->active_tc.PC= - 4); + } else { + env->CP0_BadInstrP =3D + (cpu_lduw_code(env, env->active_tc.PC - 2)) << 16; + } + } return; } if (env->CP0_Config3 & (1 << CP0C3_BI)) { --=20 1.9.1