Changeset 0d3b5d47 in rtems


Ignore:
Timestamp:
Nov 11, 2014, 2:18:01 PM (5 years ago)
Author:
Daniel Hellstrom <daniel@…>
Branches:
4.11, master
Children:
291f30f
Parents:
6930aa7f
git-author:
Daniel Hellstrom <daniel@…> (11/11/14 14:18:01)
git-committer:
Daniel Hellstrom <daniel@…> (12/02/14 12:57:20)
Message:

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.

Location:
c/src/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/sparc/shared/start/start.S

    r6930aa7f r0d3b5d47  
    5050    save; \
    5151  nop
     52
     53/*
     54 * Window Underflow optimized trap table entry
     55 */
     56#define WUTRAP(_vector, _handler)  \
     57  mov   %wim, %l3 ; \
     58  sethi %hi(_handler), %l4 ; \
     59  jmp   %l4+%lo(_handler); \
     60   mov  %g0, %wim ! WIM = 0, so that we can restore regardless of WIM
    5261
    5362/*
     
    8392  BAD_TRAP;                                     ! 04 fp disabled
    8493  WOTRAP(5, SYM(window_overflow_trap_handler)); ! 05 window overflow
    85   TRAP( 6, SYM(window_underflow_trap_handler) );! 06 window underflow
     94  WUTRAP(6, SYM(window_underflow_trap_handler));! 06 window underflow
    8695  BAD_TRAP;                                     ! 07 memory address not aligned
    8796  BAD_TRAP;                                     ! 08 fp exception
  • c/src/lib/libcpu/sparc/reg_win/window.S

    r6930aa7f r0d3b5d47  
    7575         *  On entry:
    7676         *
    77          *    l0 = psr (from trap table)
    7877         *    l1 = pc
    7978         *    l2 = npc
     79         *    l3 = wim (from trap table)
    8080         */
    8181
     
    9797         */
    9898
    99         mov  %wim, %l3                  ! Calculate new WIM
     99        ! In WIM 3 write instruction delay. since WIM<=0 from trap entry
    100100        sll  %l3, 1, %l4                ! l4 = WIM << 1
    101101        srl  %l3, SPARC_NUMBER_OF_REGISTER_WINDOWS-1, %l5
    102                                         ! l5 = WIM >> (Number Windows-1)
    103         or   %l5, %l4, %l5              ! l5 = (WIM << 1) |
     102        or   %l5, %l4, %i5              ! %i5= (WIM << 1) |
    104103                                        !      (WIM >> (Number Windows-1))
    105         mov  %l5, %wim                  ! load the new WIM
    106         nop; nop; nop
    107104        restore                         ! Two restores to get into the
    108         restore                         ! window to restore
     105        restore %o5, %g0, %l7           ! window to restore. Carry along new WIM
    109106        ldd  [%sp + 0x00], %l0          ! First the local register set
     107        mov   %l7, %wim                 ! load the new WIM
    110108        ldd  [%sp + 0x08], %l2
    111109        ldd  [%sp + 0x10], %l4
     
    118116        save
    119117        jmp  %l1                        ! Re-execute restore.
    120         rett  %l2
     118         rett  %l2
    121119
    122120        /*
Note: See TracChangeset for help on using the changeset viewer.