From patchwork Mon Apr 29 17:00:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 163063 Delivered-To: patch@linaro.org Received: by 2002:a92:7e86:0:0:0:0:0 with SMTP id q6csp2150380ill; Mon, 29 Apr 2019 10:18:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqyhKuOI9DUTYjsjiglB9syc9t1VScq569FP7BKiBQG2xLO18w4Zi2oOTlhIz3TfSei3rh4U X-Received: by 2002:adf:9144:: with SMTP id j62mr44320475wrj.320.1556558293422; Mon, 29 Apr 2019 10:18:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556558293; cv=none; d=google.com; s=arc-20160816; b=LuZpZDzoUsblXLLqpgtFH/zkdXQpe6/M1svEdqBNNuM+6JPILzaF/XDtrh+fg871EE 8TKkm1GDBto7MDDH+owCsPEIcpocoXmmuRyPklAo8n49lOu+ZKetNCtd/dWFohJkhMLf /zMcAwzgFDq4mk87JmhmzfhHnCHMGvX17cXl3IGJa1xgqr3heYzv9tKCqb8oGFeZA6CK LvMrkGn8dU/GBT2qP/9JH1YOMaFmgL+uby9kvQoEWAqaesH8cBzvbEezM2k+rQ4s1+ID 4ZvK3+kQbLR6c4Qz8NfCE6uBD+TVkx9pt2HgOMaF2bsmnt3psINTdcwau+UEeYcnka8G 55cA== 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=BkAjqGaX0B2OxEPEkgjNPx5AhDVspw6+QJQ8/auHQ9M=; b=f9Z8HLT6P7Tycq2d+URaxS2mCtiHNmTgC6e5vWaQMuFT1FFSiN0KD/xAOlJnxzMGW5 46kOH4mDPq/tFAFsGC20mRoqlLiQbkl7XqlrW/cMwinfGQNYD2f6R5giWXaRterVLW91 4KLzmmVt6e42mg6uFHHl1uYt4eT+6IO/n1D8lMHyfeNga4R3Cy/imOSz4xr3r5v9qBjs nan+Z4xBpbwjPXWbcI7Q0n1b2NsTOYJVNf82UPqpXNjeGOkUIp+dSRthXI2gu4EcoE7q F0tIYjoR+fon4Y2Zzq73+lIdpDmifsX1C0Q9RCCfcTEhxgQZpIj5mRFQsDSQKli+koE7 SvYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=XYI8mMwF; 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 d185si57884wmf.119.2019.04.29.10.18.13 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 29 Apr 2019 10:18:13 -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=XYI8mMwF; 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]:60837 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hL9uu-0002Gy-A9 for patch@linaro.org; Mon, 29 Apr 2019 13:18:12 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34360) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hL9er-0004r3-3L for qemu-devel@nongnu.org; Mon, 29 Apr 2019 13:01:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hL9eo-0006kV-BP for qemu-devel@nongnu.org; Mon, 29 Apr 2019 13:01:35 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:41684) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hL9eo-0006R7-08 for qemu-devel@nongnu.org; Mon, 29 Apr 2019 13:01:34 -0400 Received: by mail-wr1-x42d.google.com with SMTP id c12so17089247wrt.8 for ; Mon, 29 Apr 2019 10:00:54 -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=BkAjqGaX0B2OxEPEkgjNPx5AhDVspw6+QJQ8/auHQ9M=; b=XYI8mMwFFqY3hfdHQbRv5xTBpJSGaPcyTIAOnDBB/8rzZ5mUdesczoxV0DFATMDiBk sUwR3Pc7aTXjYBjpg6GKxUMFzGBu/GISZWdu3/MK/EETz92lce2OYbBJuVSCUlY5CpOl P2misckoZlUc3EpM/efkXl9aeHx9uk3ys86cGQvrhzcq6JuOkhlG9Ktnt5WeW2LDRoHF +EDo08vOGBGXwIyEHm8f4gsiJzkzqOentvk/eNlxDeU2hyokAdufPXDBj6HlAZVvNsBN bAdbpALqBWg7QbW3Ge8zhkNyoZZa1PSDTEcYvXSx+5QC11g88JpSTvmJSUwdVPZQkDYl 6BAA== 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=BkAjqGaX0B2OxEPEkgjNPx5AhDVspw6+QJQ8/auHQ9M=; b=pNaMP5uv02IBb0AULX/Me5OsxL0C8MxWmDLmjZgDG4v5xlYvl7TghbIHp3gzCXhXyU B3y1N/AAwknqDaTuvvulA4RuTIxdUTeiTkatKZZRNdAFDSoL89560F6dZRyG2a8CH+I8 5hJCVSV6gNmGP+pAii3cM2pr/ZUrmq/OHFl6JRve6osWU2ewva9SoDLRJ3HGGUTWs9/B b1zLew/q7jVFetK9dWx5zlw1RReU40F8RmzedOIcfZlzk5u1gXRWT0kW5vujyKccd1nf ojIYQLQkyq1ZDsEVF9SZ7AqgYOO8kciMny67sdhydZ+t1GsapoUg3p05Dt6sfgh3R/X5 1uhg== X-Gm-Message-State: APjAAAVPb13PsAwN/BvieodhQT/xTvXCQC+RVvrU0Wgrm7dU409pgyMQ c47JmkaEcXTc+Elb5hgLraGIp9Q0WoQ= X-Received: by 2002:adf:c002:: with SMTP id z2mr42931189wre.177.1556557252960; Mon, 29 Apr 2019 10:00:52 -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.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Apr 2019 10:00:52 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 29 Apr 2019 18:00:04 +0100 Message-Id: <20190429170030.11323-17-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::42d Subject: [Qemu-devel] [PULL 16/42] target/arm: Clean excReturn bits when tail chaining 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 TailChain() pseudocode specifies that a tail chaining exception should sanitize the excReturn all-ones bits and (if there is no FPU) the excReturn FType bits; we weren't doing this. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20190416125744.27770-14-peter.maydell@linaro.org --- target/arm/helper.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.20.1 diff --git a/target/arm/helper.c b/target/arm/helper.c index 088852ceb96..da0b6202400 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -8076,6 +8076,14 @@ static void v7m_exception_taken(ARMCPU *cpu, uint32_t lr, bool dotailchain, qemu_log_mask(CPU_LOG_INT, "...taking pending %s exception %d\n", targets_secure ? "secure" : "nonsecure", exc); + if (dotailchain) { + /* Sanitize LR FType and PREFIX bits */ + if (!arm_feature(env, ARM_FEATURE_VFP)) { + lr |= R_V7M_EXCRET_FTYPE_MASK; + } + lr = deposit32(lr, 24, 8, 0xff); + } + if (arm_feature(env, ARM_FEATURE_V8)) { if (arm_feature(env, ARM_FEATURE_M_SECURITY) && (lr & R_V7M_EXCRET_S_MASK)) {