diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index 7c32ff7bf51..1dd449b4814 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 06bc622fcf0..f5578c4ab65 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__)