[rtems commit] score: Delete _Assert_Owner_of_giant()

Sebastian Huber sebh at rtems.org
Wed Mar 19 07:31:15 UTC 2014


Module:    rtems
Branch:    master
Commit:    a3dd225b88eaadc2832cdb65ee9287f8aceea095
Changeset: http://git.rtems.org/rtems/commit/?id=a3dd225b88eaadc2832cdb65ee9287f8aceea095

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Mar 18 11:56:42 2014 +0100

score: Delete _Assert_Owner_of_giant()

Add _Debug_Is_owner_of_giant().  This makes it possible to assert the
opposite.

---

 cpukit/score/include/rtems/score/assert.h     |   12 +++++++-----
 cpukit/score/include/rtems/score/isrlevel.h   |    6 +++---
 cpukit/score/src/threaddispatchdisablelevel.c |    8 +++-----
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/cpukit/score/include/rtems/score/assert.h b/cpukit/score/include/rtems/score/assert.h
index 0248b3c..707222b 100644
--- a/cpukit/score/include/rtems/score/assert.h
+++ b/cpukit/score/include/rtems/score/assert.h
@@ -49,12 +49,14 @@ extern "C" {
 #endif
 
 /**
- * @brief Asserts that current thread of execution owns the giant lock.
+ * @brief Returns true if the current thread of execution owns the giant lock.
  */
-#if defined( RTEMS_DEBUG ) && defined( RTEMS_SMP )
-  void _Assert_Owner_of_giant( void );
-#else
-  #define _Assert_Owner_of_giant() ( ( void ) 0 )
+#if defined( RTEMS_DEBUG )
+  #if defined( RTEMS_SMP )
+    bool _Debug_Is_owner_of_giant( void );
+  #else
+    #define _Debug_Is_owner_of_giant() (true)
+  #endif
 #endif
 
 #ifdef __cplusplus
diff --git a/cpukit/score/include/rtems/score/isrlevel.h b/cpukit/score/include/rtems/score/isrlevel.h
index 94d1e91..a7a9b2e 100644
--- a/cpukit/score/include/rtems/score/isrlevel.h
+++ b/cpukit/score/include/rtems/score/isrlevel.h
@@ -58,7 +58,7 @@ typedef uint32_t   ISR_Level;
 #define _ISR_Disable( _level ) \
   do { \
     _CPU_ISR_Disable( _level ); \
-    _Assert_Owner_of_giant(); \
+    _Assert( _Debug_Is_owner_of_giant() ); \
     RTEMS_COMPILER_MEMORY_BARRIER(); \
   } while (0)
 
@@ -76,7 +76,7 @@ typedef uint32_t   ISR_Level;
 #define _ISR_Enable( _level ) \
   do { \
     RTEMS_COMPILER_MEMORY_BARRIER(); \
-    _Assert_Owner_of_giant(); \
+    _Assert( _Debug_Is_owner_of_giant() ); \
     _CPU_ISR_Enable( _level ); \
   } while (0)
 
@@ -102,7 +102,7 @@ typedef uint32_t   ISR_Level;
 #define _ISR_Flash( _level ) \
   do { \
     RTEMS_COMPILER_MEMORY_BARRIER(); \
-    _Assert_Owner_of_giant(); \
+    _Assert( _Debug_Is_owner_of_giant() ); \
     _CPU_ISR_Flash( _level ); \
     RTEMS_COMPILER_MEMORY_BARRIER(); \
   } while (0)
diff --git a/cpukit/score/src/threaddispatchdisablelevel.c b/cpukit/score/src/threaddispatchdisablelevel.c
index abd8c97..68b4d76 100644
--- a/cpukit/score/src/threaddispatchdisablelevel.c
+++ b/cpukit/score/src/threaddispatchdisablelevel.c
@@ -142,13 +142,11 @@ void _Giant_Release( void )
 }
 
 #if defined( RTEMS_DEBUG )
-void _Assert_Owner_of_giant( void )
+bool _Debug_Is_owner_of_giant( void )
 {
   Giant_Control *giant = &_Giant;
 
-  _Assert(
-    giant->owner_cpu == _SMP_Get_current_processor()
-      || !_System_state_Is_up( _System_state_Get() )
-  );
+  return giant->owner_cpu == _SMP_Get_current_processor()
+    || !_System_state_Is_up( _System_state_Get() );
 }
 #endif




More information about the vc mailing list