Changes in uspace/lib/libc/arch/arm32/include/atomic.h [cd769305:228666c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/arch/arm32/include/atomic.h
rcd769305 r228666c 27 27 */ 28 28 29 /** @addtogroup libcarm32 29 /** @addtogroup libcarm32 30 30 * @{ 31 31 */ … … 38 38 39 39 #define LIBC_ARCH_ATOMIC_H_ 40 #define CAS 40 #define CAS 41 41 42 42 #include <atomicdflt.h> … … 46 46 extern uintptr_t *ras_page; 47 47 48 static inline bool cas(atomic_t *val, long ov, longnv)49 { 50 longret = 0;51 48 static inline bool cas(atomic_t *val, atomic_count_t ov, atomic_count_t nv) 49 { 50 atomic_count_t ret = 0; 51 52 52 /* 53 53 * The following instructions between labels 1 and 2 constitute a … … 75 75 : "memory" 76 76 ); 77 77 78 78 ras_page[0] = 0; 79 asm volatile ("" ::: "memory"); 79 asm volatile ( 80 "" ::: "memory" 81 ); 80 82 ras_page[1] = 0xffffffff; 81 83 82 84 return (bool) ret; 83 85 } … … 89 91 * 90 92 * @return Value after addition. 91 */ 92 static inline long atomic_add(atomic_t *val, int i) 93 { 94 long ret = 0; 95 93 * 94 */ 95 static inline atomic_count_t atomic_add(atomic_t *val, atomic_count_t i) 96 { 97 atomic_count_t ret = 0; 98 96 99 /* 97 100 * The following instructions between labels 1 and 2 constitute a … … 115 118 : [imm] "r" (i) 116 119 ); 117 120 118 121 ras_page[0] = 0; 119 asm volatile ("" ::: "memory"); 122 asm volatile ( 123 "" ::: "memory" 124 ); 120 125 ras_page[1] = 0xffffffff; 121 126 122 127 return ret; 123 128 } … … 127 132 * 128 133 * @param val Variable to be incremented. 134 * 129 135 */ 130 136 static inline void atomic_inc(atomic_t *val) … … 137 143 * 138 144 * @param val Variable to be decremented. 145 * 139 146 */ 140 147 static inline void atomic_dec(atomic_t *val) … … 148 155 * @param val Variable to be incremented. 149 156 * @return Value after incrementation. 150 */ 151 static inline long atomic_preinc(atomic_t *val) 157 * 158 */ 159 static inline atomic_count_t atomic_preinc(atomic_t *val) 152 160 { 153 161 return atomic_add(val, 1); … … 159 167 * @param val Variable to be decremented. 160 168 * @return Value after decrementation. 161 */ 162 static inline long atomic_predec(atomic_t *val) 169 * 170 */ 171 static inline atomic_count_t atomic_predec(atomic_t *val) 163 172 { 164 173 return atomic_add(val, -1); … … 170 179 * @param val Variable to be incremented. 171 180 * @return Value before incrementation. 172 */ 173 static inline long atomic_postinc(atomic_t *val) 181 * 182 */ 183 static inline atomic_count_t atomic_postinc(atomic_t *val) 174 184 { 175 185 return atomic_add(val, 1) - 1; … … 181 191 * @param val Variable to be decremented. 182 192 * @return Value before decrementation. 183 */ 184 static inline long atomic_postdec(atomic_t *val) 193 * 194 */ 195 static inline atomic_count_t atomic_postdec(atomic_t *val) 185 196 { 186 197 return atomic_add(val, -1) + 1;
Note:
See TracChangeset
for help on using the changeset viewer.