[OpenBIOS] [PATCHv2 10/11] SPARC64: point __context to saved context during CIF calls
Mark Cave-Ayland
mark.cave-ayland at ilande.co.uk
Sun Aug 28 18:24:55 CEST 2016
This will enable Forth executed in CIF calls to be able to modify its
own context and return.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
arch/sparc64/call-client.S | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/arch/sparc64/call-client.S b/arch/sparc64/call-client.S
index 5b5cae2..ebab6b9 100644
--- a/arch/sparc64/call-client.S
+++ b/arch/sparc64/call-client.S
@@ -14,6 +14,8 @@
.data
.align 8
+client_context:
+ .xword 0
client_stack:
.xword 0
client_tba:
@@ -84,6 +86,13 @@ sparc64_of_client_interface:
RESET_CPU_WINDOW_STATE(cif)
+ /* Update __context to point to saved area */
+ setx __context, %g6, %g7
+ ldx [%g7], %g3
+ setx client_context, %g4, %g5
+ stx %g3, [%g5]
+ stx %g1, [%g7]
+
/* Move to OpenBIOS context stack */
setx _fcstack_ptr, %g6, %g7
ldx [%g7], %g6
@@ -109,6 +118,12 @@ sparc64_of_client_interface:
/* Return value */
stx %o0, [%g1 + 0x70]
+ /* Restore __context */
+ setx client_context, %g4, %g5
+ ldx [%g5], %g3
+ setx __context, %g6, %g7
+ stx %g3, [%g7]
+
RESTORE_CPU_STATE(cif)
add %g1, CONTEXT_STATE_SIZE, %g5
--
1.7.10.4
More information about the OpenBIOS
mailing list