Changes in kernel/arch/amd64/include/atomic.h [d99c1d2:7a0359b] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/include/atomic.h
rd99c1d2 r7a0359b 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) 43 44 { 44 45 #ifdef CONFIG_SMP … … 55 56 } 56 57 57 static inline void atomic_dec(atomic_t *val)58 NO_TRACE static inline void atomic_dec(atomic_t *val) 58 59 { 59 60 #ifdef CONFIG_SMP … … 70 71 } 71 72 72 static inline atomic_count_t atomic_postinc(atomic_t *val)73 NO_TRACE static inline atomic_count_t atomic_postinc(atomic_t *val) 73 74 { 74 75 atomic_count_t r = 1; … … 83 84 } 84 85 85 static inline atomic_count_t atomic_postdec(atomic_t *val)86 NO_TRACE static inline atomic_count_t atomic_postdec(atomic_t *val) 86 87 { 87 88 atomic_count_t r = -1; … … 99 100 #define atomic_predec(val) (atomic_postdec(val) - 1) 100 101 101 static inline atomic_count_t test_and_set(atomic_t *val)102 NO_TRACE static inline atomic_count_t test_and_set(atomic_t *val) 102 103 { 103 104 atomic_count_t v = 1; … … 113 114 114 115 /** amd64 specific fast spinlock */ 115 static inline void atomic_lock_arch(atomic_t *val)116 NO_TRACE static inline void atomic_lock_arch(atomic_t *val) 116 117 { 117 118 atomic_count_t tmp; … … 120 121 asm volatile ( 121 122 "0:\n" 122 " pause\n"123 " mov %[count], %[tmp]\n"124 " testq %[tmp], %[tmp]\n"125 " jnz 0b\n" /* lightweight looping on locked spinlock */123 " pause\n" 124 " mov %[count], %[tmp]\n" 125 " testq %[tmp], %[tmp]\n" 126 " jnz 0b\n" /* lightweight looping on locked spinlock */ 126 127 127 " incq %[tmp]\n" /* now use the atomic operation */128 " xchgq %[count], %[tmp]\n"129 " testq %[tmp], %[tmp]\n"130 " jnz 0b\n"128 " incq %[tmp]\n" /* now use the atomic operation */ 129 " xchgq %[count], %[tmp]\n" 130 " testq %[tmp], %[tmp]\n" 131 " jnz 0b\n" 131 132 : [count] "+m" (val->count), 132 133 [tmp] "=&r" (tmp)
Note:
See TracChangeset
for help on using the changeset viewer.