Changeset 7919f70 in rtems


Ignore:
Timestamp:
Jun 9, 2015, 12:52:53 PM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
2ccd150d
Parents:
30f8412
git-author:
Sebastian Huber <sebastian.huber@…> (06/09/15 12:52:53)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/09/15 12:56:02)
Message:

score: Fix compiler memory barriers for atomic ops

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/include/rtems/score/cpustdatomic.h

    r30f8412 r7919f70  
    186186  return atomic_load_explicit( obj, order );
    187187#else
    188   (void) order;
     188  unsigned int val;
     189
     190  (void) order;
     191  val = *obj;
    189192  RTEMS_COMPILER_MEMORY_BARRIER();
    190   return *obj;
     193
     194  return val;
    191195#endif
    192196}
     
    199203  return atomic_load_explicit( obj, order );
    200204#else
    201   (void) order;
     205  unsigned long val;
     206
     207  (void) order;
     208  val = *obj;
    202209  RTEMS_COMPILER_MEMORY_BARRIER();
    203   return *obj;
     210
     211  return val;
    204212#endif
    205213}
     
    212220  return (void *) atomic_load_explicit( obj, order );
    213221#else
    214   (void) order;
     222  uintptr_t val;
     223
     224  (void) order;
     225  val = *obj;
    215226  RTEMS_COMPILER_MEMORY_BARRIER();
    216   return (void *) *obj;
     227
     228  return (void *) val;
    217229#endif
    218230}
     
    226238#else
    227239  (void) order;
     240  RTEMS_COMPILER_MEMORY_BARRIER();
    228241  *obj = desired;
     242#endif
     243}
     244
     245static inline void _CPU_atomic_Store_ulong( CPU_atomic_Ulong *obj, unsigned long desired, CPU_atomic_Order order )
     246{
     247#if defined(_RTEMS_SCORE_CPUSTDATOMIC_USE_ATOMIC)
     248  obj->store( desired );
     249#elif defined(_RTEMS_SCORE_CPUSTDATOMIC_USE_STDATOMIC)
     250  atomic_store_explicit( obj, desired, order );
     251#else
     252  (void) order;
    229253  RTEMS_COMPILER_MEMORY_BARRIER();
    230 #endif
    231 }
    232 
    233 static inline void _CPU_atomic_Store_ulong( CPU_atomic_Ulong *obj, unsigned long desired, CPU_atomic_Order order )
    234 {
    235 #if defined(_RTEMS_SCORE_CPUSTDATOMIC_USE_ATOMIC)
    236   obj->store( desired );
    237 #elif defined(_RTEMS_SCORE_CPUSTDATOMIC_USE_STDATOMIC)
    238   atomic_store_explicit( obj, desired, order );
    239 #else
    240   (void) order;
    241254  *obj = desired;
     255#endif
     256}
     257
     258static inline void _CPU_atomic_Store_ptr( CPU_atomic_Pointer *obj, void *desired, CPU_atomic_Order order )
     259{
     260#if defined(_RTEMS_SCORE_CPUSTDATOMIC_USE_ATOMIC)
     261  obj->store( (uintptr_t) desired );
     262#elif defined(_RTEMS_SCORE_CPUSTDATOMIC_USE_STDATOMIC)
     263  atomic_store_explicit( obj, (uintptr_t) desired, order );
     264#else
     265  (void) order;
    242266  RTEMS_COMPILER_MEMORY_BARRIER();
    243 #endif
    244 }
    245 
    246 static inline void _CPU_atomic_Store_ptr( CPU_atomic_Pointer *obj, void *desired, CPU_atomic_Order order )
    247 {
    248 #if defined(_RTEMS_SCORE_CPUSTDATOMIC_USE_ATOMIC)
    249   obj->store( (uintptr_t) desired );
    250 #elif defined(_RTEMS_SCORE_CPUSTDATOMIC_USE_STDATOMIC)
    251   atomic_store_explicit( obj, (uintptr_t) desired, order );
    252 #else
    253   (void) order;
    254267  *obj = (uintptr_t) desired;
    255   RTEMS_COMPILER_MEMORY_BARRIER();
    256268#endif
    257269}
Note: See TracChangeset for help on using the changeset viewer.