From nobody Tue Nov 18 14:12:49 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=amsat.org ARC-Seal: i=1; a=rsa-sha256; t=1610641789; cv=none; d=zohomail.com; s=zohoarc; b=Q2XXzre8ylzV9DR7z1We+RDfIHk+vAxOzX2DRM64fmN1bYP3bzMRXmgd3URkv53OTBzVhbFypqT7+8D2oRbBrNE4Ie+hRAt/3f9CONqKC1IKdjOTk+6QJ4bJU1+1iQTF7Nx4StiwCQtkEgXaZc5RThdPcfWGFEOo2Y4PoBZe1iE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610641789; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject; bh=cnbQPb0XjiBSHLb9SRYObkA1cyhmzHvI9I6VzcXNaK8=; b=l/kQS957kcNbSvfhSTIE3miLU0D+SRlFB4+RV4EEgkNNxh6wX1QPtbqe3ha46QY0FPVMKvHr5L36FFrpsp8kcuYlRQdgbb53KkoOGWa2Xdkrn591Sq0flyJdHt61ifakI3bDtxo3ieBG54Kr1nadFCLW+JEPlPjTW9LFBXTogNo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610641789664864.9941999944233; Thu, 14 Jan 2021 08:29:49 -0800 (PST) Received: from localhost ([::1]:34020 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l05VM-0002O7-4l for importer@patchew.org; Thu, 14 Jan 2021 11:29:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38916) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l05Mj-0003bO-0l for qemu-devel@nongnu.org; Thu, 14 Jan 2021 11:20:54 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:54617) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l05Md-0000P8-3R for qemu-devel@nongnu.org; Thu, 14 Jan 2021 11:20:48 -0500 Received: by mail-wm1-x333.google.com with SMTP id i63so5032185wma.4 for ; Thu, 14 Jan 2021 08:20:46 -0800 (PST) Received: from x1w.redhat.com (13.red-83-57-169.dynamicip.rima-tde.net. [83.57.169.13]) by smtp.gmail.com with ESMTPSA id s13sm9018724wmj.28.2021.01.14.08.20.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 08:20:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cnbQPb0XjiBSHLb9SRYObkA1cyhmzHvI9I6VzcXNaK8=; b=SxVQk0Yg0wcrVMH/r3ss++e8v7cSsjisIqQrFCPF4tJ7DmuFj40b1LtHyoa46e92Rg Qqh0J79xj4uSrw8QMVTb+Tvk4++mk8BM3jncFDMbvLF1h4YfD0iLFuenF8qKgnbxa6Wf weldZ4PnvgrVuCJ2eD7/qObOvHFosrHmOHmm2EKXuhSgmQrajcmX4xgOCAlPBLs0sWI/ zZ9J8cgXutsuW8ri1WSx6JVySn3vhooKrl7Wh5kP08kGETEZlrI3JGSNkUJNq3J/1cg1 ezV3jiAIPYD9YXHFPbRVFTu9X/1ncY7ygX2fCZgrs32e5/IhfBvQABq2nz0gi9qOdVqi nZcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=cnbQPb0XjiBSHLb9SRYObkA1cyhmzHvI9I6VzcXNaK8=; b=aQR8rmsvK8dBDba0rPYVJjTS1FMpX4rvZIFGFD/ETW9PqNG3ZZosXqhKxP9L64qATK My/KbYKcGnvkcXaWoYmDXMdDv4LlHknAsS7CPt1u+DcN05YickpkitSSeFkKXB5aFFF4 D4Wn1Gkwxu/ftuEq21qbdeemtwiEV480BJ55Rnw98VcBUpoOjxOfbr++1jZOP9ncFZYo wnkjwOTEO2G2OUJukrCbdztE0ngKIkZFXcvyw2v0BEVBVFCC8eP9pLZ3WlJMOJ5Le/Xd QrfJ89nk5hGAA5T2YPQ8ETEpPiDWCtlvvhvauvXb1a9Mma6FaattdLfKQnjF+W2bnNKy 1O6Q== X-Gm-Message-State: AOAM5324L/cAtCW/0XoIRJlQC3tj/Gu45S1iJVcsA8c8dMx1Hi5J/vnx Sp2QGsSPTg9LT9KdEmkOO1mJMbcUPNc= X-Google-Smtp-Source: ABdhPJw4/WTHRM1A7uZfkAtZCpMKRj0kba/H1H3qk6uF9v5bxw8FF2uOzP1dyDU6t5kQb5I08eIO3w== X-Received: by 2002:a7b:c4c7:: with SMTP id g7mr4786355wmk.29.1610641245508; Thu, 14 Jan 2021 08:20:45 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Subject: [PULL v2 35/69] target/mips/translate: Extract decode_opc_legacy() from decode_opc() Date: Thu, 14 Jan 2021 17:20:04 +0100 Message-Id: <20210114162016.2901557-6-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210114162016.2901557-1-f4bug@amsat.org> References: <20210114162016.2901557-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x333.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aleksandar Rikalo , Richard Henderson , qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) As we will slowly move to decodetree generated decoders, extract the legacy decoding from decode_opc(), so new decoders are added in decode_opc() while old code is removed from decode_opc_legacy(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-Id: <20201215225757.764263-2-f4bug@amsat.org> --- target/mips/translate.c | 49 ++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/target/mips/translate.c b/target/mips/translate.c index 4c400ec0b3c..d4d5d294f34 100644 --- a/target/mips/translate.c +++ b/target/mips/translate.c @@ -30517,30 +30517,13 @@ static void gen_msa(CPUMIPSState *env, DisasConte= xt *ctx) =20 } =20 -static void decode_opc(CPUMIPSState *env, DisasContext *ctx) +static bool decode_opc_legacy(CPUMIPSState *env, DisasContext *ctx) { int32_t offset; int rs, rt, rd, sa; uint32_t op, op1; int16_t imm; =20 - /* make sure instructions are on a word boundary */ - if (ctx->base.pc_next & 0x3) { - env->CP0_BadVAddr =3D ctx->base.pc_next; - generate_exception_err(ctx, EXCP_AdEL, EXCP_INST_NOTAVAIL); - return; - } - - /* Handle blikely not taken case */ - if ((ctx->hflags & MIPS_HFLAG_BMASK_BASE) =3D=3D MIPS_HFLAG_BL) { - TCGLabel *l1 =3D gen_new_label(); - - tcg_gen_brcondi_tl(TCG_COND_NE, bcond, 0, l1); - tcg_gen_movi_i32(hflags, ctx->hflags & ~MIPS_HFLAG_BMASK); - gen_goto_tb(ctx, 1, ctx->base.pc_next + 4); - gen_set_label(l1); - } - op =3D MASK_OP_MAJOR(ctx->opcode); rs =3D (ctx->opcode >> 21) & 0x1f; rt =3D (ctx->opcode >> 16) & 0x1f; @@ -31268,9 +31251,35 @@ static void decode_opc(CPUMIPSState *env, DisasCon= text *ctx) break; default: /* Invalid */ MIPS_INVAL("major opcode"); - gen_reserved_instruction(ctx); - break; + return false; } + return true; +} + +static void decode_opc(CPUMIPSState *env, DisasContext *ctx) +{ + /* make sure instructions are on a word boundary */ + if (ctx->base.pc_next & 0x3) { + env->CP0_BadVAddr =3D ctx->base.pc_next; + generate_exception_err(ctx, EXCP_AdEL, EXCP_INST_NOTAVAIL); + return; + } + + /* Handle blikely not taken case */ + if ((ctx->hflags & MIPS_HFLAG_BMASK_BASE) =3D=3D MIPS_HFLAG_BL) { + TCGLabel *l1 =3D gen_new_label(); + + tcg_gen_brcondi_tl(TCG_COND_NE, bcond, 0, l1); + tcg_gen_movi_i32(hflags, ctx->hflags & ~MIPS_HFLAG_BMASK); + gen_goto_tb(ctx, 1, ctx->base.pc_next + 4); + gen_set_label(l1); + } + + if (decode_opc_legacy(env, ctx)) { + return; + } + + gen_reserved_instruction(ctx); } =20 static void mips_tr_init_disas_context(DisasContextBase *dcbase, CPUState = *cs) --=20 2.26.2