[OpenBIOS] [PATCHv2 08/11] SPARC64: split off CPU window reset logic into RESET_CPU_WINDOW_STATE macro

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Sun Aug 28 18:24:53 CEST 2016


Use the new macro in places where an empty register window set is required.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
 arch/sparc64/call-client.S |    4 +++-
 arch/sparc64/cpustate.h    |    6 ++++--
 arch/sparc64/vectors.S     |    8 ++++++--
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/arch/sparc64/call-client.S b/arch/sparc64/call-client.S
index 82657c6..5b5cae2 100644
--- a/arch/sparc64/call-client.S
+++ b/arch/sparc64/call-client.S
@@ -81,7 +81,9 @@ sparc64_of_client_interface:
 	stx	%g7, [%g1 + 0x4d0]
 	
 	SAVE_CPU_STATE(cif)
-
+	
+	RESET_CPU_WINDOW_STATE(cif)
+	
 	/* Move to OpenBIOS context stack */
 	setx	_fcstack_ptr, %g6, %g7
 	ldx	[%g7], %g6
diff --git a/arch/sparc64/cpustate.h b/arch/sparc64/cpustate.h
index 1f6c1a0..bb5823b 100644
--- a/arch/sparc64/cpustate.h
+++ b/arch/sparc64/cpustate.h
@@ -116,8 +116,10 @@ save_cpu_window_##type: \
 	 add	%g5, 0x80, %g5; \
 	\
 	/* For 8 windows with 16 registers to save in the window, memory required \
-	is 16*8*8 = 0x400 bytes */ \
-	\
+	is 16*8*8 = 0x400 bytes */
+
+#define RESET_CPU_WINDOW_STATE(type) \
+	wrpr	%g0, %cwp; \
 	/* Now we should be in window 0 so update the other window registers */ \
 	rdpr	%ver, %g6; \
 	and	%g6, 0xf, %g6; \
diff --git a/arch/sparc64/vectors.S b/arch/sparc64/vectors.S
index 9d86b6b..fa30546 100644
--- a/arch/sparc64/vectors.S
+++ b/arch/sparc64/vectors.S
@@ -340,7 +340,9 @@ reload_DMMU_tlb:
 	stx	%g1, [%g7]
 	
 	SAVE_CPU_STATE(dtlb)
-
+	
+	RESET_CPU_WINDOW_STATE(dtlb)
+	
 	/* Switch to 8K TLB locked OpenBIOS stack (note we add an additional 192 bytes required for
 	   gcc to save its arguments when building with -O0) */
 	setx	_fcstack_ptr, %g6, %g7
@@ -391,7 +393,9 @@ reload_IMMU_tlb:
 	stx	%g1, [%g7]
 	
 	SAVE_CPU_STATE(itlb)
-
+	
+	RESET_CPU_WINDOW_STATE(itlb)
+	
 	/* Switch to 8K TLB locked OpenBIOS stack (note we add an additional 192 bytes required for
 	   gcc to save its arguments when building with -O0) */
 	setx	_fcstack_ptr, %g6, %g7
-- 
1.7.10.4




More information about the OpenBIOS mailing list