From nobody Tue Nov 26 08:28:08 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=1709418987; cv=none; d=zohomail.com; s=zohoarc; b=JPWw6WlsdbPBfexaTqLTnBygu0CYgjoiJkl7FPLfhu4tbA2gn5sfWOq2JgX6Gp6v6GAYbljqsEqogtnkgj3R3aXlXjW0vN/0+vmlY3ETd3mjC2oOj07rMs3iCpbyNL5QS6KXjSj+bhdzPzbUEAOZf5k31vQQzKfOeuFWEstBSUM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1709418987; 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=HEcxFSYFz0mrG7KCVmJNL+U9gzGDrMxzPdJrq5o/dtM=; b=Qi/SuCzyBu+48tq3ZccYxq/62CvztsIptvahL3U1snkeFED4g0PfuHpOVu5tqSTRQhqR9X7x4PGshDrsuQEkgO3eEm1q5WEICcs0ohIUuf5YxnenURb1WVDqHyB355Q0fE6b6BzVNy9qxTWy0J+Zs+i2oUCkyHKCF0RLEVWt148= 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 1709418987344736.2180593786617; Sat, 2 Mar 2024 14:36:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rgXxK-0006AF-6x; Sat, 02 Mar 2024 17:35:46 -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-00069P-Jr for qemu-devel@nongnu.org; Sat, 02 Mar 2024 17:35:42 -0500 Received: from sin.source.kernel.org ([145.40.73.55]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rgXxD-0003h0-VG 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 sin.source.kernel.org (Postfix) with ESMTP id 9A90CCE0E56; Sat, 2 Mar 2024 22:35:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2884C433C7; Sat, 2 Mar 2024 22:35:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709418929; bh=H1D85PsxCikcpBoGzIuPNZM3ookZM27ORgB1MqAcUdI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=st+3lG8HjmKe+ElVac6VIng5HznaQFCP9sZHXUkod+Omg7WnJASBcTR0wBEU5uaV3 HV6kSIoQ7dBZe5I0Seznf/K67I4dJ7EPFHjyZhN5JlnPSotQq836YvGeTRPLfb2WdU 62jd4qPbVNezySKHjhchE2/SzSW60nA4UYhuwyUyZjL1bwo9oEsxkZovpOS1mTBnV8 PixZIhm1kUfgN4zeyfWi7ZuKOb4YPqXKVcrf4cvttBC1myDE2uCEzuYdz5WYei08Hi H9a2seoumXAGueyfozyD3XyVoFyzRCOeFUgthxYn71N80A86JCFIyCh4buwjJ0mLh9 F/6Th0jRfd9JQ== From: deller@kernel.org To: Richard Henderson , qemu-devel@nongnu.org Cc: deller@gmx.de Subject: [PATCH 2/5] target/hppa: Restore unwind_breg before calculating ior Date: Sat, 2 Mar 2024 23:35:21 +0100 Message-ID: <20240302223524.24421-3-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=145.40.73.55; envelope-from=deller@kernel.org; helo=sin.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: 1709418989580100004 Content-Type: text/plain; charset="utf-8" From: Helge Deller When calculating the IOR for the exception handlers, the current unwind_breg value is needed on 64-bit hppa machines. Restore that value by calling cpu_restore_state() earlier, which in turn calls hppa_restore_state_to_opc() which restores the unwind_breg for the current instruction. Signed-off-by: Helge Deller Fixes: 3824e0d643f3 ("target/hppa: Export function hppa_set_ior_and_isr()") Reviewed-by: Richard Henderson --- target/hppa/cpu.c | 3 ++- target/hppa/mem_helper.c | 3 ++- target/hppa/op_helper.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index afe73d4474..3831cb6db2 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -121,9 +121,10 @@ void hppa_cpu_do_unaligned_access(CPUState *cs, vaddr = addr, CPUHPPAState *env =3D &cpu->env; =20 cs->exception_index =3D EXCP_UNALIGN; + cpu_restore_state(cs, retaddr); hppa_set_ior_and_isr(env, addr, MMU_IDX_MMU_DISABLED(mmu_idx)); =20 - cpu_loop_exit_restore(cs, retaddr); + cpu_loop_exit(cs); } #endif /* CONFIG_USER_ONLY */ =20 diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index 66b8fa7d72..3fc895c1c2 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -348,9 +348,10 @@ raise_exception_with_ior(CPUHPPAState *env, int excp, = uintptr_t retaddr, CPUState *cs =3D env_cpu(env); =20 cs->exception_index =3D excp; + cpu_restore_state(cs, retaddr); hppa_set_ior_and_isr(env, addr, mmu_disabled); =20 - cpu_loop_exit_restore(cs, retaddr); + cpu_loop_exit(cs); } =20 void hppa_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, diff --git a/target/hppa/op_helper.c b/target/hppa/op_helper.c index b1f24a5aad..480fe80844 100644 --- a/target/hppa/op_helper.c +++ b/target/hppa/op_helper.c @@ -351,11 +351,12 @@ target_ulong HELPER(probe)(CPUHPPAState *env, target_= ulong addr, excp =3D hppa_get_physical_address(env, addr, mmu_idx, 0, &phys, &prot, NULL); if (excp >=3D 0) { + cpu_restore_state(env_cpu(env), GETPC()); hppa_set_ior_and_isr(env, addr, MMU_IDX_MMU_DISABLED(mmu_idx)); if (excp =3D=3D EXCP_DTLB_MISS) { excp =3D EXCP_NA_DTLB_MISS; } - hppa_dynamic_excp(env, excp, GETPC()); + helper_excp(env, excp); } return (want & prot) !=3D 0; #endif --=20 2.44.0