From f0ad529d28688214568532c0d30eb13654db1462 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 7 Mar 2006 20:47:53 +0000 Subject: 2006-03-07 Joel Sherrill PR 866/rtems * score/include/rtems/system.h, score/include/rtems/score/isr.h, score/inline/rtems/score/thread.inl, score/macros/rtems/score/thread.inl: Added memory barriers to enter and exit of dispatching and interrupt critical sections so GCC will not optimize and reorder code out of a critical section. --- cpukit/score/macros/rtems/score/thread.inl | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'cpukit/score/macros/rtems/score') diff --git a/cpukit/score/macros/rtems/score/thread.inl b/cpukit/score/macros/rtems/score/thread.inl index b5b94799c8..3ace7af4e2 100644 --- a/cpukit/score/macros/rtems/score/thread.inl +++ b/cpukit/score/macros/rtems/score/thread.inl @@ -126,7 +126,10 @@ */ #define _Thread_Disable_dispatch() \ - _Thread_Dispatch_disable_level += 1 + do { \ + _Thread_Dispatch_disable_level += 1; \ + RTEMS_COMPILER_MEMORY_BARRIER(); \ + } while (0) /*PAGE * @@ -136,9 +139,11 @@ #if ( CPU_INLINE_ENABLE_DISPATCH == TRUE ) #define _Thread_Enable_dispatch() \ - { if ( (--_Thread_Dispatch_disable_level) == 0 ) \ - _Thread_Dispatch(); \ - } + do { \ + RTEMS_COMPILER_MEMORY_BARRIER(); \ + if ( (--_Thread_Dispatch_disable_level) == 0 ) \ + _Thread_Dispatch(); \ + } while (0) #endif #if ( CPU_INLINE_ENABLE_DISPATCH == FALSE ) @@ -152,7 +157,10 @@ void _Thread_Enable_dispatch( void ); */ #define _Thread_Unnest_dispatch() \ - _Thread_Dispatch_disable_level -= 1 + do { \ + RTEMS_COMPILER_MEMORY_BARRIER(); \ + _Thread_Dispatch_disable_level -= 1; \ + } while (0) /*PAGE * -- cgit v1.2.3