Alexandre Julliard : kernel32: Export InterlockedCompareExchange64.

Alexandre Julliard julliard at winehq.org
Fri Feb 5 08:42:32 CST 2010


Module: wine
Branch: master
Commit: abf29377ba0882b1774a5402fe994a13386774db
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=abf29377ba0882b1774a5402fe994a13386774db

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Feb  5 12:31:48 2010 +0100

kernel32: Export InterlockedCompareExchange64.

---

 dlls/kernel32/kernel32.spec |    1 +
 include/winbase.h           |   15 +++++++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec
index 7c32ff7..1dd449b 100644
--- a/dlls/kernel32/kernel32.spec
+++ b/dlls/kernel32/kernel32.spec
@@ -726,6 +726,7 @@
 @ stdcall InitializeCriticalSectionEx(ptr long long)
 @ stdcall InitializeSListHead(ptr) ntdll.RtlInitializeSListHead
 @ stdcall -arch=i386 InterlockedCompareExchange (ptr long long)
+@ stdcall -arch=i386 -ret64 InterlockedCompareExchange64(ptr double double) ntdll.RtlInterlockedCompareExchange64
 @ stdcall -arch=i386 InterlockedDecrement(ptr)
 @ stdcall -arch=i386 InterlockedExchange(ptr long)
 @ stdcall -arch=i386 InterlockedExchangeAdd (ptr long )
diff --git a/include/winbase.h b/include/winbase.h
index 06bc622..f5578c4 100644
--- a/include/winbase.h
+++ b/include/winbase.h
@@ -2376,6 +2376,8 @@ static inline PVOID WINAPI InterlockedExchangePointer( PVOID volatile *dest, PVO
     return (PVOID)InterlockedExchange( (LONG volatile*)dest, (LONG)val );
 }
 
+WINBASEAPI LONGLONG WINAPI InterlockedCompareExchange64(LONGLONG volatile*,LONGLONG,LONGLONG);
+
 #else  /* __i386__ */
 
 static inline LONG WINAPI InterlockedCompareExchange( LONG volatile *dest, LONG xchg, LONG compare )
@@ -2404,6 +2406,19 @@ static inline PVOID WINAPI InterlockedCompareExchangePointer( PVOID volatile *de
 #endif
 }
 
+static inline LONGLONG WINAPI InterlockedCompareExchange64( LONGLONG volatile *dest, LONGLONG xchg, LONGLONG compare )
+{
+#if defined(__x86_64__) && defined(__GNUC__)
+    LONGLONG ret;
+    __asm__ __volatile__( "lock; cmpxchgq %2,(%1)"
+                          : "=a" (ret) : "r" (dest), "r" (xchg), "0" (compare) : "memory" );
+    return ret;
+#else
+    extern __int64 interlocked_cmpxchg64( __int64 *dest, __int64 xchg, __int64 compare );
+    return interlocked_cmpxchg64( (__int64 *)dest, xchg, compare );
+#endif
+}
+
 static inline LONG WINAPI InterlockedExchange( LONG volatile *dest, LONG val )
 {
 #if defined(__x86_64__) && defined(__GNUC__)




More information about the wine-cvs mailing list