sun4v: Introduce a NORMAL_GLOBALS macro - first used in sparc_interrupt - other relevant uses will be handled as the sun4v work is progressesing - ok martin@ trunk
authorpalle <palle@NetBSD.org>
Sat, 19 Jul 2014 20:58:12 +0000
branchtrunk
changeset 228586 22c3fceb5e95
parent 228585 6640af5cca45
child 228587 f5129c1c565f
sun4v: Introduce a NORMAL_GLOBALS macro - first used in sparc_interrupt - other relevant uses will be handled as the sun4v work is progressesing - ok martin@
sys/arch/sparc64/sparc64/locore.s
--- a/sys/arch/sparc64/sparc64/locore.s	Sat Jul 19 20:21:52 2014 +0000
+++ b/sys/arch/sparc64/sparc64/locore.s	Sat Jul 19 20:58:12 2014 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.364 2014/07/16 19:53:18 palle Exp $	*/
+/*	$NetBSD: locore.s,v 1.365 2014/07/19 20:58:12 palle Exp $	*/
 
 /*
  * Copyright (c) 2006-2010 Matthew R. Green
@@ -141,6 +141,24 @@
 	.endm
 
 
+	.macro	NORMAL_GLOBALS scratch
+#ifdef SUN4V
+	sethi	%hi(cputyp), \scratch
+	ld	[\scratch + %lo(cputyp)], \scratch
+	cmp	\scratch, CPU_SUN4V
+	bne,pt	%icc, 2f
+	 nop
+	/* sun4v */
+	ba	3f
+	 wrpr	%g0, 0, %gl
+2:		
+#endif	
+	/* sun4u */
+	wrpr	%g0, PSTATE_KERN, %pstate
+3:
+	.endm
+	
+
 #ifdef SUN4V
 	/* Misc. sun4v macros */
 	
@@ -3582,7 +3600,7 @@
 #endif
 	INTR_SETUP(-CC64FSZ-TF_SIZE)
 	! Switch to normal globals so we can save them
-	wrpr	%g0, PSTATE_KERN, %pstate
+	NORMAL_GLOBALS %g5
 	stx	%g1, [%sp + CC64FSZ + STKB + TF_G + ( 1*8)]
 	stx	%g2, [%sp + CC64FSZ + STKB + TF_G + ( 2*8)]
 	stx	%g3, [%sp + CC64FSZ + STKB + TF_G + ( 3*8)]