Changeset 348d1812 in rtems


Ignore:
Timestamp:
May 27, 2014, 9:15:46 AM (5 years ago)
Author:
Daniel Hellstrom <daniel@…>
Branches:
4.11, master
Children:
6930aa7f
Parents:
e7e92da
git-author:
Daniel Hellstrom <daniel@…> (05/27/14 09:15:46)
git-committer:
Daniel Hellstrom <daniel@…> (12/02/14 12:55:50)
Message:

SPARC: window overflow optimization

I see no need for waiting the 3 instruction delay for wim to be
written in this case, since the STD after does not depend on WIM

Location:
c/src/lib
Files:
2 edited

Legend:

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

    re7e92da r348d1812  
    4343
    4444/*
     45 * Window Overflow optimized trap table entry
     46 */
     47#define WOTRAP(_vector, _handler)  \
     48  sethi %hi(_handler), %l4; \
     49  jmp   %l4+%lo(_handler); \
     50    save; \
     51  nop
     52
     53/*
    4554 *  Software trap. Treat as BAD_TRAP for the time being...
    4655 */
     
    7382  BAD_TRAP;                                     ! 03 privileged instruction
    7483  BAD_TRAP;                                     ! 04 fp disabled
    75   TRAP( 5, SYM(window_overflow_trap_handler) ); ! 05 window overflow
     84  WOTRAP(5, SYM(window_overflow_trap_handler)); ! 05 window overflow
    7685  TRAP( 6, SYM(window_underflow_trap_handler) );! 06 window underflow
    7786  BAD_TRAP;                                     ! 07 memory address not aligned
  • c/src/lib/libcpu/sparc/reg_win/window.S

    re7e92da r348d1812  
    3030         *  On entry:
    3131         *
    32          *    l0 = psr (from trap table)
    33          *    l1 = pc
    34          *    l2 = npc
     32         *    prev regwin l1 = pc
     33         *    prev regwin l2 = npc
    3534         */
    3635
     
    5251         */
    5352
    54         mov  %wim, %l3                   ! l3 = WIM
    55         mov  %g1, %l7                    ! save g1
    56         srl  %l3, 1, %g1                 ! g1 = WIM >> 1
    57         sll  %l3, SPARC_NUMBER_OF_REGISTER_WINDOWS-1 , %l4
    58                                          ! l4 = WIM << (Number Windows - 1)
    59         or   %l4, %g1, %g1               ! g1 = (WIM >> 1) |
    60                                          !      (WIM << (Number Windows - 1))
    61 
    62         save                             ! Get into window to be saved.
    63         mov  %g1, %wim                   ! load new WIM
    64         nop; nop; nop                    ! 3 slot delay
    6553        std  %l0, [%sp + 0x00]           ! save local register set
    6654        std  %l2, [%sp + 0x08]
     55        mov  %wim, %l3
     56        sll  %l3, SPARC_NUMBER_OF_REGISTER_WINDOWS-1 , %l2
     57                                         ! l2  = WIM << (Number Windows - 1)
    6758        std  %l4, [%sp + 0x10]
    6859        std  %l6, [%sp + 0x18]
     60        srl  %l3, 1, %l3                 ! l3  = WIM >> 1
     61        wr   %l3, %l2, %wim              ! WIM = (WIM >> 1) ^
     62                                         !       (WIM << (Number Windows - 1))
    6963        std  %i0, [%sp + 0x20]           ! save input register set
    7064        std  %i2, [%sp + 0x28]
     
    7266        std  %i6, [%sp + 0x38]
    7367        restore                          ! Go back to trap window.
    74         mov  %l7, %g1                    ! restore g1
    7568        jmp  %l1                         ! Re-execute save.
    76         rett %l2
     69         rett %l2
    7770
    7871        /*
Note: See TracChangeset for help on using the changeset viewer.