summaryrefslogtreecommitdiff
path: root/arch/i386/atomic.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386/atomic.h')
-rw-r--r--arch/i386/atomic.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/i386/atomic.h b/arch/i386/atomic.h
index e74e4535..bf3c336e 100644
--- a/arch/i386/atomic.h
+++ b/arch/i386/atomic.h
@@ -49,6 +49,13 @@ static inline long a_cas_l(volatile void *p, long t, long s)
return t;
}
+static inline int a_cas(volatile int *p, int t, int s)
+{
+ __asm__( "lock ; cmpxchg %3, %1"
+ : "=a"(t), "=m"(*p) : "a"(t), "r"(s) : "memory" );
+ return t;
+}
+
static inline void *a_swap_p(void *volatile *x, void *v)
{
__asm__( "xchg %0, %1" : "=r"(v), "=m"(*(void **)x) : "0"(v) : "memory" );