summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libcpu
diff options
context:
space:
mode:
authorDaniel Hellstrom <daniel@gaisler.com>2014-11-11 15:18:01 +0100
committerDaniel Hellstrom <daniel@gaisler.com>2014-12-02 13:57:20 +0100
commit0d3b5d47429effb350448d9e9123a67db722109f (patch)
tree589e3d1b674275049739d8ca6c686c979d0e4ad1 /c/src/lib/libcpu
parentSPARC: optimize window overflow trap entry (diff)
downloadrtems-0d3b5d47429effb350448d9e9123a67db722109f.tar.bz2
SPARC: optimize window underflow trap
Save five instructions on underflow handling. By using an optimized trap entry we can move instructions from the window underflow function into the trap entry vector. By setting WIM=0 and using RESTORE it is possible to move the new WIM register content from the trapped window into the to-be-restored register window. It is then possible to avoid the WIM write delay.
Diffstat (limited to 'c/src/lib/libcpu')
-rw-r--r--c/src/lib/libcpu/sparc/reg_win/window.S14
1 files changed, 6 insertions, 8 deletions
diff --git a/c/src/lib/libcpu/sparc/reg_win/window.S b/c/src/lib/libcpu/sparc/reg_win/window.S
index a7d6910219..06a7056c03 100644
--- a/c/src/lib/libcpu/sparc/reg_win/window.S
+++ b/c/src/lib/libcpu/sparc/reg_win/window.S
@@ -74,9 +74,9 @@ SYM(window_overflow_trap_handler):
*
* On entry:
*
- * l0 = psr (from trap table)
* l1 = pc
* l2 = npc
+ * l3 = wim (from trap table)
*/
PUBLIC(window_underflow_trap_handler)
@@ -96,17 +96,15 @@ SYM(window_underflow_trap_handler):
* register will result in the local register set changing.
*/
- mov %wim, %l3 ! Calculate new WIM
+ ! In WIM 3 write instruction delay. since WIM<=0 from trap entry
sll %l3, 1, %l4 ! l4 = WIM << 1
srl %l3, SPARC_NUMBER_OF_REGISTER_WINDOWS-1, %l5
- ! l5 = WIM >> (Number Windows-1)
- or %l5, %l4, %l5 ! l5 = (WIM << 1) |
+ or %l5, %l4, %i5 ! %i5= (WIM << 1) |
! (WIM >> (Number Windows-1))
- mov %l5, %wim ! load the new WIM
- nop; nop; nop
restore ! Two restores to get into the
- restore ! window to restore
+ restore %o5, %g0, %l7 ! window to restore. Carry along new WIM
ldd [%sp + 0x00], %l0 ! First the local register set
+ mov %l7, %wim ! load the new WIM
ldd [%sp + 0x08], %l2
ldd [%sp + 0x10], %l4
ldd [%sp + 0x18], %l6
@@ -117,7 +115,7 @@ SYM(window_underflow_trap_handler):
save ! Get back to the trap window.
save
jmp %l1 ! Re-execute restore.
- rett %l2
+ rett %l2
/*
* Flush All Windows trap handler.