Changes in kernel/arch/mips32/include/atomic.h [7a0359b:88d653c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/mips32/include/atomic.h
r7a0359b r88d653c 27 27 */ 28 28 29 /** @addtogroup mips32 29 /** @addtogroup mips32 30 30 * @{ 31 31 */ … … 35 35 #ifndef KERN_mips32_ATOMIC_H_ 36 36 #define KERN_mips32_ATOMIC_H_ 37 38 #include <trace.h>39 37 40 38 #define atomic_inc(x) ((void) atomic_add(x, 1)) … … 53 51 * 54 52 * @return Value after addition. 55 *56 53 */ 57 NO_TRACE static inline atomic_count_t atomic_add(atomic_t *val, 58 atomic_count_t i) 54 static inline long atomic_add(atomic_t *val, int i) 59 55 { 60 atomic_count_t tmp; 61 atomic_count_t v; 56 long tmp, v; 62 57 63 58 asm volatile ( … … 69 64 " beq %0, %4, 1b\n" /* if the atomic operation failed, try again */ 70 65 " nop\n" 71 : "=&r" (tmp), 72 "+m" (val->count), 73 "=&r" (v) 74 : "r" (i), 75 "i" (0) 66 : "=&r" (tmp), "+m" (val->count), "=&r" (v) 67 : "r" (i), "i" (0) 76 68 ); 77 69 … … 79 71 } 80 72 81 NO_TRACE static inline atomic_count_t test_and_set(atomic_t *val) 82 { 83 atomic_count_t tmp; 84 atomic_count_t v; 73 static inline uint32_t test_and_set(atomic_t *val) { 74 uint32_t tmp, v; 85 75 86 76 asm volatile ( … … 92 82 " beqz %0, 1b\n" 93 83 "2:\n" 94 : "=&r" (tmp), 95 "+m" (val->count), 96 "=&r" (v) 84 : "=&r" (tmp), "+m" (val->count), "=&r" (v) 97 85 : "i" (1) 98 86 ); … … 101 89 } 102 90 103 NO_TRACE static inline void atomic_lock_arch(atomic_t *val) 104 { 91 static inline void atomic_lock_arch(atomic_t *val) { 105 92 do { 106 while (val->count); 93 while (val->count) 94 ; 107 95 } while (test_and_set(val)); 108 96 }
Note:
See TracChangeset
for help on using the changeset viewer.