Changeset 04803bf in mainline for uspace/lib/c/arch/ppc32/include/atomic.h
- Timestamp:
- 2011-03-21T22:00:17Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 143932e3
- Parents:
- b50b5af2 (diff), 7308e84 (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 moved
-
uspace/lib/c/arch/ppc32/include/atomic.h (moved) (moved from uspace/lib/libc/arch/ppc32/include/atomic.h ) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/arch/ppc32/include/atomic.h
rb50b5af2 r04803bf 27 27 */ 28 28 29 /** @addtogroup libcppc32 29 /** @addtogroup libcppc32 30 30 * @{ 31 31 */ … … 36 36 #define LIBC_ppc32_ATOMIC_H_ 37 37 38 #define LIBC_ARCH_ATOMIC_H_ 39 40 #include <atomicdflt.h> 41 38 42 static inline void atomic_inc(atomic_t *val) 39 43 { 40 longtmp;41 44 atomic_count_t tmp; 45 42 46 asm volatile ( 43 47 "1:\n" … … 46 50 "stwcx. %0, 0, %2\n" 47 51 "bne- 1b" 48 : "=&r" (tmp), "=m" (val->count) 49 : "r" (&val->count), "m" (val->count) 50 : "cc"); 52 : "=&r" (tmp), 53 "=m" (val->count) 54 : "r" (&val->count), 55 "m" (val->count) 56 : "cc" 57 ); 51 58 } 52 59 53 60 static inline void atomic_dec(atomic_t *val) 54 61 { 55 longtmp;56 62 atomic_count_t tmp; 63 57 64 asm volatile ( 58 65 "1:\n" 59 66 "lwarx %0, 0, %2\n" 60 67 "addic %0, %0, -1\n" 61 "stwcx. %0, 0, %2\n"68 "stwcx. %0, 0, %2\n" 62 69 "bne- 1b" 63 : "=&r" (tmp), "=m" (val->count) 64 : "r" (&val->count), "m" (val->count) 65 : "cc"); 70 : "=&r" (tmp), 71 "=m" (val->count) 72 : "r" (&val->count), 73 "m" (val->count) 74 : "cc" 75 ); 66 76 } 67 77 68 static inline longatomic_postinc(atomic_t *val)78 static inline atomic_count_t atomic_postinc(atomic_t *val) 69 79 { 70 80 atomic_inc(val); … … 72 82 } 73 83 74 static inline longatomic_postdec(atomic_t *val)84 static inline atomic_count_t atomic_postdec(atomic_t *val) 75 85 { 76 86 atomic_dec(val); … … 78 88 } 79 89 80 static inline longatomic_preinc(atomic_t *val)90 static inline atomic_count_t atomic_preinc(atomic_t *val) 81 91 { 82 92 atomic_inc(val); … … 84 94 } 85 95 86 static inline longatomic_predec(atomic_t *val)96 static inline atomic_count_t atomic_predec(atomic_t *val) 87 97 { 88 98 atomic_dec(val);
Note:
See TracChangeset
for help on using the changeset viewer.
