Changeset 18e0a6c in mainline for arch/ia32/include/atomic.h
- Timestamp:
- 2005-06-09T23:43:45Z (20 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 74df77d
- Parents:
- d896525
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/ia32/include/atomic.h
rd896525 r18e0a6c 32 32 #include <arch/types.h> 33 33 34 extern void atomic_inc(volatile int *val); 35 extern void atomic_dec(volatile int *val); 34 static inline void atomic_inc(volatile int *val) { 35 #ifdef __SMP__ 36 __asm__ volatile ("lock incl (%0)\n" : : "r" (val)); 37 #else 38 __asm__ volatile ("incl (%0)\n" : : "r" (val)); 39 #endif /* __SMP__ */ 40 } 36 41 37 extern int test_and_set(int *val); 42 static inline void atomic_dec(volatile int *val) { 43 #ifdef __SMP__ 44 __asm__ volatile ("lock decl (%0)\n" : : "r" (val)); 45 #else 46 __asm__ volatile ("decl (%0)\n" : : "r" (val)); 47 #endif /* __SMP__ */ 48 } 49 50 static inline int test_and_set(int *val) { 51 int v; 52 53 __asm__ volatile ( 54 "movl $1, %0\n" 55 "xchgl %0, (%1)\n" 56 : "=r" (v) 57 : "r" (val) 58 ); 59 60 return v; 61 } 62 63 38 64 extern void spinlock_arch(int *val); 39 65
Note:
See TracChangeset
for help on using the changeset viewer.