diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-01-11 13:41:55 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-01-11 13:52:08 +0100 |
commit | 3d35bc00d8483a748c819012c860550271c37b9a (patch) | |
tree | c202f5b62d78440c3e3b00cddffbda75da966599 /cpukit/score/include/rtems/score/smplock.h | |
parent | score: Optimize thread state values (diff) | |
download | rtems-3d35bc00d8483a748c819012c860550271c37b9a.tar.bz2 |
score: Improve SMP lock debug support
The CPU index starts with zero. Increment it by one, to allow global
SMP locks to reside in the BSS section.
Diffstat (limited to 'cpukit/score/include/rtems/score/smplock.h')
-rw-r--r-- | cpukit/score/include/rtems/score/smplock.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/cpukit/score/include/rtems/score/smplock.h b/cpukit/score/include/rtems/score/smplock.h index 28022041ed..a156edfd92 100644 --- a/cpukit/score/include/rtems/score/smplock.h +++ b/cpukit/score/include/rtems/score/smplock.h @@ -98,7 +98,7 @@ typedef struct { } SMP_lock_Context; #if defined(RTEMS_DEBUG) -#define SMP_LOCK_NO_OWNER 0xffffffff +#define SMP_LOCK_NO_OWNER 0 #endif /** @@ -176,6 +176,17 @@ void _SMP_lock_Destroy( SMP_lock_Control *lock ); _SMP_lock_Destroy_inline( lock ) #endif +#if defined(RTEMS_DEBUG) +static inline uint32_t _SMP_lock_Who_am_I( void ) +{ + /* + * The CPU index starts with zero. Increment it by one, to allow global SMP + * locks to reside in the BSS section. + */ + return _SMP_Get_current_processor() + 1; +} +#endif + static inline void _SMP_lock_Acquire_inline( SMP_lock_Control *lock, SMP_lock_Context *context @@ -192,7 +203,7 @@ static inline void _SMP_lock_Acquire_inline( &context->Stats_context ); #if defined(RTEMS_DEBUG) - lock->owner = _SMP_Get_current_processor(); + lock->owner = _SMP_lock_Who_am_I(); #endif } @@ -220,7 +231,7 @@ static inline void _SMP_lock_Release_inline( #if defined(RTEMS_DEBUG) _Assert( context->lock_used_for_acquire == lock ); context->lock_used_for_acquire = NULL; - _Assert( lock->owner == _SMP_Get_current_processor() ); + _Assert( lock->owner == _SMP_lock_Who_am_I() ); lock->owner = SMP_LOCK_NO_OWNER; #else (void) context; |