Changeset 86b31ba9 in mainline for kernel/arch/sparc64/include/atomic.h
- Timestamp:
- 2006-09-26T16:12:38Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a9ac978
- Parents:
- 26678e5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc64/include/atomic.h
r26678e5 r86b31ba9 36 36 #define KERN_sparc64_ATOMIC_H_ 37 37 38 #include <arch/barrier.h> 38 39 #include <arch/types.h> 39 40 #include <typedefs.h> … … 93 94 } 94 95 96 static inline long test_and_set(atomic_t *val) 97 { 98 uint64_t v = 1; 99 100 __asm__ volatile ("casx %0, %2, %1\n" : "+m" (*val), "+r" (v) : "r" (0)); 101 102 return v; 103 } 104 105 static inline void atomic_lock_arch(atomic_t *val) 106 { 107 uint64_t tmp1 = 1; 108 uint64_t tmp2; 109 110 __asm__ volatile ( 111 "0:\n" 112 "casx %0, %3, %1\n" 113 "brz %1, 2f\n" 114 "nop\n" 115 "1:\n" 116 "ldx %0, %2\n" 117 "brz %2, 0b\n" 118 "nop\n" 119 "ba 1b\n" 120 "nop\n" 121 "2:\n" 122 : "+m" (*val), "+r" (tmp1), "+r" (tmp2) : "r" (0) 123 ); 124 125 /* 126 * Prevent critical section code from bleeding out this way up. 127 */ 128 CS_ENTER_BARRIER(); 129 } 130 95 131 #endif 96 132
Note:
See TracChangeset
for help on using the changeset viewer.