Changeset 5166513c in rtems


Ignore:
Timestamp:
Jul 16, 2008, 9:44:14 PM (11 years ago)
Author:
Till Straumann <strauman@…>
Branches:
4.10, 4.11, 4.9, master
Children:
441c930
Parents:
7d453cf
Message:

2008-07-16 Till Straumann <strauman@…>

  • new-exceptions/bspsupport/ppc_exc_asm_macros.h: Added a test to TEST_LOCK_crit so that a context switch is always prevented if MSR_CE is not set in the interrupt mask. (Support mode where the user wants to leave MSR_CE always enabled but abstains from calling OS primitives from the exception handler.)
Location:
c/src/lib/libcpu/powerpc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libcpu/powerpc/ChangeLog

    r7d453cf r5166513c  
     12008-07-16      Till Straumann <strauman@slac.stanford.edu>
     2
     3        * new-exceptions/bspsupport/ppc_exc_asm_macros.h: Added
     4        a test to TEST_LOCK_crit so that a context switch is
     5        always prevented if MSR_CE is not set in the interrupt mask.
     6        (Support mode where the user wants to leave MSR_CE always enabled
     7        but abstains from calling OS primitives from the exception
     8        handler.)
     9
    1102008-07-16      Till Straumann <strauman@slac.stanford.edu>
    211
  • c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_asm_macros.h

    r7d453cf r5166513c  
    141141 *****************************************************************************
    142142 *
    143  * USES:    REG, CR_LOCK
     143 * USES:    REG, cr0
    144144 * ON EXIT: REG available (contains *pc - STW_R1_R13(0)),
    145  *          return value in CR_LOCK.
     145 *          return value in cr0.
    146146 *
    147147 * test opcode interrupted by critical (asynchronous) exception; set CR_LOCK if
     
    162162         * address offset then we have a match...
    163163         */
    164         cmpli   CR_LOCK, \_REG, ppc_exc_lock_std@sdarel
     164        cmplwi  cr0, \_REG, ppc_exc_lock_std@sdarel
    165165
    166166        .endm
     
    191191 * critical-exception wrapper has to check 'std' lock:
    192192 *
    193  * Return CR_LOCK = (   ppc_lock_std == 0
     193 * Return CR_LOCK = (   (interrupt_mask & MSR_CE) != 0
     194                 &&                  ppc_lock_std == 0
    194195 *               && * SRR0 != <write std lock instruction> )
    195196 *
    196197 */
    197198        .macro  TEST_LOCK_crit _FLVR
     199        /* If MSR_CE is not in the IRQ mask then we must never allow
     200         * thread-dispatching!
     201         */
     202        GET_INTERRUPT_MASK mask=SCRATCH_REGISTER_1
     203        /* EQ(cr0) = ((interrupt_mask & MSR_CE) == 0) */
     204        andis.  SCRATCH_REGISTER_1, SCRATCH_REGISTER_1, MSR_CE@h
     205        beq     TEST_LOCK_crit_done_\_FLVR             
    198206
    199207        /* STD interrupt could have been interrupted before executing the 1st
     
    203211        TEST_1ST_OPCODE_crit    _REG=SCRATCH_REGISTER_0
    204212        /*
    205          * At this point CR_LOCK is set if
     213         * At this point cr0 is set if
    206214         *
    207215         *   *(PC) == 'stw r1, ppc_exc_lock_std@sdarel(r13)'
     
    211219        /* check lock */
    212220        lwz     SCRATCH_REGISTER_1, ppc_exc_lock_std@sdarel(r13)
    213         cmpli   cr0, SCRATCH_REGISTER_1, 0
    214         /*
    215          *
    216          * CR_LOCK = (   *pc != <write std lock instruction>
    217          *        && ppc_exc_lock_std == 0 )
    218          */
    219         crandc  EQ(CR_LOCK), EQ(cr0), EQ(CR_LOCK)
     221        cmplwi  CR_LOCK, SCRATCH_REGISTER_1, 0
     222
     223        /* set EQ(CR_LOCK) to result */
     224TEST_LOCK_crit_done_\_FLVR:
     225        /* If we end up here because the interrupt mask did not contain
     226     * MSR_CE then cr0 is set and therefore the value of CR_LOCK
     227         * does not matter since   x && !1 == 0:
     228         *
     229         *  if ( (interrupt_mask & MSR_CE) == 0 ) {
     230         *      EQ(CR_LOCK) = EQ(CR_LOCK) && ! ((interrupt_mask & MSR_CE) == 0)
     231         *  } else {
     232         *      EQ(CR_LOCK) = (ppc_exc_lock_std == 0) && ! (*pc == <write std lock instruction>)
     233         *  }
     234         */
     235        crandc  EQ(CR_LOCK), EQ(CR_LOCK), EQ(cr0)
    220236
    221237        .endm
Note: See TracChangeset for help on using the changeset viewer.