aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/winbase.h
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2013-04-23 09:44:36 +0000
committerCorinna Vinschen <corinna@vinschen.de>2013-04-23 09:44:36 +0000
commit61522196c71593da09572fce9af9e0d7dad61bc3 (patch)
tree9bf74facd67974fa2f780d6ce68b14eb7a94e371 /winsup/cygwin/winbase.h
parent1875ee55d31d3673059373c8f9837bf98f93c713 (diff)
downloadnewlib-61522196c71593da09572fce9af9e0d7dad61bc3.zip
newlib-61522196c71593da09572fce9af9e0d7dad61bc3.tar.gz
newlib-61522196c71593da09572fce9af9e0d7dad61bc3.tar.bz2
* Merge in cygwin-64bit-branch.
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 d9c53cf..666f74a 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*/