j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
Author: mcayland Date: Tue Dec 29 16:50:44 2015 New Revision: 1366 URL: http://tracker.coreboot.org/trac/openbios/changeset/1366
Log: SPARC64: rearrange saved state window order
Instead of storing the windows in numerical order, store them starting from %cwp. This means the current window can be located at a fixed point in the state, rather than calculating the offset based upon %cwp.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
Modified: trunk/openbios-devel/arch/sparc64/cpustate.h
Modified: trunk/openbios-devel/arch/sparc64/cpustate.h ============================================================================== --- trunk/openbios-devel/arch/sparc64/cpustate.h Tue Dec 29 16:50:41 2015 (r1365) +++ trunk/openbios-devel/arch/sparc64/cpustate.h Tue Dec 29 16:50:44 2015 (r1366) @@ -72,11 +72,15 @@ /* Get the number of windows in %g6 */ \ rdpr %ver, %g6; \ and %g6, 0xf, %g6; \ - inc %g6; \ + \ + mov %g6, %g4; \ + inc %g4; \ + \ + /* Starting cwp in g7 */ \ + rdpr %cwp, %g7; \ \ save_cpu_window_##type: \ - deccc %g6; \ - wrpr %g6, %cwp; \ + wrpr %g7, %cwp; \ stx %l0, [%g5]; \ stx %l1, [%g5 + 0x8]; \ stx %l2, [%g5 + 0x10]; \ @@ -93,6 +97,9 @@ stx %i5, [%g5 + 0x68]; \ stx %i6, [%g5 + 0x70]; \ stx %i7, [%g5 + 0x78]; \ + dec %g7; \ + and %g7, %g6, %g7; \ + subcc %g4, 1, %g4; \ bne save_cpu_window_##type; \ add %g5, 0x80, %g5; \ \ @@ -144,14 +151,18 @@ /* Get the number of windows in %g6 */ \ rdpr %ver, %g6; \ and %g6, 0xf, %g6; \ - inc %g6; \ + \ + mov %g6, %g4; \ + inc %g4; \ + \ + /* Set starting window */ \ + ldx [%g1], %g7; \ \ /* Now iterate through all of the windows restoring all l and i registers */ \ add %g1, 0x90, %g5; \ \ restore_cpu_window_##type: \ - deccc %g6; \ - wrpr %g6, %cwp; \ + wrpr %g7, %cwp; \ ldx [%g5], %l0; \ ldx [%g5 + 0x8], %l1; \ ldx [%g5 + 0x10], %l2; \ @@ -168,6 +179,9 @@ ldx [%g5 + 0x68], %i5; \ ldx [%g5 + 0x70], %i6; \ ldx [%g5 + 0x78], %i7; \ + dec %g7; \ + and %g7, %g6, %g7; \ + subcc %g4, 1, %g4; \ bne restore_cpu_window_##type; \ add %g5, 0x80, %g5; \ \