From patchwork Mon Apr 29 16:59:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 163053 Delivered-To: patch@linaro.org Received: by 2002:a92:7e86:0:0:0:0:0 with SMTP id q6csp2142082ill; Mon, 29 Apr 2019 10:10:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqzZUg06xOmchbiy17zzc8quqIPD7m67oZW4jyl3UrJXSIxRcIKvDLhd9QtII63dcJtQFx4f X-Received: by 2002:a7b:c301:: with SMTP id k1mr64423wmj.37.1556557859703; Mon, 29 Apr 2019 10:10:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556557859; cv=none; d=google.com; s=arc-20160816; b=D8clV+rn9kVVJA1omnSALIpHTPDjAELuWsD5IjACK5+dxYHmWvghKl3D/XHk/q59bz 4hETnf17rbRatPZdPcEzZoeCX310iIOYaoKIBo0hzLn5IkUrE2YdByZJYRnjlCaKbZfa 9sOMxKGizWM2pfQzUJvWT5GJmZdsJb/Oc0b2jhI2cT//CSt5gQMZvkX2ck+dzbvHQV1Q Q6YC8m7F5IFF3M4eMKriImZ92A69qr4nhILcbg79AfN1TqMP1Jbx678agaGsMo95iYD7 KL0yDJvcPkTSm30G8An2ZfkD/5D4ZUxEZC4r1JTNtkfbbQLeBpETT2urebXRwBWlwSKT ilFg== 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=3hCqKWhEs+uyed/mP56baIBgXAfI++APiWRLJhSExvw=; b=uJJYCA60QpJ2Gfjn7DilBMnGYPzCtACqXsZ2Wn7haKCMzYARY1IwaLTrXTXnLiQ106 XufD1/Gu43vPf7JsrAz9FpSANwxl2+b7qs6Sz8F+pjbqGlW1PpX1NlzuNTd7RRTVB7r7 /OROwAu/S9kZ6MNXPoPJ/S2KWb+rBYI7lrJZlcj6XXcXXbeR3Glm4adLUF+/v3TTNmc3 bkAino8fVMtLbb00tSIIe7JFH59UiNFR4xq3FoLO94/c2mPw4GlsEEmcUBCK6AY985Xo JQ8DXcYnd/wedvODbSX0o/V1ykonHNDEhKkNR3DXCio7bMXBOx1EtVqASt7cxqbTiarp P1vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YajaLebr; 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 i3si12856613wrq.13.2019.04.29.10.10.59 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 29 Apr 2019 10:10:59 -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=YajaLebr; 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]:60738 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hL9nu-0003zd-Gw for patch@linaro.org; Mon, 29 Apr 2019 13:10:58 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34160) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hL9eN-0004Pl-Uf for qemu-devel@nongnu.org; Mon, 29 Apr 2019 13:01:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hL9eI-0006VI-GK for qemu-devel@nongnu.org; Mon, 29 Apr 2019 13:01:04 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:36483) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hL9eE-0006Bn-GO for qemu-devel@nongnu.org; Mon, 29 Apr 2019 13:01:00 -0400 Received: by mail-wr1-x442.google.com with SMTP id o4so5177805wra.3 for ; Mon, 29 Apr 2019 10:00:42 -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=3hCqKWhEs+uyed/mP56baIBgXAfI++APiWRLJhSExvw=; b=YajaLebr2q7j6iLHUun3YVVHQEIWyb80UqcvVMn6EM5JmrAR1gJy5nmEDSyzlrcewv 4SdG2atfrQAWnqPEKOqq24P+eQ9Lt28jnwqKVN5oiEP8BpKgIz9o+PCoefSmV3767DWY 3vu9vRwOAkqM7MZR7LzSSKfBvTqWQxoW84xRX/MDcaiBgbkiietxVRrerECTNd4K/kHx 1GAzVLMDgC6U8pky+XP1aRBb/WwZHRvCTqOKn9peQxz4KBlViwfJRE8BDGpawKxON/1W mLtDmhCUOtUdRdeGapzyqlwyvq1N06VH+eDGw1xVquEq/YAo6vPA0VGLnGvdeGJ5d3Gk UrnQ== 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=3hCqKWhEs+uyed/mP56baIBgXAfI++APiWRLJhSExvw=; b=O8R9vhNeNvRwP7Ni8IOKCbpfY+tyx4agg/ZBiIVqDCunGLjuDVnMIvTAKBK5kPoPuF NcfeQRNso0oC0qo5whgbqoVhM8rkRVtZ8GPOoDFgWm3DAo4eEFNoXcsXxQuovH/ry+0E AgpTnUEpGKS8hQFWL+BHki8cBMXsVG/kDL6yP+25weU3xkOmxIWQKGG08R0DcybstAsx OToDTeAG1dhhGkSJcaoRroBzPmlNSOWq4vx1i221WbhutLspPSmdJX3DG8dLC/RyWAql gmsyyrQvv64QJTv3KPOVfwh964kzWvIVl4EIpfglijwhKxDGTs7E5l5EFP9Mqo7nCTzL QgLw== X-Gm-Message-State: APjAAAUWAHsuqmND8YMMbtkvjTUtw2WRUIdmK98+PFDVDu5SQLS7r6hQ Pq8VeSOntHMno/bd7lIpIYvXnQYD6fY= X-Received: by 2002:adf:db05:: with SMTP id s5mr10651136wri.247.1556557241813; Mon, 29 Apr 2019 10:00:41 -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.40 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Apr 2019 10:00:41 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 29 Apr 2019 17:59:55 +0100 Message-Id: <20190429170030.11323-8-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::442 Subject: [Qemu-devel] [PULL 07/42] target/arm: Disable most VFP sysregs 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" The only "system register" that M-profile floating point exposes via the VMRS/VMRS instructions is FPSCR, and it does not have the odd special case for rd==15. Add a check to ensure we only expose FPSCR. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20190416125744.27770-5-peter.maydell@linaro.org --- target/arm/translate.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) -- 2.20.1 diff --git a/target/arm/translate.c b/target/arm/translate.c index 4ea4018e2b8..a9784535069 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3513,12 +3513,27 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) } } } else { /* !dp */ + bool is_sysreg; + if ((insn & 0x6f) != 0x00) return 1; rn = VFP_SREG_N(insn); + + is_sysreg = extract32(insn, 21, 1); + + if (arm_dc_feature(s, ARM_FEATURE_M)) { + /* + * The only M-profile VFP vmrs/vmsr sysreg is FPSCR. + * Writes to R15 are UNPREDICTABLE; we choose to undef. + */ + if (is_sysreg && (rd == 15 || (rn >> 1) != ARM_VFP_FPSCR)) { + return 1; + } + } + if (insn & ARM_CP_RW_BIT) { /* vfp->arm */ - if (insn & (1 << 21)) { + if (is_sysreg) { /* system register */ rn >>= 1; @@ -3585,7 +3600,7 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) } } else { /* arm->vfp */ - if (insn & (1 << 21)) { + if (is_sysreg) { rn >>= 1; /* system register */ switch (rn) {