Changeset 53f9821 in mainline for arch/ia32/include/atomic.h
- Timestamp:
- 2006-03-20T20:32:17Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 018d957e
- Parents:
- 9d3e185
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/ia32/include/atomic.h
r9d3e185 r53f9821 31 31 32 32 #include <arch/types.h> 33 #include <arch/barrier.h> 34 #include <preemption.h> 33 35 34 36 typedef struct { volatile __u32 count; } atomic_t; … … 101 103 } 102 104 105 /** Ia32 specific fast spinlock */ 106 static inline void atomic_lock_arch(atomic_t *val) 107 { 108 __u32 tmp; 103 109 104 extern void spinlock_arch(volatile int *val); 110 preemption_disable(); 111 __asm__ volatile ( 112 "0:;" 113 #ifdef CONFIG_HT 114 "pause;" /* Pentium 4's HT love this instruction */ 115 #endif 116 "mov %0, %1;" 117 "testl %1, %1;" 118 "jnz 0b;" /* Leightweight looping on locked spinlock */ 119 120 "incl %1;" /* now use the atomic operation */ 121 "xchgl %0, %1;" 122 "testl %1, %1;" 123 "jnz 0b;" 124 : "=m"(val->count),"=r"(tmp) 125 ); 126 /* 127 * Prevent critical section code from bleeding out this way up. 128 */ 129 CS_ENTER_BARRIER(); 130 } 105 131 106 132 #endif
Note:
See TracChangeset
for help on using the changeset viewer.