From nobody Tue Nov 26 09:37: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=Y2RSSSZgRPTU3X4NLGV6O6ahwrXnZbD02Y95hjdz/i7yivIyvnZZt+z4U1epwCY/86mLKbd/yo+tAgjiZDDYE8HIaDuVHx4b8GQBwM9+eiAxKhFHWDFm2alkNuTTc17W1brUngxRe5jlziipEtK5b2Wc3VApeM6RYzy6FQf7s5o= 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=dHAjxhqi6A/ig3pOleXx9R2lJXIOTYqWmmFIMxQ2WRI=; b=TToePxF8QdJC0uhbI8+N6yqSlmb/C2x7XjeW3n9JXCJB4xHNig1iNHFkiAWanR8RbdinvNvq7Tec3f726Uacak2rX4PoeTJ7Os+PdI/o5XiVxm+KCupKaBUIxSP6sK4vg1Stf20lAaL8Jvv3/C/1ebEblZyH+VO8dsy3RgscB28= 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 1709444847202533.3238639271988; 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 1rgegh-0006OX-JM; Sun, 03 Mar 2024 00:47:05 -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 1rgegc-0006Nr-Ir for qemu-devel@nongnu.org; Sun, 03 Mar 2024 00:46:58 -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 1rgega-0003TC-IH for qemu-devel@nongnu.org; Sun, 03 Mar 2024 00:46:58 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 677AECE0BA2; Sun, 3 Mar 2024 05:46:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BAF38C433C7; Sun, 3 Mar 2024 05:46:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709444811; bh=TEWdzILrV4pLmXqhMjDi4BO8XrxiN8CRUX+btOJyJas=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qjP0SY6bB6IXD6yWk/f7/IqKCfCBqBVwhga0+zhiM3IbSYhfagHVoArGpyfDyKd8i j7pPYt0XXgJ8w7WWIaSfzDnPXCjsPwqbpyrz7n6zgZm4gR4nIFiLdhEqPr3XWttJl6 6pVS1VmH+zWdDtk3gaJcKi/6m4v3t/e9GzAhWfs+qvE3YZI/bYvybUe95K15Z7RM2T /9IHEWHkvodyAu5xplQ7e3QtwedXTsO3FizSOJkuvMqFcnoJOtOEykNkQYKBbOVimf FS6i1PhpWZOCvWsVTxHP1eNsm+oYh3u5zknhFzpdtmtIvCcp+gFujYQSdWSZDWLcJy 02ti1SSaf0viw== From: deller@kernel.org To: qemu-devel@nongnu.org, Richard Henderson Cc: deller@gmx.de Subject: [PULL 2/5] target/hppa: Restore unwind_breg before calculating ior Date: Sun, 3 Mar 2024 06:46:42 +0100 Message-ID: <20240303054645.3004-3-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=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: 1709444848093100001 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