summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/smplock.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-09 07:29:52 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-12 13:20:34 +0200
commit3e0bb6734af1296e21af2716ebd12b8cbb718c29 (patch)
tree9d15d3bb698233e22aeea055b93ae76710454219 /cpukit/score/src/smplock.c
parentscore: Add _ISR_lock_Is_owner() (diff)
downloadrtems-3e0bb6734af1296e21af2716ebd12b8cbb718c29.tar.bz2
score: Ensure matching lock acquire and release
Ensure matching lock acquire and release for SMP locks if RTEMS_DEBUG is defined.
Diffstat (limited to 'cpukit/score/src/smplock.c')
-rw-r--r--cpukit/score/src/smplock.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/cpukit/score/src/smplock.c b/cpukit/score/src/smplock.c
index 35b1930a1a..e426c2afbe 100644
--- a/cpukit/score/src/smplock.c
+++ b/cpukit/score/src/smplock.c
@@ -40,6 +40,9 @@ void _SMP_lock_Acquire(
SMP_lock_Context *context
)
{
+#if defined(RTEMS_DEBUG)
+ context->lock_used_for_acquire = lock;
+#endif
_SMP_lock_Acquire_body( lock, context );
#if defined(RTEMS_DEBUG)
lock->owner = _SMP_Get_current_processor();
@@ -52,6 +55,8 @@ void _SMP_lock_Release(
)
{
#if defined(RTEMS_DEBUG)
+ _Assert( context->lock_used_for_acquire == lock );
+ context->lock_used_for_acquire = NULL;
_Assert( lock->owner == _SMP_Get_current_processor() );
lock->owner = SMP_LOCK_NO_OWNER;
#endif
@@ -63,6 +68,9 @@ void _SMP_lock_ISR_disable_and_acquire(
SMP_lock_Context *context
)
{
+#if defined(RTEMS_DEBUG)
+ context->lock_used_for_acquire = lock;
+#endif
_SMP_lock_ISR_disable_and_acquire_body( lock, context );
#if defined(RTEMS_DEBUG)
lock->owner = _SMP_Get_current_processor();
@@ -75,10 +83,13 @@ void _SMP_lock_Release_and_ISR_enable(
)
{
#if defined(RTEMS_DEBUG)
+ _Assert( context->lock_used_for_acquire == lock );
+ context->lock_used_for_acquire = NULL;
_Assert( lock->owner == _SMP_Get_current_processor() );
lock->owner = SMP_LOCK_NO_OWNER;
#endif
- _SMP_lock_Release_and_ISR_enable_body( lock, context );
+ _SMP_lock_Release_body( lock, context );
+ _ISR_Enable_without_giant( context->isr_level );
}
#if defined(RTEMS_DEBUG)