[OpenBIOS] [PATCH 3/4] SPARC64: defer set_trap_table effect until CIF exit
Mark Cave-Ayland
mark.cave-ayland at ilande.co.uk
Wed May 21 23:51:56 CEST 2014
Since OpenBIOS invokes window fill/spill traps during normal operation, make
sure that we defer setting the client trap table until we return control
back to the client.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
openbios-devel/arch/sparc64/call-client.S | 14 +++++++++++++-
openbios-devel/arch/sparc64/openbios.c | 8 ++++++--
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/openbios-devel/arch/sparc64/call-client.S b/openbios-devel/arch/sparc64/call-client.S
index 18de704..47d937f 100644
--- a/openbios-devel/arch/sparc64/call-client.S
+++ b/openbios-devel/arch/sparc64/call-client.S
@@ -1,4 +1,4 @@
- .globl sparc64_of_client_interface
+ .globl sparc64_of_client_interface, client_tba
.data
.align 8
@@ -8,6 +8,8 @@ openbios_stack:
client_stack:
.xword 0
+client_tba:
+ .xword 0
.text
.align 4
@@ -35,6 +37,11 @@ sparc64_of_client_interface:
stx %g6, [%sp + 2047 + 40]
stx %g7, [%sp + 2047 + 48]
+ /* Save client trap table */
+ setx client_tba, %g6, %g7
+ rdpr %tba, %g6
+ stx %g6, [%g7]
+
/* Save existing stack and move to openbios stack */
setx client_stack, %g6, %g7
stx %sp, [%g7]
@@ -54,6 +61,11 @@ sparc64_of_client_interface:
setx client_stack, %g6, %g7
ldx [%g7], %sp
+ /* Restore client trap table */
+ setx client_tba, %g6, %g7
+ ldx [%g7], %g6
+ wrpr %g6, %tba
+
/* Restore globals */
ldx [%sp + 2047 + 0], %g1
ldx [%sp + 2047 + 8], %g2
diff --git a/openbios-devel/arch/sparc64/openbios.c b/openbios-devel/arch/sparc64/openbios.c
index 9ce3e53..9cc1ac2 100644
--- a/openbios-devel/arch/sparc64/openbios.c
+++ b/openbios-devel/arch/sparc64/openbios.c
@@ -91,14 +91,18 @@ struct cpudef {
/*
( addr -- ? )
*/
+
+extern volatile uint64_t client_tba;
+
static void
set_trap_table(void)
{
unsigned long addr;
addr = POP();
- asm("wrpr %0, %%tba\n"
- : : "r" (addr));
+
+ /* Update client_tba to be updated on CIF exit */
+ client_tba = addr;
}
/* Reset control register is defined in 17.2.7.3 of US IIi User Manual */
--
1.7.10.4
More information about the OpenBIOS
mailing list