_sparc_atomic.h

00001 
00002 // Currently, SUN CC requires object file
00003 
00004 #if defined (__GNUC__) && !defined (__SYMBIAN32__)
00005 
00006 /*
00007 **  int _STLP_atomic_exchange (__stl_atomic_t *pvalue, __stl_atomic_t value)
00008 */
00009  
00010 # ifdef __sparc_v9__
00011 
00012 #  ifdef __arch64__
00013 
00014 #   define _STLP_EXCH_ASM  asm volatile ("casx [%3], %4, %0 ;  membar  #LoadLoad | #LoadStore " : \
00015                    "=r" (_L_value2), "=m" (*_L_pvalue1) : \
00016                    "m" (*_L_pvalue1), "r" (_L_pvalue1), "r" (_L_value1), "0" (_L_value2) )
00017 
00018 #  else /* __arch64__ */
00019 
00020 #   define _STLP_EXCH_ASM  asm volatile ("cas [%3], %4, %0" : \
00021                    "=r" (_L_value2), "=m" (*_L_pvalue1) : \
00022                    "m" (*_L_pvalue1), "r" (_L_pvalue1), "r" (_L_value1), "0" (_L_value2) )
00023 #  endif
00024 
00025 # else /* __sparc_v9__ */
00026 
00027 #  define _STLP_EXCH_ASM asm volatile ("swap [%3], %0 " : \
00028                                        "=r" (_L_value2), "=m" (*_L_pvalue1) : \
00029                                        "m" (*_L_pvalue1), "r" (_L_pvalue1),  "0" (_L_value2) )
00030 # endif
00031 
00032 
00033 #  define _STLP_ATOMIC_EXCHANGE(__pvalue1, __value2) \
00034  ({  register volatile __stl_atomic_t *_L_pvalue1 = __pvalue1; \
00035      register __stl_atomic_t _L_value1, _L_value2 =  __value2 ; \
00036      do { _L_value1 = *_L_pvalue1; _STLP_EXCH_ASM; } while ( _L_value1 != _L_value2 ) ; \
00037      _L_value1; })
00038 
00039 #  define _STLP_ATOMIC_INCREMENT(__pvalue1) \
00040  {  register volatile __stl_atomic_t *_L_pvalue1 = __pvalue1; \
00041     register __stl_atomic_t _L_value1, _L_value2; \
00042     do { _L_value1 = *_L_pvalue1;  _L_value2 = _L_value1+1; _STLP_EXCH_ASM; } while ( _L_value1 != _L_value2 ) ; }
00043 
00044 #  define _STLP_ATOMIC_DECREMENT(__pvalue1) \
00045  {  register volatile __stl_atomic_t *_L_pvalue1 = __pvalue1; \
00046     register __stl_atomic_t _L_value1, _L_value2; \
00047     do { _L_value1 = *_L_pvalue1;  _L_value2 = _L_value1-1; _STLP_EXCH_ASM; } while ( _L_value1 != _L_value2 ) ; }
00048 
00049 # elif ! defined (_STLP_NO_EXTERN_INLINE) 
00050 
00051 extern "C" __stl_atomic_t _STLP_atomic_exchange(__stl_atomic_t * __x, __stl_atomic_t __v);
00052 extern "C" void _STLP_atomic_decrement(__stl_atomic_t* i);
00053 extern "C" void _STLP_atomic_increment(__stl_atomic_t* i);
00054 
00055 #  define _STLP_ATOMIC_INCREMENT(__x)           _STLP_atomic_increment((__stl_atomic_t*)__x)
00056 #  define _STLP_ATOMIC_DECREMENT(__x)           _STLP_atomic_decrement((__stl_atomic_t*)__x)
00057 #  define _STLP_ATOMIC_EXCHANGE(__x, __y)       _STLP_atomic_exchange((__stl_atomic_t*)__x, (__stl_atomic_t)__y)
00058 
00059 # endif
00060 

Generated on Mon Jun 5 10:20:47 2006 for Intelligence.kdevelop by  doxygen 1.4.6