Port-sparc64 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: NetBSD on Sun T5220



On Sun, 5 Oct 2025, Sad Clouds wrote:


I have identified a potential issue in the locore.s file (pcbspill) where
%otherwin > 1 is not handles properly (at least in the sun4v issue I have
been debugging).

I should be able to provide a patch within a day or two - still unsure if
it fixes the issue 100% though and does not cause regression for sun4u.


Hello.

Here is my first attempt to fix the issue.

I'm still not 100% sure that it works as expected, but please give it a try and report back your results.

The code in 'pcbspill' is sun4v-only, so no impact on sun4u.

Regards
Palle


diff --git a/sys/arch/sparc64/sparc64/locore.s b/sys/arch/sparc64/sparc64/locore.s
index 72718a8197db..d12b15fa972f 100644
--- a/sys/arch/sparc64/sparc64/locore.s
+++ b/sys/arch/sparc64/sparc64/locore.s
@@ -3469,13 +3469,25 @@ pcbspill:
lduba [%g6 + PCB_NSAVED] %asi, %g7 ! Fetch current nsaved from the pcb sllx %g7, 7, %g5 ! 8+8 registers each 8 bytes = 128 bytes (2^7) add %g6, %g5, %g5 ! Offset into pcb_rw
+1:
SPILL stxa, %g5 + PCB_RW, 8, %asi ! Store the locals and ins
-       saved

-       sllx    %g7, 3, %g5
-       add     %g6, %g5, %g5
+ add %g5, 16*8, %g5 ! Next location for saved register windows

-       inc     %g7
+ stxa %o6, [%g5 + PCB_RW + (14*8)] %asi ! Save %sp so we can write these all out
+
+ saved ! Increments %cansave and decrements %otherwin
+
+ rdpr %cwp, %g1 ! shift register window forward
+       inc     %g1
+       wrpr    %g1, %cwp
+
+ inc %g7 ! increment number of saved register windows
+
+ rdpr %otherwin, %g1 ! Check to see if done spill'ing otherwin
+       brnz,pt %g1, 1b
+        nop
+
        stba    %g7, [%g6 + PCB_NSAVED] %asi

        retry











Home | Main Index | Thread Index | Old Index