Author: mcayland Date: Fri May 23 14:01:43 2014 New Revision: 1301 URL: http://tracker.coreboot.org/trac/openbios/changeset/1301
Log: SPARC64: defer set_trap_table effect until CIF exit
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@ilande.co.uk
Modified: trunk/openbios-devel/arch/sparc64/call-client.S trunk/openbios-devel/arch/sparc64/openbios.c
Modified: trunk/openbios-devel/arch/sparc64/call-client.S ============================================================================== --- trunk/openbios-devel/arch/sparc64/call-client.S Fri May 23 14:01:40 2014 (r1300) +++ trunk/openbios-devel/arch/sparc64/call-client.S Fri May 23 14:01:43 2014 (r1301) @@ -1,4 +1,4 @@ - .globl sparc64_of_client_interface + .globl sparc64_of_client_interface, client_tba
.data .align 8 @@ -8,6 +8,8 @@
client_stack: .xword 0 +client_tba: + .xword 0
.text .align 4 @@ -35,6 +37,11 @@ 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 @@ 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
Modified: trunk/openbios-devel/arch/sparc64/openbios.c ============================================================================== --- trunk/openbios-devel/arch/sparc64/openbios.c Fri May 23 14:01:40 2014 (r1300) +++ trunk/openbios-devel/arch/sparc64/openbios.c Fri May 23 14:01:43 2014 (r1301) @@ -91,14 +91,18 @@ /* ( 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 */