From 3c50a488e91f718fa245eb0ebe1e2d87f374b9d0 Mon Sep 17 00:00:00 2001 From: Jennifer Averett Date: Tue, 2 Aug 2011 13:59:48 +0000 Subject: [PATCH] 2011-08-02 Jennifer Averett * score/include/rtems/score/coremutex.h: Move check dispatch for seize into its own macro and add smp support. --- cpukit/ChangeLog | 5 ++++ cpukit/score/include/rtems/score/coremutex.h | 27 +++++++++++++++----- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index c961412d5b..ee98705571 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,8 @@ +2011-08-02 Jennifer Averett + + * score/include/rtems/score/coremutex.h: Move check dispatch for seize + into its own macro and add smp support. + 2011-08-02 Jennifer.Averett PR 1872 diff --git a/cpukit/score/include/rtems/score/coremutex.h b/cpukit/score/include/rtems/score/coremutex.h index 82e078cc6c..30bc33cf65 100644 --- a/cpukit/score/include/rtems/score/coremutex.h +++ b/cpukit/score/include/rtems/score/coremutex.h @@ -8,7 +8,7 @@ */ /* - * COPYRIGHT (c) 1989-2009. + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -339,6 +339,25 @@ void _CORE_mutex_Seize_interrupt_blocking( Watchdog_Interval timeout ); + +/** + * @brief Sieze Interrupt Wrapper + * + * This macro is to verify that a mutex blocking seize is + * performed from a safe system state. For example, one + * cannot block inside an isr. + * + * @return this method returns true if dispatch is in an unsafe state. + */ +#ifdef RTEMS_SMP + #define _CORE_mutex_Check_dispatch_for_seize(_wait) 0 +#else + #define _CORE_mutex_Check_dispatch_for_seize(_wait) \ + (_Thread_Dispatch_in_critical_section() \ + && (_wait) \ + && (_System_state_Get() >= SYSTEM_STATE_BEGIN_MULTITASKING)) +#endif + /** * @brief Sieze Interrupt Wrapper * @@ -366,14 +385,10 @@ void _CORE_mutex_Seize_interrupt_blocking( * * If the caller is willing to wait * then they are blocked. */ - #define _CORE_mutex_Seize_body( \ _the_mutex, _id, _wait, _timeout, _level ) \ do { \ - if ( _Thread_Dispatch_in_critical_section() \ - && (_wait) \ - && (_System_state_Get() >= SYSTEM_STATE_BEGIN_MULTITASKING ) \ - ) { \ + if ( _CORE_mutex_Check_dispatch_for_seize(_wait) ) { \ _Internal_error_Occurred( \ INTERNAL_ERROR_CORE, \ false, \