core/asm/x86/cmpxchg.h

00001 
00007 #ifndef _ASM_CMPXCHG_H
00008 #define _ASM_CMPXCHG_H
00009 
00010 static __inline unsigned long cmpxchg(volatile unsigned long *dest,
00011                         unsigned long xchg, unsigned long comp)
00012 {
00013     unsigned long prev;
00014     __asm__ __volatile__("lock; cmpxchgl %1,%2"
00015                   : "=a"(prev)
00016                   : "r"(xchg), "m"(*dest), "0"(comp)
00017                   : "memory");
00018     return prev;
00019 }
00020 
00021 #define HAVE_CMPXCHG
00022 
00023 #endif /* _ASM_CMPXCHG_H */
00024 

GridLAB-DTM Version 1.0
An open-source project initiated by the US Department of Energy