From f3fa07fa8bfd4aeac24c06f0314789fb7f029745 Mon Sep 17 00:00:00 2001 From: miod Date: Fri, 29 Mar 2024 21:25:55 +0000 Subject: [PATCH] Check for %otherwin being nonzero earlier in rft_user. There is one code path using it in %g2 and another using it in %g7. There is no reason for them to use different registers, and fixing this allows the check to be performed a bit earlier. ok claudio@ kettenis@ --- sys/arch/sparc64/sparc64/locore.s | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/arch/sparc64/sparc64/locore.s b/sys/arch/sparc64/sparc64/locore.s index 6052cb46d2f..e7d4fe3ea3f 100644 --- a/sys/arch/sparc64/sparc64/locore.s +++ b/sys/arch/sparc64/sparc64/locore.s @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.s,v 1.212 2024/03/29 21:23:17 miod Exp $ */ +/* $OpenBSD: locore.s,v 1.213 2024/03/29 21:25:55 miod Exp $ */ /* $NetBSD: locore.s,v 1.137 2001/08/13 06:10:10 jdolecek Exp $ */ /* @@ -4527,6 +4527,10 @@ rft_user: andn %g1, CWP, %g1 wrpr %g1, %g7, %tstate + rdpr %otherwin, %g7 + brnz %g7, 1f + nop + /* XXX Rewrite sun4u code to handle faults like sun4v. */ sethi %hi(cputyp), %g2 ld [%g2 + %lo(cputyp)], %g2 @@ -4534,10 +4538,6 @@ rft_user: bne,pt %icc, 1f nop - rdpr %otherwin, %g2 - brnz %g2, 1f - nop - wr %g0, ASI_AIUS, %asi rdpr %cwp, %g1 dec %g1 @@ -4554,8 +4554,8 @@ rft_user_fault_end: rdpr %canrestore, %g7 wrpr %g7, 0, %otherwin wrpr %g0, 0, %canrestore + rdpr %otherwin, %g7 1: - rdpr %otherwin, %g7 ! restore register window controls wrpr %g7, 0, %canrestore wrpr %g0, 0, %otherwin wrpr WSTATE_USER, %wstate ! Need to know where our sp points -- 2.20.1