Changeset 04803bf in mainline for kernel/arch/ia32/include/atomic.h
- Timestamp:
- 2011-03-21T22:00:17Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 143932e3
- Parents:
- b50b5af2 (diff), 7308e84 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia32/include/atomic.h
rb50b5af2 r04803bf 36 36 #define KERN_ia32_ATOMIC_H_ 37 37 38 #include < arch/types.h>38 #include <typedefs.h> 39 39 #include <arch/barrier.h> 40 40 #include <preemption.h> 41 #include <trace.h> 41 42 42 static inline void atomic_inc(atomic_t *val) { 43 NO_TRACE static inline void atomic_inc(atomic_t *val) 44 { 43 45 #ifdef CONFIG_SMP 44 46 asm volatile ( … … 54 56 } 55 57 56 static inline void atomic_dec(atomic_t *val) { 58 NO_TRACE static inline void atomic_dec(atomic_t *val) 59 { 57 60 #ifdef CONFIG_SMP 58 61 asm volatile ( … … 68 71 } 69 72 70 static inline long atomic_postinc(atomic_t *val) 73 NO_TRACE static inline atomic_count_t atomic_postinc(atomic_t *val) 71 74 { 72 longr = 1;75 atomic_count_t r = 1; 73 76 74 77 asm volatile ( 75 78 "lock xaddl %[r], %[count]\n" 76 : [count] "+m" (val->count), [r] "+r" (r) 79 : [count] "+m" (val->count), 80 [r] "+r" (r) 77 81 ); 78 82 … … 80 84 } 81 85 82 static inline long atomic_postdec(atomic_t *val) 86 NO_TRACE static inline atomic_count_t atomic_postdec(atomic_t *val) 83 87 { 84 longr = -1;88 atomic_count_t r = -1; 85 89 86 90 asm volatile ( 87 91 "lock xaddl %[r], %[count]\n" 88 : [count] "+m" (val->count), [r] "+r"(r) 92 : [count] "+m" (val->count), 93 [r] "+r" (r) 89 94 ); 90 95 … … 95 100 #define atomic_predec(val) (atomic_postdec(val) - 1) 96 101 97 static inline uint32_t test_and_set(atomic_t *val) { 98 uint32_t v; 102 NO_TRACE static inline atomic_count_t test_and_set(atomic_t *val) 103 { 104 atomic_count_t v = 1; 99 105 100 106 asm volatile ( 101 "movl $1, %[v]\n"102 107 "xchgl %[v], %[count]\n" 103 : [v] "=r" (v), [count] "+m" (val->count) 108 : [v] "+r" (v), 109 [count] "+m" (val->count) 104 110 ); 105 111 … … 108 114 109 115 /** ia32 specific fast spinlock */ 110 static inline void atomic_lock_arch(atomic_t *val)116 NO_TRACE static inline void atomic_lock_arch(atomic_t *val) 111 117 { 112 uint32_t tmp;118 atomic_count_t tmp; 113 119 114 120 preemption_disable(); … … 124 130 "testl %[tmp], %[tmp]\n" 125 131 "jnz 0b\n" 126 : [count] "+m" (val->count), [tmp] "=&r" (tmp) 132 : [count] "+m" (val->count), 133 [tmp] "=&r" (tmp) 127 134 ); 135 128 136 /* 129 137 * Prevent critical section code from bleeding out this way up.
Note:
See TracChangeset
for help on using the changeset viewer.