From nobody Sat Sep 28 23:20:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1598263105; cv=none; d=zohomail.com; s=zohoarc; b=hjarjmYMB5hmyTWaOCfX+zGOeGa7kuCYiP8r5BL/9VIZB5arP0UB9agCF6jp+WK5ZGBvzX2AEHb78M2+HrG3iwC1XC+B+XJN7/zsACzKYpx9HEfmMdTaX6GJU3PKn0Us7Xdse27DT5DuADrclO3j5WPT7faTJiuI4lcXpyvsFNs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598263105; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=IZG5JPPNIRlIPpo72HZmBANuur0NLEoD5lEA/T/LC+I=; b=NcQQS5nj78at54I3WCOTOeI84nrGijxck0AcZGILVhpTfSk5YWgxLJmUZNKMRFMK5MPaJ9hmDkaCvfQG57GMoSDtV6MF24BJHQPnJ0iGBayNLQ9HPorlbpeqSXYfY07Xyg1AezsaHleSZ5vgKJtP8HISQLynF0I7TcAy1MyBjyU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1598263105130383.0068006773886; Mon, 24 Aug 2020 02:58:25 -0700 (PDT) Received: from localhost ([::1]:50404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kA9F9-0008Pf-RX for importer@patchew.org; Mon, 24 Aug 2020 05:58:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46898) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kA95k-0005OK-9o for qemu-devel@nongnu.org; Mon, 24 Aug 2020 05:48:40 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:55913) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kA95i-0004pD-Cy for qemu-devel@nongnu.org; Mon, 24 Aug 2020 05:48:39 -0400 Received: by mail-wm1-x32f.google.com with SMTP id a65so4085882wme.5 for ; Mon, 24 Aug 2020 02:48:37 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id q6sm24877057wma.22.2020.08.24.02.48.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2020 02:48:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=IZG5JPPNIRlIPpo72HZmBANuur0NLEoD5lEA/T/LC+I=; b=yySgJMlUnrXVGOFw9dcbrlk6iOUmWWbuYas4X6OugTSsk4xsK41/V653LRL20GogQi tSM2LF+n77MW7q8KgRSLN1orx0s/UkvrINWUuyl0VaNB7FxtWMr+5jZ2bk5ZYgFLxjoQ N4AA/mkdCUUgWgQIsinePmfbavcv5yjXISdl/eSotoa76AhBxrHrAWKHCOnV0vGOZL0h iHwQvzK1CGueWRD5rDrgQOvjIIJQxCn5MaiQYZsq9hfrQYcbgqjSiVvDFwt6UTmqhx0y bS0lLaqO+15ijJTmKx93cVkN6swPD/5xzKOHFKMZwDbLXhWcW1uqV+nNt5Sj2Uv3OzpY BoWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IZG5JPPNIRlIPpo72HZmBANuur0NLEoD5lEA/T/LC+I=; b=fljjz9Nja6M9IPl0/G8Am+rGisIsGQanXrmLMiUZUn7j93bO5oVHOnXgB62pz45q/L ivbjoCu/Gy1sBl3ZOJBr08jcVkq23HO/J+a7AVRnC2+gaCQt9xh49Pr0Ppu3P7s9fRQY YoSyuIkE85gGiGr4Nm9mk5B0bOGO6w5qo5uXMME9Tfh3WXMGS4bB5SVocIAi/y8llAlR Qdiy8ve8SeaE6yLHrTMIt25wSj6Y9pQ16M9rB369Qx7F7ddTY63PZjq0aCHyLGHi0EN/ 8EcLEwH3iqBOeFsBuEZKATuu43rUpRZgnJcO80f1pKjwmmc03N1zgz5WNL5pzuMQVOPe V9ag== X-Gm-Message-State: AOAM531lSuWqGqxefnx8AVLfLXHO2sHsFTv5sdKg6JKI9PhW3NtbBzxz eGdIiqp9lyfrvVpT/3g08Yn36kLMwbI951Ac X-Google-Smtp-Source: ABdhPJw/gbc2IbTlIUJ7vOWgvtlkz8eHMS5UHsr883f7g2uQXHKNn4/Sea8OIjfyLCliiADeBMYZ5Q== X-Received: by 2002:a7b:ce12:: with SMTP id m18mr4623629wmc.3.1598262516693; Mon, 24 Aug 2020 02:48:36 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 19/27] target/arm: Convert T32 coprocessor insns to decodetree Date: Mon, 24 Aug 2020 10:48:03 +0100 Message-Id: <20200824094811.15439-20-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200824094811.15439-1-peter.maydell@linaro.org> References: <20200824094811.15439-1-peter.maydell@linaro.org> MIME-Version: 1.0 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::32f; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Convert the T32 coprocessor instructions to decodetree. As with the A32 conversion, this corrects an underdecoding where we did not check that MRRC/MCRR [24:21] were 0b0010 and so treated some kinds of LDC/STC and MRRC/MCRR rather than UNDEFing them. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20200803111849.13368-7-peter.maydell@linaro.org --- target/arm/t32.decode | 19 +++++++++++++ target/arm/translate.c | 64 ++---------------------------------------- 2 files changed, 21 insertions(+), 62 deletions(-) diff --git a/target/arm/t32.decode b/target/arm/t32.decode index c21a988f971..7069d821fde 100644 --- a/target/arm/t32.decode +++ b/target/arm/t32.decode @@ -45,6 +45,8 @@ &sat !extern rd rn satimm imm sh &pkh !extern rd rn rm imm tb &cps !extern mode imod M A I F +&mcr !extern cp opc1 crn crm opc2 rt +&mcrr !extern cp opc1 crm rt rt2 =20 # Data-processing (register) =20 @@ -621,6 +623,23 @@ RFE 1110 1001 10.1 .... 1100000000000000 = @rfe pu=3D1 SRS 1110 1000 00.0 1101 1100 0000 000. .... @srs pu=3D2 SRS 1110 1001 10.0 1101 1100 0000 000. .... @srs pu=3D1 =20 +# Coprocessor instructions + +# We decode MCR, MCR, MRRC and MCRR only, because for QEMU the +# other coprocessor instructions always UNDEF. +# The trans_ functions for these will ignore cp values 8..13 for v7 or +# earlier, and 0..13 for v8 and later, because those areas of the +# encoding space may be used for other things, such as VFP or Neon. + +@mcr .... .... opc1:3 . crn:4 rt:4 cp:4 opc2:3 . crm:4 +@mcrr .... .... .... rt2:4 rt:4 cp:4 opc1:4 crm:4 + +MCRR 1110 1100 0100 .... .... .... .... .... @mcrr +MRRC 1110 1100 0101 .... .... .... .... .... @mcrr + +MCR 1110 1110 ... 0 .... .... .... ... 1 .... @mcr +MRC 1110 1110 ... 1 .... .... .... ... 1 .... @mcr + # Branches =20 %imm24 26:s1 13:1 11:1 16:10 0:11 !function=3Dt32_branch24 diff --git a/target/arm/translate.c b/target/arm/translate.c index 958e9b6699f..e2ae4f79445 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -4791,37 +4791,6 @@ static void do_coproc_insn(DisasContext *s, int cpnu= m, int is64, return; } =20 -static int disas_coproc_insn(DisasContext *s, uint32_t insn) -{ - int cpnum, is64, crn, crm, opc1, opc2, isread, rt, rt2; - - cpnum =3D (insn >> 8) & 0xf; - - is64 =3D (insn & (1 << 25)) =3D=3D 0; - if (!is64 && ((insn & (1 << 4)) =3D=3D 0)) { - /* cdp */ - return 1; - } - - crm =3D insn & 0xf; - if (is64) { - crn =3D 0; - opc1 =3D (insn >> 4) & 0xf; - opc2 =3D 0; - rt2 =3D (insn >> 16) & 0xf; - } else { - crn =3D (insn >> 16) & 0xf; - opc1 =3D (insn >> 21) & 7; - opc2 =3D (insn >> 5) & 7; - rt2 =3D 0; - } - isread =3D (insn >> 20) & 1; - rt =3D (insn >> 12) & 0xf; - - do_coproc_insn(s, cpnum, is64, opc1, crn, crm, opc2, isread, rt, rt2); - return 0; -} - /* Decode XScale DSP or iWMMXt insn (in the copro space, cp=3D0 or 1) */ static void disas_xscale_insn(DisasContext *s, uint32_t insn) { @@ -8485,38 +8454,9 @@ static void disas_thumb2_insn(DisasContext *s, uint3= 2_t insn) ((insn >> 28) =3D=3D 0xe && disas_vfp(s, insn))) { return; } - /* fall back to legacy decoder */ =20 - switch ((insn >> 25) & 0xf) { - case 0: case 1: case 2: case 3: - /* 16-bit instructions. Should never happen. */ - abort(); - case 6: case 7: case 14: case 15: - /* Coprocessor. */ - if (arm_dc_feature(s, ARM_FEATURE_M)) { - /* 0b111x_11xx_xxxx_xxxx_xxxx_xxxx_xxxx_xxxx */ - goto illegal_op; - } - if (((insn >> 24) & 3) =3D=3D 3) { - /* Neon DP, but failed disas_neon_dp() */ - goto illegal_op; - } else if (((insn >> 8) & 0xe) =3D=3D 10) { - /* VFP, but failed disas_vfp. */ - goto illegal_op; - } else { - if (insn & (1 << 28)) - goto illegal_op; - if (disas_coproc_insn(s, insn)) { - goto illegal_op; - } - } - break; - case 12: - goto illegal_op; - default: - illegal_op: - unallocated_encoding(s); - } +illegal_op: + unallocated_encoding(s); } =20 static void disas_thumb_insn(DisasContext *s, uint32_t insn) --=20 2.20.1