From patchwork Mon Apr 29 16:59:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 163057 Delivered-To: patch@linaro.org Received: by 2002:a92:7e86:0:0:0:0:0 with SMTP id q6csp2145283ill; Mon, 29 Apr 2019 10:13:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqxzr1/QE6Ftb4JgfUcXgSMLIbINfVUTCfHcxfbvQv3NdzWVq9BieRP+Ry3+cvBEX2slMN8I X-Received: by 2002:a7b:c34c:: with SMTP id l12mr101693wmj.2.1556558026037; Mon, 29 Apr 2019 10:13:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556558026; cv=none; d=google.com; s=arc-20160816; b=jf3Kfq0B3GOnEtiAfPrb2bAtfVfPATimcHITwgDDlPKoPxm59qdh69iINhApnyx2vV GKu6zj1TCOJEHlyEKBwVZZWHYqmXwgo3AGdpeWtpWb0Wg9a56pf/rYM2cv6FhO19xEDW jtTwTDxz6lY0uYTspfqzWBCEqaytMTJdH/lZDuf/OPKl6SX/6JPOk5ea6DgZ9oAzZ+iM jdRxDQP5/SLjQ4zOhyASSD3pKBbvPCn2t6+itA/cqj6ScedWy2eZDZI+LY4lxj/8Dym0 Ma8dLmoSq4g6FwRjWGErnl3X+i9D53l24LdHQ4m33SwXgOWO43897ZxcDNnhjfwkn6/Z 1Iaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=C5ELT6YRQDH3x2HFJvJf8ZZNn5ZtD6+g/82yTJwrTMg=; b=K+xBjljk9kGvnyF2JXCCYdwiBVcEg3djcp0Qjd1vglR7Wn6un/PxVB0EeehftClzVq hE6GtqDdNGS9eSSfro1FMoxwIYgSyfeujRnXostU3xLhDAqiOI5+2H9imQcj4WXh6UiY 9anDw4c92em09F1qHaUP07ZJjNb6dqEc/IbzrpkJEQk1boMKX6sLhx3PaYtR7R1PZCVZ SGLWocDeRAtgY75+rcOvFrD/kc3hst9CIj9g7OWbCEJVL9NVuQ6SeMicne7QkI5VrvIU AlKBgBqiK0/AGygbL2T0Lbe9TU1epL2HEe0Oxe2A+pUDY1gpixOWCOB7j6Jydd0qZ8Tw Vf6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=RDK1iSCq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h71si66880wme.65.2019.04.29.10.13.45 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 29 Apr 2019 10:13:46 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=RDK1iSCq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:60762 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hL9qa-0006oH-W4 for patch@linaro.org; Mon, 29 Apr 2019 13:13:45 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hL9ee-0004fW-HB for qemu-devel@nongnu.org; Mon, 29 Apr 2019 13:01:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hL9eX-0006cb-4c for qemu-devel@nongnu.org; Mon, 29 Apr 2019 13:01:19 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:37585) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hL9eV-0006Ev-UJ for qemu-devel@nongnu.org; Mon, 29 Apr 2019 13:01:16 -0400 Received: by mail-wr1-x42f.google.com with SMTP id r6so17126930wrm.4 for ; Mon, 29 Apr 2019 10:00:45 -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=C5ELT6YRQDH3x2HFJvJf8ZZNn5ZtD6+g/82yTJwrTMg=; b=RDK1iSCqOVSkW7h/LXdUrXuItYxD3n7vLCbzGI+wtiG+GE5fy48rFHdbFOGxnnXhya HYq5sP9mNXwXPJ8/AI3mNv6PIR15x71ctk5bHiAMQBMnUVK97vWkW/ikXtMNXA9PpNsn 0Oijn99zC7G8X4WOG+y4ao9qjWGuwTT2VOQUEXlP7ZVFR93PNBm4k9vPEHM6O69lA4sD I0OnUuKPvuxRYWkbH0NWxxtZOK0bpSSaVGDnY4tLa9Kq7gv4DD8JmgIfGJXacptpqxAb MuDC794LiS/ifKKVytSIw7/KITyEwZVLNwzWUxBnDjQth1IS1KsErSaUJd7BHICSF2hg KrOw== 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=C5ELT6YRQDH3x2HFJvJf8ZZNn5ZtD6+g/82yTJwrTMg=; b=dkdFB4vaVYbbRV3+Y4eEAvawZiobwXTElMPIO165HBqvZ9ZJ7bMotNg3BSJgmu4GZG bqtI9Fjta5MSSb/I/ktxM5AnFVZuYxARPoAIEUmF9Q+RUPFawOcR2hc1rmIgc7CuSf2t WJ5aZaFWIoF0wDSekd9EYN5MIgjZJYKhpjPt2FhIvx9ylu32gPZoDf4QkwPnEjEIwJwb hWLtm1pqRxmpA5G7z0/ifcWTrUrZ2tHanVHp2mbTWXcgN/s50+i3tL/k3DNjXzrUSEa2 8jqMm2AhkTFSqvBW/i5Do3H8OINPEJX+WZRBLKhOCC5O8zEFQgKdHO91cGaJM08EiO44 TDdA== X-Gm-Message-State: APjAAAVam6fnY+50aNfpzKsJtJagJyFJaKJuGS4iBequIJeULVEhGZ8m 5d98NTdaF1bGt+VmOBR3kiBN8u3eZ3g= X-Received: by 2002:a5d:4a4f:: with SMTP id v15mr15335188wrs.5.1556557244189; Mon, 29 Apr 2019 10:00:44 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id a13sm36896wmj.39.2019.04.29.10.00.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Apr 2019 10:00:43 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 29 Apr 2019 17:59:57 +0100 Message-Id: <20190429170030.11323-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190429170030.11323-1-peter.maydell@linaro.org> References: <20190429170030.11323-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42f Subject: [Qemu-devel] [PULL 09/42] target/arm: Decode FP instructions for M profile 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Correct the decode of the M-profile "coprocessor and floating-point instructions" space: * op0 == 0b11 is always unallocated * if the CPU has an FPU then all insns with op1 == 0b101 are floating point and go to disas_vfp_insn() For the moment we leave VLLDM and VLSTM as NOPs; in a later commit we will fill in the proper implementation for the case where an FPU is present. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20190416125744.27770-7-peter.maydell@linaro.org --- target/arm/translate.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) -- 2.20.1 diff --git a/target/arm/translate.c b/target/arm/translate.c index 6a11921d0b8..0747f7847a9 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -11728,10 +11728,19 @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) case 6: case 7: case 14: case 15: /* Coprocessor. */ if (arm_dc_feature(s, ARM_FEATURE_M)) { - /* We don't currently implement M profile FP support, - * so this entire space should give a NOCP fault, with - * the exception of the v8M VLLDM and VLSTM insns, which - * must be NOPs in Secure state and UNDEF in Nonsecure state. + /* 0b111x_11xx_xxxx_xxxx_xxxx_xxxx_xxxx_xxxx */ + if (extract32(insn, 24, 2) == 3) { + goto illegal_op; /* op0 = 0b11 : unallocated */ + } + + /* + * Decode VLLDM and VLSTM first: these are nonstandard because: + * * if there is no FPU then these insns must NOP in + * Secure state and UNDEF in Nonsecure state + * * if there is an FPU then these insns do not have + * the usual behaviour that disas_vfp_insn() provides of + * being controlled by CPACR/NSACR enable bits or the + * lazy-stacking logic. */ if (arm_dc_feature(s, ARM_FEATURE_V8) && (insn & 0xffa00f00) == 0xec200a00) { @@ -11745,6 +11754,15 @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) /* Just NOP since FP support is not implemented */ break; } + if (arm_dc_feature(s, ARM_FEATURE_VFP) && + ((insn >> 8) & 0xe) == 10) { + /* FP, and the CPU supports it */ + if (disas_vfp_insn(s, insn)) { + goto illegal_op; + } + break; + } + /* All other insns: NOCP */ gen_exception_insn(s, 4, EXCP_NOCP, syn_uncategorized(), default_exception_el(s));