Re: NetBSD on Sun T5220

Palle Lyckegaard <[email protected]> Tue, 7 Oct 2025 19:07:07 +0000 (UTC)
Newsgroups gmane.os.netbsd.ports.sparc64
Message-ID <[email protected]>
On Tue, 7 Oct 2025, Sad Clouds wrote:

> Hi, this patch does not apply cleanly. Can you include it as an
> attachment rather than pasting as email text, this way the mail client
> will not break up the lines.
>
> It would be useful if the patch was generated from -current as this is
> what I build with.
>


As requested... :-)
pcbspill.diff (text/plain, 1.1 KB)
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