From: Avi Kivity <[EMAIL PROTECTED]> Signed-off-by: Avi Kivity <[EMAIL PROTECTED]>
diff --git a/kernel/external-module-compat.h b/kernel/external-module-compat.h index ea94f30..1dc5a96 100644 --- a/kernel/external-module-compat.h +++ b/kernel/external-module-compat.h @@ -322,6 +322,28 @@ static inline void __kvm_set_64bit(u64 *ptr, u64 val) #undef set_64bit #define set_64bit __kvm_set_64bit +static inline unsigned long long __kvm_cmpxchg64(volatile void *ptr, + unsigned long long old, + unsigned long long new) +{ + unsigned long long prev; + __asm__ __volatile__(LOCK_PREFIX "cmpxchg8b %3" + : "=A"(prev) + : "b"((unsigned long)new), + "c"((unsigned long)(new >> 32)), + "m"(*__xg(ptr)), + "0"(old) + : "memory"); + return prev; +} + +#define kvm_cmpxchg64(ptr,o,n)\ + ((__typeof__(*(ptr)))__kvm_cmpxchg64((ptr),(unsigned long long)(o),\ + (unsigned long long)(n))) + +#undef cmpxchg64 +#define cmpxchg64(ptr, o, n) kvm_cmpxchg64(ptr, o, n) + #endif #ifndef CONFIG_PREEMPT_NOTIFIERS ------------------------------------------------------------------------- SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ kvm-commits mailing list kvm-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-commits