Changeset 2bcf6c6 in mainline for kernel/arch/ia32/include/atomic.h
- Timestamp:
- 2012-07-27T13:34:48Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4ec9ea41
- Parents:
- 3bb732b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia32/include/atomic.h
r3bb732b r2bcf6c6 113 113 } 114 114 115 115 116 /** ia32 specific fast spinlock */ 116 117 NO_TRACE static inline void atomic_lock_arch(atomic_t *val) … … 142 143 } 143 144 145 146 #define _atomic_cas_ptr_impl(pptr, exp_val, new_val, old_val, prefix) \ 147 asm volatile ( \ 148 prefix " cmpxchgl %[newval], %[ptr]\n" \ 149 : /* Output operands. */ \ 150 /* Old/current value is returned in eax. */ \ 151 [oldval] "=a" (old_val), \ 152 /* (*ptr) will be read and written to, hence "+" */ \ 153 [ptr] "+m" (*pptr) \ 154 : /* Input operands. */ \ 155 /* Expected value must be in eax. */ \ 156 [expval] "a" (exp_val), \ 157 /* The new value may be in any register. */ \ 158 [newval] "r" (new_val) \ 159 : "memory" \ 160 ) 161 162 /** Atomically compares and swaps the pointer at pptr. */ 163 NO_TRACE static inline void * atomic_cas_ptr(void **pptr, 164 void *exp_val, void *new_val) 165 { 166 void *old_val; 167 _atomic_cas_ptr_impl(pptr, exp_val, new_val, old_val, "lock\n"); 168 return old_val; 169 } 170 171 /** Compare-and-swap of a pointer that is atomic wrt to local cpu's interrupts. 172 * 173 * This function is NOT smp safe and is not atomic with respect to other cpus. 174 */ 175 NO_TRACE static inline void * atomic_cas_ptr_local(void **pptr, 176 void *exp_val, void *new_val) 177 { 178 void *old_val; 179 _atomic_cas_ptr_impl(pptr, exp_val, new_val, old_val, ""); 180 return old_val; 181 } 182 183 #undef _atomic_cas_ptr_impl 184 144 185 #endif 145 186
Note:
See TracChangeset
for help on using the changeset viewer.