Changeset 41310c02 in rtems


Ignore:
Timestamp:
01/18/19 12:16:29 (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, master
Children:
926ed2b0
Parents:
b5bdecf
git-author:
Sebastian Huber <sebastian.huber@…> (01/18/19 12:16:29)
git-committer:
Sebastian Huber <sebastian.huber@…> (01/18/19 12:33:18)
Message:

score: Improve debug support for ISR locks

Ensure that interrupts are disabled while acquiring an ISR lock.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpukit/include/rtems/rtems/intr.h

    rb5bdecf r41310c02  
    343343 * @see rtems_interrupt_lock_release_isr().
    344344 */
    345 #define rtems_interrupt_lock_acquire_isr( _lock, _lock_context ) \
    346   _ISR_lock_Acquire( _lock, _lock_context )
     345#if defined(RTEMS_SMP)
     346  #define rtems_interrupt_lock_acquire_isr( _lock, _lock_context ) \
     347    _SMP_lock_Acquire( \
     348      &( _lock )->Lock, \
     349      &( _lock_context )->Lock_context \
     350    )
     351#else
     352  #define rtems_interrupt_lock_acquire_isr( _lock, _lock_context ) \
     353    do { (void) _lock_context; } while ( 0 )
     354#endif
    347355
    348356/**
     
    359367 * @see rtems_interrupt_lock_acquire_isr().
    360368 */
    361 #define rtems_interrupt_lock_release_isr( _lock, _lock_context ) \
    362   _ISR_lock_Release( _lock, _lock_context )
     369#if defined(RTEMS_SMP)
     370  #define rtems_interrupt_lock_release_isr( _lock, _lock_context ) \
     371    _SMP_lock_Release( \
     372      &( _lock )->Lock, \
     373      &( _lock_context )->Lock_context \
     374    )
     375#else
     376  #define rtems_interrupt_lock_release_isr( _lock, _lock_context ) \
     377    do { (void) _lock_context; } while ( 0 )
     378#endif
    363379
    364380/** @} */
  • cpukit/include/rtems/score/isrlock.h

    rb5bdecf r41310c02  
    88
    99/*
    10  * Copyright (c) 2013-2015 embedded brains GmbH.  All rights reserved.
     10 * Copyright (c) 2013, 2019 embedded brains GmbH.  All rights reserved.
    1111 *
    1212 *  embedded brains GmbH
     
    268268#if defined( RTEMS_SMP )
    269269  #define _ISR_lock_Acquire( _lock, _context ) \
    270     _SMP_lock_Acquire( \
    271       &( _lock )->Lock, \
    272       &( _context )->Lock_context \
    273     )
     270    do { \
     271      _Assert( _ISR_Get_level() != 0 ); \
     272      _SMP_lock_Acquire( \
     273        &( _lock )->Lock, \
     274        &( _context )->Lock_context \
     275      ); \
     276    } while ( 0 )
    274277#else
    275278  #define _ISR_lock_Acquire( _lock, _context ) \
    276     (void) _context;
     279    do { (void) _context; } while ( 0 )
    277280#endif
    278281
     
    297300#else
    298301  #define _ISR_lock_Release( _lock, _context ) \
    299     (void) _context;
     302    do { (void) _context; } while ( 0 )
    300303#endif
    301304
     
    307310#if defined( RTEMS_SMP )
    308311  #define _ISR_lock_Acquire_inline( _lock, _context ) \
    309     _SMP_lock_Acquire_inline( \
    310       &( _lock )->Lock, \
    311       &( _context )->Lock_context \
    312     )
     312    do { \
     313      _Assert( _ISR_Get_level() != 0 ); \
     314      _SMP_lock_Acquire_inline( \
     315        &( _lock )->Lock, \
     316        &( _context )->Lock_context \
     317      ); \
     318    } while ( 0 )
    313319#else
    314320  #define _ISR_lock_Acquire_inline( _lock, _context ) \
    315     (void) _context;
     321    do { (void) _context; } while ( 0 )
    316322#endif
    317323
     
    329335#else
    330336  #define _ISR_lock_Release_inline( _lock, _context ) \
    331     (void) _context;
     337    do { (void) _context; } while ( 0 )
    332338#endif
    333339
  • testsuites/sptests/sp37/init.c

    rb5bdecf r41310c02  
    179179  size_t i;
    180180  const uint8_t *initialized_bytes;
     181  ISR_Level interrupt_level;
    181182
    182183  memset( &container, 0xff, sizeof( container ) );
     
    204205  rtems_test_assert( normal_interrupt_level == _ISR_Get_level() );
    205206
     207#if defined(RTEMS_DEBUG)
     208  _ISR_lock_ISR_disable( &lock_context );
     209#endif
     210  interrupt_level = _ISR_Get_level();
    206211  _ISR_lock_Acquire( &container.lock, &lock_context );
     212  rtems_test_assert( interrupt_level == _ISR_Get_level() );
     213#if !defined(RTEMS_DEBUG)
    207214  rtems_test_assert( normal_interrupt_level == _ISR_Get_level() );
     215#endif
    208216  _ISR_lock_Release( &container.lock, &lock_context );
     217  rtems_test_assert( interrupt_level == _ISR_Get_level() );
     218#if defined(RTEMS_DEBUG)
     219  _ISR_lock_ISR_enable( &lock_context );
     220#endif
    209221
    210222  rtems_test_assert( normal_interrupt_level == _ISR_Get_level() );
Note: See TracChangeset for help on using the changeset viewer.