From nobody Tue Nov 26 08:35:29 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1709444847; cv=none; d=zohomail.com; s=zohoarc; b=M8fFMq7T5T0TYxSRT3ZGV3Tw4V7rDHy4OXwcBRZnygSOjExm2Nz4YOOYBTWvY99mQo57GShAzNLaYwOoGLJC2cA2z2G6q4aqVlT0omFRx8If2pX9Ms1AgQyPqRoV4S8VRwnSul+Sa6CMDj+stxWZPme43qAC+flBuYdESW+YXkM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1709444847; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=zb7djeMcYQvbLoojCcQfk9bah4IakysiR8ZhJ2JzaXA=; b=A3U9B8FEB6ExoQEQ9tk8F9ojYNJgdGTNBa1yBgRZr9xxoIONDrdKL4ZDiVxFt2cdBIRgE+lHdtwmGyuuh+4JBG79rUB4/1i0JYY80D4gMdimJt+0RR90sb0zRncxO1avg0UnidW5S/e+DGxjogq7A/Bgs1qGSsJgrhu+RxinEew= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1709444847514525.2270299465853; Sat, 2 Mar 2024 21:47:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rgegY-0006N6-S6; Sun, 03 Mar 2024 00:46:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rgegX-0006Mh-AK for qemu-devel@nongnu.org; Sun, 03 Mar 2024 00:46:53 -0500 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rgegV-0003Su-S1 for qemu-devel@nongnu.org; Sun, 03 Mar 2024 00:46:53 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 9C81760C2B; Sun, 3 Mar 2024 05:46:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3989C433C7; Sun, 3 Mar 2024 05:46:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709444810; bh=a9DjyL7Kb/8nZ96CbZM91Omz+z9llahcCJYvcimBSS4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uY37Sz3ZsQHeeQ/P5lRd2RbrNvNOnx/+UrBPZ1xu+qJqn2UIniBz79293DKUKQtjo tnx/EyJSJiP1nQbk307F7g/Q1CP9elDN5P6mgN2golRcrdKOzQ/LQqlNpYQXMdiiW8 JSfNSrQiXkN7cwY7vmPRqTKDdxz13VF1feRCQqSwkdaDcUwk9yhfhzbuAgLh2kM3Xj IzKVACUOLZXY4cHUReDDOaG9HOTPWSpjvL9G5QE59uh/8pBU52ggvyqdEFwm5aT5bC jkXDVF0pRHzB32UDLj1QL/PbuQpE86CQcFqPTNJTAMhisYjQN96kgVyX57R8BZLaQr p+puwdPu6QC1w== From: deller@kernel.org To: qemu-devel@nongnu.org, Richard Henderson Cc: deller@gmx.de, Guenter Roeck , Charlie Jenkins Subject: [PULL 1/5] target: hppa: Fix unaligned double word accesses for hppa64 Date: Sun, 3 Mar 2024 06:46:41 +0100 Message-ID: <20240303054645.3004-2-deller@kernel.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240303054645.3004-1-deller@kernel.org> References: <20240303054645.3004-1-deller@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2604:1380:4641:c500::1; envelope-from=deller@kernel.org; helo=dfw.source.kernel.org X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.094, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1709444848098100002 Content-Type: text/plain; charset="utf-8" From: Guenter Roeck Unaligned 64-bit accesses were found in Linux to clobber carry bits, resulting in bad results if an arithmetic operation involving a carry bit was executed after an unaligned 64-bit operation. hppa 2.0 defines additional carry bits in PSW register bits 32..39. When restoring PSW after executing an unaligned instruction trap, those bits were not cleared and ended up to be active all the time. Since there are no bits other than the upper carry bits needed in the upper 32 bit of env->psw and since those are stored in env->psw_cb, just clear the entire upper 32 bit when storing psw to solve the problem unconditionally. Fixes: 931adff31478 ("target/hppa: Update cpu_hppa_get/put_psw for hppa64") Cc: Richard Henderson Cc: Charlie Jenkins Cc: Helge Deller Reviewed-by: Richard Henderson Signed-off-by: Guenter Roeck Signed-off-by: Helge Deller --- target/hppa/helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/hppa/helper.c b/target/hppa/helper.c index 859644c47a..9d217d051c 100644 --- a/target/hppa/helper.c +++ b/target/hppa/helper.c @@ -76,7 +76,8 @@ void cpu_hppa_put_psw(CPUHPPAState *env, target_ulong psw) } psw &=3D ~reserved; =20 - env->psw =3D psw & ~(PSW_N | PSW_V | PSW_CB); + env->psw =3D psw & (uint32_t)~(PSW_N | PSW_V | PSW_CB); + env->psw_n =3D (psw / PSW_N) & 1; env->psw_v =3D -((psw / PSW_V) & 1); =20 --=20 2.44.0