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