From nobody Tue Nov 26 08:43:56 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=1709419026; cv=none; d=zohomail.com; s=zohoarc; b=UuBfXrdGbY5Lx++5XvwMoFnPkUYbg4ahExvIy0FNnMLTRbkxxiItcwnZoMJDgQBVBrcb2UtZevN1VTGy6f0P2yjkTndv10sa/iAfU2gN8L0MGzwpquFt8GyKlSSF+j4HH0OYYz7JTUy4enmWpGAiqEm9ZPHU/nbfYLAGKr/qsyE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1709419026; 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=pAGBaT3P/SM26YPYrzlcRJf+4GiSaqcUV2hTPF0dnwc=; b=ToaPBkwtPSTeHlH9CHgE4yE7cA3CR4niELROn7qeCZTa/NXNUY9Rzhg1C2amDUnxBzXJ3yjllgti9lfr3ecEuiuI63kJ8T5nbVqyDSoTjqVtVvyERgKrgwlYPZYWbERlGZbatq2fb3jT4YpcQEFCbmvJQWEwXxG5+C6FbHdq9Xs= 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 1709419026744416.29420603869914; Sat, 2 Mar 2024 14:37:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rgXxR-0006BQ-3B; Sat, 02 Mar 2024 17:35:53 -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 1rgXxG-00069O-Ig for qemu-devel@nongnu.org; Sat, 02 Mar 2024 17:35:42 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rgXxD-0003ga-VF for qemu-devel@nongnu.org; Sat, 02 Mar 2024 17:35:42 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id D511860F75; Sat, 2 Mar 2024 22:35:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FB9CC433C7; Sat, 2 Mar 2024 22:35:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709418928; bh=t2xatLPUQitdK7QlDb4pBEBirGnlzkSL8GWMvf0Y78U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SYLAFdB/Y56tKxHA6z1xvfqwml49ot5iUJJtdcHs+EqFq/6eOGepGYY9ttjRionbV 57GSzvn5j0aL1ShVXOLCkEAkbxeWBcoQ8YlLDFoPrcR9+OZ5nDqPYfo4+ZJgaYQ/5p zGJlQ2CYoGoCVprnSUbgh/Z83EEiceRMwOnn1cfSBub5x3PbmBJjeBgKZR1aH/xdU/ utrLOx4+j7VngcMMO1YV5iTFOrzcpCaQ0QszkHKj4Doi0PxkRf0W2Nn9JnD9q0Ijvh rNKd8Lbxj1xY72TeUn7Hxsson17HCnRWXEuz49SDHZRnbD8P+bOFYCYlhcqLF3uoJa 0Dje904n5kwTQ== From: deller@kernel.org To: Richard Henderson , qemu-devel@nongnu.org Cc: deller@gmx.de Subject: [PATCH 1/5] target/hppa: Fix unaligned double word accesses for hppa64 Date: Sat, 2 Mar 2024 23:35:20 +0100 Message-ID: <20240302223524.24421-2-deller@kernel.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240302223524.24421-1-deller@kernel.org> References: <20240302223524.24421-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=139.178.84.217; envelope-from=deller@kernel.org; helo=dfw.source.kernel.org X-Spam_score_int: -71 X-Spam_score: -7.2 X-Spam_bar: ------- X-Spam_report: (-7.2 / 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_HI=-5, 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: 1709419027662100001 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. Clearing bit 32..39 in psw prior to restoring it solves the problem. Fixes: 931adff31478 ("target/hppa: Update cpu_hppa_get/put_psw for hppa64") Cc: Richard Henderson Cc: Charlie Jenkins Cc: Helge Deller Signed-off-by: Guenter Roeck Reviewed-by: Richard Henderson --- target/hppa/helper.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/target/hppa/helper.c b/target/hppa/helper.c index 859644c47a..7b798d1227 100644 --- a/target/hppa/helper.c +++ b/target/hppa/helper.c @@ -76,7 +76,12 @@ void cpu_hppa_put_psw(CPUHPPAState *env, target_ulong ps= w) } psw &=3D ~reserved; =20 - env->psw =3D psw & ~(PSW_N | PSW_V | PSW_CB); + if (hppa_is_pa20(env)) { + env->psw =3D psw & ~(PSW_N | PSW_V | PSW_CB | 0xff00000000ull); + } else { + env->psw =3D psw & ~(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