Changeset aa85487 in mainline for uspace/lib/libc/arch/ppc32/include/atomic.h
- Timestamp:
- 2010-03-07T15:11:56Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- aadf01e
- Parents:
- 2e99277 (diff), 137691a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/arch/ppc32/include/atomic.h
r2e99277 raa85487 27 27 */ 28 28 29 /** @addtogroup libcppc32 29 /** @addtogroup libcppc32 30 30 * @{ 31 31 */ … … 42 42 static inline void atomic_inc(atomic_t *val) 43 43 { 44 longtmp;45 44 atomic_count_t tmp; 45 46 46 asm volatile ( 47 47 "1:\n" … … 50 50 "stwcx. %0, 0, %2\n" 51 51 "bne- 1b" 52 : "=&r" (tmp), "=m" (val->count) 53 : "r" (&val->count), "m" (val->count) 54 : "cc"); 52 : "=&r" (tmp), 53 "=m" (val->count) 54 : "r" (&val->count), 55 "m" (val->count) 56 : "cc" 57 ); 55 58 } 56 59 57 60 static inline void atomic_dec(atomic_t *val) 58 61 { 59 longtmp;60 62 atomic_count_t tmp; 63 61 64 asm volatile ( 62 65 "1:\n" 63 66 "lwarx %0, 0, %2\n" 64 67 "addic %0, %0, -1\n" 65 "stwcx. 68 "stwcx. %0, 0, %2\n" 66 69 "bne- 1b" 67 : "=&r" (tmp), "=m" (val->count) 68 : "r" (&val->count), "m" (val->count) 69 : "cc"); 70 : "=&r" (tmp), 71 "=m" (val->count) 72 : "r" (&val->count), 73 "m" (val->count) 74 : "cc" 75 ); 70 76 } 71 77 72 static inline longatomic_postinc(atomic_t *val)78 static inline atomic_count_t atomic_postinc(atomic_t *val) 73 79 { 74 80 atomic_inc(val); … … 76 82 } 77 83 78 static inline longatomic_postdec(atomic_t *val)84 static inline atomic_count_t atomic_postdec(atomic_t *val) 79 85 { 80 86 atomic_dec(val); … … 82 88 } 83 89 84 static inline longatomic_preinc(atomic_t *val)90 static inline atomic_count_t atomic_preinc(atomic_t *val) 85 91 { 86 92 atomic_inc(val); … … 88 94 } 89 95 90 static inline longatomic_predec(atomic_t *val)96 static inline atomic_count_t atomic_predec(atomic_t *val) 91 97 { 92 98 atomic_dec(val);
Note:
See TracChangeset
for help on using the changeset viewer.