Changeset e762b43 in mainline for kernel/arch/arm32/include/atomic.h
- Timestamp:
- 2009-03-03T16:12:43Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 02fd705
- Parents:
- f24d300
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/arm32/include/atomic.h
rf24d300 re762b43 27 27 */ 28 28 29 /** @addtogroup arm32 29 /** @addtogroup arm32 30 30 * @{ 31 31 */ 32 /** @file 32 /** @file 33 33 * @brief Atomic operations. 34 34 */ … … 43 43 * 44 44 * @return Value after addition. 45 * 45 46 */ 46 47 static inline long atomic_add(atomic_t *val, int i) … … 48 49 int ret; 49 50 volatile long *mem = &(val->count); 50 51 51 52 asm volatile ( 52 "1:\n" 53 "ldr r2, [%1] \n" 54 "add r3, r2, %2 \n" 55 "str r3, %0 \n" 56 "swp r3, r3, [%1] \n" 57 "cmp r3, r2 \n" 58 "bne 1b \n" 59 60 : "=m" (ret) 61 : "r" (mem), "r" (i) 53 "1:\n" 54 "ldr r2, [%[mem]]\n" 55 "add r3, r2, %[i]\n" 56 "str r3, %[ret]\n" 57 "swp r3, r3, [%[mem]]\n" 58 "cmp r3, r2\n" 59 "bne 1b\n" 60 : [ret] "=m" (ret) 61 : [mem] "r" (mem), [i] "r" (i) 62 62 : "r3", "r2" 63 63 ); 64 64 65 65 return ret; 66 66 }
Note:
See TracChangeset
for help on using the changeset viewer.