From patchwork Sat Sep 21 04:32:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 174176 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp249428ill; Fri, 20 Sep 2019 21:35:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqzwGO1BZtLiTW9CTTKaNzDM0bl8y5cZsxzdZUldpxJleHxu+UoUPNEuABVXvbx08BxGYNgV X-Received: by 2002:a05:6402:17eb:: with SMTP id t11mr24904903edy.97.1569040558563; Fri, 20 Sep 2019 21:35:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569040558; cv=none; d=google.com; s=arc-20160816; b=JS0e6dErzncNAuc/FS+Yua6/EjEIT27RbP1BWZXCrG8iADBmx0ARJ8Dr2+/Mnjr2e0 let5E96JUxy7H9kziYZp1L3WN9G1y4PuRCIS3FsjFCKm8X6uIQhrq2Fs6goS7ljcBy75 8MreYteu/4nrkT93wDdM7YmdZGIwh0WlF7Rkhwl0Cysp33/rHow1CXCu/bVmRDkVZRw8 J3W2hrGvwBcf+3JDbPylSNxUQmDlbGV078syCYdPQvJaINc1DTnI8Ntrt16w31ah4p6h dPMyxraT4DMHCfNPS7r0q+YAqJK3lq7/QN4Q2yd2oNPuznWTogaT+9PPHf+IPC+Ph30U Pe+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=N6+9fuZx1kzSXVJeSDepo9XmkdWGsxo7WFnloubWcfk=; b=EfYqDK2u5eqjSSX9JLVEI/6xYdRnZSUfA4Q2WJ+YOfFRUO0Ei7Q2s6ANLGzYcLAiou gj9amTuynYO8w3RU0xp6IBvKmFTHSbGEpTk1RmydKlFanx/yYSrNr1T2brsCdiY4ZmgB Ubw2/6Ms0s/5PUeL9tnWNqBcK1pMiURgDLfKIeihWNPdh/+cmpZJzvlrukAwMTX/Rs8F bAihPuYxtQ0tdRkrO1mwzvqvy7QAHIxbbKxbOy+cDncPhbSCn1PwHxO6UpqzkXHmZxzi p7Ymn02w0wNZ5I0cFTodWuIC9+mz6okDAYntiZuTb8UtuMeX1fd+4BPaQ4/5vJQWky0N napg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=z0hMLBXV; 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=pass (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 h91si2785806edd.270.2019.09.20.21.35.58 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Sep 2019 21:35:58 -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=pass header.i=@linaro.org header.s=google header.b=z0hMLBXV; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:38192 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBX7k-0003Xx-Ex for patch@linaro.org; Sat, 21 Sep 2019 00:35:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40654) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBX5K-0003RG-55 for qemu-devel@nongnu.org; Sat, 21 Sep 2019 00:33:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBX5F-0006YC-9I for qemu-devel@nongnu.org; Sat, 21 Sep 2019 00:33:25 -0400 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:40856) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iBX5E-0006PW-Je for qemu-devel@nongnu.org; Sat, 21 Sep 2019 00:33:20 -0400 Received: by mail-pg1-x543.google.com with SMTP id w10so4977403pgj.7 for ; Fri, 20 Sep 2019 21:33:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=N6+9fuZx1kzSXVJeSDepo9XmkdWGsxo7WFnloubWcfk=; b=z0hMLBXVgkFabCj2zb7KnZQh8Ji4In3fIndCAOvLm2DJdOjdeNN3x3fbxYngDYttXd CqVx/U2H1QgguP5l39H7hOpWZOybYOhSmxzCUtEAu2fcyLe+k8iwsoz34Je3A3qW1Ilh 6aqH9bW/flNiyCjayuw8+IuhmmFqy3IrmIlG9KQmokLIk3FCOxqd6WZIgFXrK8w4NnvJ WM4FKHq3cXuEyUb0JCg4Nna3U/CS2wB++AekEGH/OaXSJkm5BXFsqg+BbogQWCz5TIZA nEOrCWP7fQ5Em49CMIGDtHzj4sH8FrM/p6sFEZze1t8tQrLn9X2p+q9Ej1SoFfFwEQFu 67uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=N6+9fuZx1kzSXVJeSDepo9XmkdWGsxo7WFnloubWcfk=; b=qQ0OYF3ucTozBYQSjonlO7YsGuDJ8d5wEIP7n+sVL7AYei9a8ZTLB/aRHp6Bf+svX0 /pq0RzQFU7RP6KuYktMw84ZaH7a6X+8g6lzeS6GUmfnvByBltgKsuEzWCWSzPVdhNtsL tN7jiAbJ/j3VwSY4SIuq6s59zjVqCVxEzPhmj4tGOjrO/uo0kC4CDGJShBHsOpD8BYZZ O7x4yIMIxeUoaNiKqVaBZf6TtuWcYdNVtTyNJ2kiYrrbXVF21m25f3357KQbMY3Ccg9Z /n6v2mKVEDSg10rJCRYVmeafyBLU9oLx9OGR1Ry+gxyoX8zjBMJMvNMjVVsfuWGXg1Mx pU6w== X-Gm-Message-State: APjAAAU8xFJb3ZgtW3k6EPTERPeSk+P2dk2Htu4I4RVcUzXo4yBRORTn 8sY0QXs3IPlcGEaPKRwnf4HE8b1QsSA= X-Received: by 2002:a62:3c1:: with SMTP id 184mr21929919pfd.209.1569040384062; Fri, 20 Sep 2019 21:33:04 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id 193sm4179986pfc.59.2019.09.20.21.33.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Sep 2019 21:33:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 3/7] target/alpha: Fix SWCR_TRAP_ENABLE_MASK Date: Fri, 20 Sep 2019 21:32:52 -0700 Message-Id: <20190921043256.4575-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190921043256.4575-1-richard.henderson@linaro.org> References: <20190921043256.4575-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::543 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: , Cc: alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The CONFIG_USER_ONLY adjustment blindly mashed the swcr exception enable bits into the fpcr exception disable bits. However, fpcr_exc_enable has already converted the exception disable bits into the exception status bits in order to make it easier to mask status bits at runtime. Instead, merge the swcr enable bits with the fpcr before we convert to status bits. Signed-off-by: Richard Henderson --- target/alpha/helper.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) -- 2.17.1 diff --git a/target/alpha/helper.c b/target/alpha/helper.c index 10602fb339..e21c488aa3 100644 --- a/target/alpha/helper.c +++ b/target/alpha/helper.c @@ -46,19 +46,8 @@ void cpu_alpha_store_fpcr(CPUAlphaState *env, uint64_t val) uint32_t fpcr = val >> 32; uint32_t t = 0; - t |= CONVERT_BIT(fpcr, FPCR_INED, FPCR_INE); - t |= CONVERT_BIT(fpcr, FPCR_UNFD, FPCR_UNF); - t |= CONVERT_BIT(fpcr, FPCR_OVFD, FPCR_OVF); - t |= CONVERT_BIT(fpcr, FPCR_DZED, FPCR_DZE); - t |= CONVERT_BIT(fpcr, FPCR_INVD, FPCR_INV); - + /* Record the raw value before adjusting for linux-user. */ env->fpcr = fpcr; - env->fpcr_exc_enable = ~t & FPCR_STATUS_MASK; - - env->fpcr_dyn_round = rm_map[(fpcr & FPCR_DYN_MASK) >> FPCR_DYN_SHIFT]; - - env->fpcr_flush_to_zero = (fpcr & FPCR_UNFD) && (fpcr & FPCR_UNDZ); - env->fp_status.flush_inputs_to_zero = (fpcr & FPCR_DNZ) != 0; #ifdef CONFIG_USER_ONLY /* @@ -67,13 +56,29 @@ void cpu_alpha_store_fpcr(CPUAlphaState *env, uint64_t val) * which point the kernel's handler would emulate and apply * the software exception mask. */ + uint32_t soft_fpcr = alpha_ieee_swcr_to_fpcr(env->swcr) >> 32; + fpcr |= soft_fpcr & FPCR_STATUS_MASK; +#endif + + t |= CONVERT_BIT(fpcr, FPCR_INED, FPCR_INE); + t |= CONVERT_BIT(fpcr, FPCR_UNFD, FPCR_UNF); + t |= CONVERT_BIT(fpcr, FPCR_OVFD, FPCR_OVF); + t |= CONVERT_BIT(fpcr, FPCR_DZED, FPCR_DZE); + t |= CONVERT_BIT(fpcr, FPCR_INVD, FPCR_INV); + + env->fpcr_exc_enable = ~t & FPCR_STATUS_MASK; + + env->fpcr_dyn_round = rm_map[(fpcr & FPCR_DYN_MASK) >> FPCR_DYN_SHIFT]; + + env->fpcr_flush_to_zero = (fpcr & FPCR_UNFD) && (fpcr & FPCR_UNDZ); + env->fp_status.flush_inputs_to_zero = (fpcr & FPCR_DNZ) != 0; +#ifdef CONFIG_USER_ONLY if (env->swcr & SWCR_MAP_DMZ) { env->fp_status.flush_inputs_to_zero = 1; } if (env->swcr & SWCR_MAP_UMZ) { env->fpcr_flush_to_zero = 1; } - env->fpcr_exc_enable &= ~(alpha_ieee_swcr_to_fpcr(env->swcr) >> 32); #endif }