From nobody Fri Dec 19 04:33:47 2025 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1549388295661933.9546933422835; Tue, 5 Feb 2019 09:38:15 -0800 (PST) Received: from localhost ([127.0.0.1]:35685 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gr4fc-00032p-Gt for importer@patchew.org; Tue, 05 Feb 2019 12:38:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36055) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gr4AV-0001v4-2k for qemu-devel@nongnu.org; Tue, 05 Feb 2019 12:06:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gr4AS-0000ao-Hn for qemu-devel@nongnu.org; Tue, 05 Feb 2019 12:05:54 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:39089) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gr4AS-0000Vo-4C for qemu-devel@nongnu.org; Tue, 05 Feb 2019 12:05:52 -0500 Received: by mail-wr1-x430.google.com with SMTP id t27so4457572wra.6 for ; Tue, 05 Feb 2019 09:05:46 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w13sm5583164wmf.5.2019.02.05.09.05.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Feb 2019 09:05:44 -0800 (PST) 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=8z6OAizl3lsysfolwsgKCWRutlc3AKlSrSRaqOerGy8=; b=G++xZfITQFSMd587PD5QssqM9hUYJ09NiEUu7jE2gi6p9tFCVr5PUh9V+KrH8dsXdK ZE1PL2/7BoRb9j4u3qitaeVodqBnRvZbFIUR/oFblwdX447KtXF6wdLy/BSF3141K/MJ 5RCnHWYMOQqyPpLbYJGHFfJhSsUZGSZxOIPdSixlaYs+RKwJvrTW83mA8lVVtMAiap1g NrIlX8RggXoJWpoOptqBseJw6eI2QhlKeZWRvhZtqmlFiOp/nDTqrtxX4MdNjOeph8jS 3rh46KW1Ie2SwMuT7Um6yx4JVsrEADvacQQgzBV3VdDVrU2CHbXptvZoYtGobNHcdmx6 awJA== 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=8z6OAizl3lsysfolwsgKCWRutlc3AKlSrSRaqOerGy8=; b=eXqPprQF3Uav5alVXs25flSy5FVnR4oehjsCOWZuZebZub8HCIl2D9MwPm1hNNJRDV Q7IjTmPlIWJIjSiX9jrsG6M+EsZgrcmH4omjrXj+UJOD1hNx5V8kOSagf4MHaCKtWEye RRR1Yzr5lRVArQY54DUXwGWpvife11JEAP1V9GutoYCOz1FBbxoeVKM0UJYCHPyn0mQD S7fcvXmGv3umlyBCK0sASvUe06d8pLfqEE7hT9hl2XOUMNXm+dMGrbFDvz9XyzTj53iR YO+28GizWFLGQrG9yayYjDFiZj3/lzBf4E3teTNagMbG6AoVRg3dlgQ8SGrJ/Ge2RAPo MhQw== X-Gm-Message-State: AHQUAubf8Li7S3RIIEDpjPYdeOUsZlk/82/vGg2dMcDLQ+Exh+ayv4nH /pAG904bdYiDWfSVqFz6uQPGaAkJqzxKHg== X-Google-Smtp-Source: AHgI3IYn3uQl/SLcB+ABAxUlLlBRsY/OuaRll9e14XXAs9VToTCYcgltsgd+53Nurp5RGmNtmoRNTg== X-Received: by 2002:adf:c589:: with SMTP id m9mr4539576wrg.145.1549386344950; Tue, 05 Feb 2019 09:05:44 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 5 Feb 2019 17:05:10 +0000 Message-Id: <20190205170510.21984-23-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190205170510.21984-1-peter.maydell@linaro.org> References: <20190205170510.21984-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::430 Subject: [Qemu-devel] [PULL 22/22] target/arm: Make FPSCR/FPCR trapped-exception bits RAZ/WI 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The {IOE, DZE, OFE, UFE, IXE, IDE} bits in the FPSCR/FPCR are for enabling trapped IEEE floating point exceptions (where IEEE exception conditions cause a CPU exception rather than updating the FPSR status bits). QEMU doesn't implement this (and nor does the hardware we're modelling), but for implementations which don't implement trapped exception handling these control bits are supposed to be RAZ/WI. This allows guest code to test for whether the feature is present by trying to write to the bit and checking whether it sticks. QEMU is incorrectly making these bits read as written. Make them RAZ/WI as the architecture requires. In particular this was causing problems for the NetBSD automatic test suite. Reported-by: Martin Husemann Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20190131130700.28392-1-peter.maydell@linaro.org --- target/arm/cpu.h | 6 ++++++ target/arm/helper.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index ec14d3e228d..47238e42458 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1418,6 +1418,12 @@ void vfp_set_fpscr(CPUARMState *env, uint32_t val); #define FPSR_MASK 0xf800009f #define FPCR_MASK 0x07ff9f00 =20 +#define FPCR_IOE (1 << 8) /* Invalid Operation exception trap enable= */ +#define FPCR_DZE (1 << 9) /* Divide by Zero exception trap enable */ +#define FPCR_OFE (1 << 10) /* Overflow exception trap enable */ +#define FPCR_UFE (1 << 11) /* Underflow exception trap enable */ +#define FPCR_IXE (1 << 12) /* Inexact exception trap enable */ +#define FPCR_IDE (1 << 15) /* Input Denormal exception trap enable */ #define FPCR_FZ16 (1 << 19) /* ARMv8.2+, FP16 flush-to-zero */ #define FPCR_FZ (1 << 24) /* Flush-to-zero enable bit */ #define FPCR_DN (1 << 25) /* Default NaN enable bit */ diff --git a/target/arm/helper.c b/target/arm/helper.c index aaf5b0cd7ab..520ceea7a41 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -12637,6 +12637,12 @@ void HELPER(vfp_set_fpscr)(CPUARMState *env, uint3= 2_t val) val &=3D ~FPCR_FZ16; } =20 + /* + * We don't implement trapped exception handling, so the + * trap enable bits are all RAZ/WI (not RES0!) + */ + val &=3D ~(FPCR_IDE | FPCR_IXE | FPCR_UFE | FPCR_OFE | FPCR_DZE | FPCR= _IOE); + changed =3D env->vfp.xregs[ARM_VFP_FPSCR]; env->vfp.xregs[ARM_VFP_FPSCR] =3D (val & 0xffc8ffff); env->vfp.vec_len =3D (val >> 16) & 7; --=20 2.20.1