Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc64/sparc64 sun4v: Introduce a new macro ALTERN...
details: https://anonhg.NetBSD.org/src/rev/34101d61af3c
branches: trunk
changeset: 331031:34101d61af3c
user: palle <palle%NetBSD.org@localhost>
date: Sun Jul 27 16:37:47 2014 +0000
description:
sun4v: Introduce a new macro ALTERNATE_GLOBALS (matching NORMAL_GLOBALS). Two new helper macros ENABLE_INTERRUPTS and DISABLE_INTERRUPTS are also created. With these changes the GENERIC.UP kernel
will reach rootmount on sun4v systems - ok martin@
diffstat:
sys/arch/sparc64/sparc64/locore.s | 41 +++++++++++++++++++++++++++++++++++---
1 files changed, 37 insertions(+), 4 deletions(-)
diffs (72 lines):
diff -r d86fb24cd0ac -r 34101d61af3c sys/arch/sparc64/sparc64/locore.s
--- a/sys/arch/sparc64/sparc64/locore.s Sun Jul 27 14:24:17 2014 +0000
+++ b/sys/arch/sparc64/sparc64/locore.s Sun Jul 27 16:37:47 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.367 2014/07/26 17:16:41 palle Exp $ */
+/* $NetBSD: locore.s,v 1.368 2014/07/27 16:37:47 palle Exp $ */
/*
* Copyright (c) 2006-2010 Matthew R. Green
@@ -159,7 +159,38 @@
wrpr %g0, \scratch, %pstate
3:
.endm
+
+ .macro ALTERNATE_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, 1, %gl
+2:
+#endif
+ /* sun4u */
+ rdpr %pstate, \scratch
+ or \scratch, PSTATE_AG, \scratch ! Alternate Globals (AG) bit set to one
+ wrpr %g0, \scratch, %pstate
+3:
+ .endm
+ .macro ENABLE_INTERRUPTS scratch
+ rdpr %pstate, \scratch
+ or \scratch, PSTATE_IE, \scratch ! Interrupt Enable (IE) bit set to one
+ wrpr %g0, \scratch, %pstate
+ .endm
+
+ .macro DISABLE_INTERRUPTS scratch
+ rdpr %pstate, \scratch
+ and \scratch, ~PSTATE_IE, \scratch ! Interrupt Enable (IE) bit set to zero
+ wrpr %g0, \scratch, %pstate
+ .endm
+
#ifdef SUN4V
/* Misc. sun4v macros */
@@ -3904,10 +3935,12 @@
!!
bnz,pn %icc, 1f ! Returning to userland?
nop
- wrpr %g0, PSTATE_INTR, %pstate
+ ENABLE_INTERRUPTS %g5
wrpr %g0, %g0, %pil ! Lower IPL
1:
- wrpr %g0, PSTATE_KERN, %pstate ! Make sure we have normal globals & no IRQs
+ !! Make sure we have normal globals & no IRQs
+ DISABLE_INTERRUPTS %g5
+ NORMAL_GLOBALS %g5
/* Restore normal globals */
ldx [%sp + CC64FSZ + STKB + TF_G + (1*8)], %g1
@@ -3921,7 +3954,7 @@
#ifdef TRAPS_USE_IG
wrpr %g0, PSTATE_KERN|PSTATE_IG, %pstate ! DEBUG
#else
- wrpr %g0, PSTATE_KERN|PSTATE_AG, %pstate
+ ALTERNATE_GLOBALS %g7 ! Assuming %g7 is ok to trash
#endif
ldx [%sp + CC64FSZ + STKB + TF_O + (0*8)], %i0
ldx [%sp + CC64FSZ + STKB + TF_O + (1*8)], %i1
Home |
Main Index |
Thread Index |
Old Index