Changeset 1984 for trunk/src/emx/include/386/builtin.h
- Timestamp:
- May 8, 2005, 2:11:22 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/include/386/builtin.h
-
Property cvs2svn:cvs-rev
changed from
1.10
to1.11
r1983 r1984 77 77 static __inline__ int __atomic_set_bit(__volatile__ void *pv, unsigned uBit) 78 78 { 79 __asm__ __volatile__("lock btsl %2, %1\n\t"79 __asm__ __volatile__("lock; btsl %2, %1\n\t" 80 80 "sbbl %0,%0" 81 81 : "=r" (uBit), … … 95 95 static __inline__ void __atomic_clear_bit(__volatile__ void *pv, unsigned uBit) 96 96 { 97 __asm__ __volatile__("lock btrl %1, %0"97 __asm__ __volatile__("lock; btrl %1, %0" 98 98 : "=m" (*(__volatile__ unsigned *)pv) 99 99 : "r" (uBit)); … … 128 128 static __inline__ void __atomic_add(__volatile__ unsigned *pu, const unsigned uAdd) 129 129 { 130 __asm__ __volatile__("lock addl %1, %0"130 __asm__ __volatile__("lock; addl %1, %0" 131 131 : "=m" (*pu) 132 : "nr" (uAdd), 132 : "nr" (uAdd), 133 133 "m" (*pu)); 134 134 } … … 142 142 static __inline__ void __atomic_sub(__volatile__ unsigned *pu, const unsigned uSub) 143 143 { 144 __asm__ __volatile__("lock subl %1, %0"144 __asm__ __volatile__("lock; subl %1, %0" 145 145 : "=m" (*pu) 146 : "nr" (uSub), 146 : "nr" (uSub), 147 147 "m" (*pu)); 148 148 } … … 156 156 static __inline__ void __atomic_increment(__volatile__ unsigned *pu) 157 157 { 158 __asm__ __volatile__("lock incl %0"159 : "=m" (*pu) 158 __asm__ __volatile__("lock; incl %0" 159 : "=m" (*pu) 160 160 : "m" (*pu)); 161 161 } 162 162 163 163 /** 164 * Atomically increments a 32-bit unsigned value. 165 * 166 * @param pu32 Pointer to the value to increment. 167 */ 168 static __inline__ void __atomic_increment_u32(uint32_t __volatile__ *pu32) 169 { 170 __asm__ __volatile__("lock; incl %0" 171 : "=m" (*pu32) 172 : "m" (*pu32)); 173 } 174 175 /** 176 * Atomically increments a 16-bit unsigned value. 177 * 178 * @param pu16 Pointer to the value to increment. 179 */ 180 static __inline__ void __atomic_increment_u16(uint16_t __volatile__ *pu16) 181 { 182 __asm__ __volatile__("lock; incw %0" 183 : "=m" (*pu16) 184 : "m" (*pu16)); 185 } 186 187 /** 164 188 * Atomically decrements a 32-bit unsigned value. 165 189 * … … 168 192 static __inline__ void __atomic_decrement(__volatile__ unsigned *pu) 169 193 { 170 __asm__ __volatile__("lock decl %0"171 : "=m" (*pu) 194 __asm__ __volatile__("lock; decl %0" 195 : "=m" (*pu) 172 196 : "m" (*pu)); 197 } 198 199 /** 200 * Atomically decrements a 32-bit unsigned value. 201 * 202 * @param pu Pointer to the value to decrement. 203 */ 204 static __inline__ void __atomic_decrement_u32(__volatile__ uint32_t *pu32) 205 { 206 __asm__ __volatile__("lock; decl %0" 207 : "=m" (*pu32) 208 : "m" (*pu32)); 209 } 210 211 /** 212 * Atomically decrements a 16-bit unsigned value. 213 * 214 * @param pu16 Pointer to the value to decrement. 215 */ 216 static __inline__ void __atomic_decrement_u16(uint16_t __volatile__ *pu16) 217 { 218 __asm__ __volatile__("lock; decw %0" 219 : "=m" (*pu16) 220 : "m" (*pu16)); 173 221 } 174 222 … … 192 240 "2:\n\t" 193 241 "incl %0\n\t" 194 "lock 242 "lock; cmpxchgl %0, %1\n\t" 195 243 "jz 3f\n\t" 196 244 "jmp 1b\n" … … 228 276 "2:\n\t" 229 277 "incw %w0\n\t" 230 "lock 278 "lock; cmpxchgw %w0, %2\n\t" 231 279 "jz 3f\n\t" 232 280 "jmp 1b\n\t" … … 261 309 "2:\n\t" 262 310 "decl %0\n\t" 263 "lock 311 "lock; cmpxchgl %0, %1\n\t" 264 312 "jz 3f\n\t" 265 313 "jmp 1b\n" … … 297 345 "2:\n\t" 298 346 "decw %%bx\n\t" 299 "lock 347 "lock; cmpxchgw %w0, %1\n\t" 300 348 "jz 3f\n\t" 301 349 "jmp 1b\n" … … 321 369 static inline unsigned __atomic_cmpxchg32(volatile uint32_t *pu32, uint32_t u32New, uint32_t u32Old) 322 370 { 323 __asm__ __volatile__("lock 371 __asm__ __volatile__("lock; cmpxchgl %2, %1\n\t" 324 372 "setz %%al\n\t" 325 373 "movzx %%al, %%eax\n\t" -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.