Changeset 06e1e95 in mainline for uspace/libc/arch/sparc64/include/atomic.h
- Timestamp:
- 2006-09-14T17:09:21Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f1d1f5d3
- Parents:
- e5ecc02
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/libc/arch/sparc64/include/atomic.h
re5ecc02 r06e1e95 50 50 { 51 51 uint64_t a, b; 52 volatile uint64_t x = (uint64_t) &val->count;53 52 54 __asm__ volatile ( 55 "0:\n" 56 "ldx %0, %1\n" 57 "add %1, %3, %2\n" 58 "casx %0, %1, %2\n" 59 "cmp %1, %2\n" 60 "bne 0b\n" /* The operation failed and must be attempted again if a != b. */ 61 "nop\n" 62 : "=m" (*((uint64_t *)x)), "=r" (a), "=r" (b) 63 : "r" (i) 64 ); 53 do { 54 volatile uintptr_t x = (uint64_t) &val->count; 55 56 a = *((uint64_t *) x); 57 b = a + i; 58 __asm__ volatile ("casx %0, %1, %2\n": "+m" (*((uint64_t *)x)), "+r" (a), "+r" (b)); 59 } while (a != b); 65 60 66 61 return a;
Note:
See TracChangeset
for help on using the changeset viewer.