diff options
author | Daniel Hellstrom <daniel@gaisler.com> | 2014-11-11 15:18:01 +0100 |
---|---|---|
committer | Daniel Hellstrom <daniel@gaisler.com> | 2014-12-02 13:57:20 +0100 |
commit | 0d3b5d47429effb350448d9e9123a67db722109f (patch) | |
tree | 589e3d1b674275049739d8ca6c686c979d0e4ad1 | |
parent | SPARC: optimize window overflow trap entry (diff) | |
download | rtems-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.
-rw-r--r-- | c/src/lib/libbsp/sparc/shared/start/start.S | 11 | ||||
-rw-r--r-- | c/src/lib/libcpu/sparc/reg_win/window.S | 14 |
2 files changed, 16 insertions, 9 deletions
diff --git a/c/src/lib/libbsp/sparc/shared/start/start.S b/c/src/lib/libbsp/sparc/shared/start/start.S index b7067b32bd..3e0e42e7df 100644 --- a/c/src/lib/libbsp/sparc/shared/start/start.S +++ b/c/src/lib/libbsp/sparc/shared/start/start.S @@ -51,6 +51,15 @@ nop /* + * Window Underflow optimized trap table entry + */ +#define WUTRAP(_vector, _handler) \ + mov %wim, %l3 ; \ + sethi %hi(_handler), %l4 ; \ + jmp %l4+%lo(_handler); \ + mov %g0, %wim ! WIM = 0, so that we can restore regardless of WIM + +/* * Software trap. Treat as BAD_TRAP for the time being... */ @@ -82,7 +91,7 @@ SYM(trap_table): BAD_TRAP; ! 03 privileged instruction BAD_TRAP; ! 04 fp disabled WOTRAP(5, SYM(window_overflow_trap_handler)); ! 05 window overflow - TRAP( 6, SYM(window_underflow_trap_handler) );! 06 window underflow + WUTRAP(6, SYM(window_underflow_trap_handler));! 06 window underflow BAD_TRAP; ! 07 memory address not aligned BAD_TRAP; ! 08 fp exception BAD_TRAP; ! 09 data access exception 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. |