Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/winbase.h')
-rw-r--r--winsup/cygwin/winbase.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/winsup/cygwin/winbase.h b/winsup/cygwin/winbase.h
index d9c53cfba..666f74a2d 100644
--- a/winsup/cygwin/winbase.h
+++ b/winsup/cygwin/winbase.h
@@ -11,7 +11,6 @@ details. */
#ifndef _WINBASE2_H
#define _WINBASE2_H
-#ifndef __x86_64__
extern __inline__ LONG
ilockcmpexch (volatile LONG *t, LONG v, LONG c)
{
@@ -29,7 +28,30 @@ ilockcmpexch (volatile LONG *t, LONG v, LONG c)
#undef InterlockedCompareExchange
#define InterlockedCompareExchange ilockcmpexch
#undef InterlockedCompareExchangePointer
+
+#ifdef __x86_64__
+extern __inline__ LONGLONG
+ilockcmpexch64 (volatile LONGLONG *t, LONGLONG v, LONGLONG c)
+{
+ return
+ ({
+ register LONGLONG ret __asm ("%rax");
+ __asm __volatile ("lock cmpxchgq %2, %1"
+ : "=a" (ret), "=m" (*t)
+ : "r" (v), "m" (*t), "0" (c)
+ : "memory");
+ ret;
+ });
+}
+
+#define InterlockedCompareExchange64 ilockcmpexch64
+#define InterlockedCompareExchangePointer(d,e,c) \
+ (PVOID)InterlockedCompareExchange64((LONGLONG volatile *)(d),(LONGLONG)(e),(LONGLONG)(c))
+
+#else
+
#define InterlockedCompareExchangePointer(d,e,c) \
(PVOID)InterlockedCompareExchange((LONG volatile *)(d),(LONG)(e),(LONG)(c))
+
#endif /* !__x86_64 */
#endif /*_WINBASE2_H*/