aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2012-07-06 13:51:26 +0000
committerCorinna Vinschen <corinna@vinschen.de>2012-07-06 13:51:26 +0000
commitf3a43e7ef07cbdb303685452fccd56f6953a8bd0 (patch)
tree6f1b1db07e9af949bdd1113309f14c4d67bed54c
parent6f94526c1c02d187a31c028ee1a754b4ecbb98c9 (diff)
downloadnewlib-f3a43e7ef07cbdb303685452fccd56f6953a8bd0.zip
newlib-f3a43e7ef07cbdb303685452fccd56f6953a8bd0.tar.gz
newlib-f3a43e7ef07cbdb303685452fccd56f6953a8bd0.tar.bz2
* winbase.h: Throughout use LONG rather than long type to prepare for
64 bit. (InterlockedCompareExchangePointer): Define.
-rw-r--r--winsup/cygwin/ChangeLog6
-rw-r--r--winsup/cygwin/winbase.h35
2 files changed, 26 insertions, 15 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index fd06947..8418656 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,11 @@
2012-07-06 Corinna Vinschen <corinna@vinschen.de>
+ * winbase.h: Throughout use LONG rather than long type to prepare for
+ 64 bit.
+ (InterlockedCompareExchangePointer): Define.
+
+2012-07-06 Corinna Vinschen <corinna@vinschen.de>
+
* fhandler_registry.cc (RegOpenUserClassesRoot): Only define when
building against w32api headers.
(RegOpenCurrentUser): Ditto.
diff --git a/winsup/cygwin/winbase.h b/winsup/cygwin/winbase.h
index 0137e9a..95fac30 100644
--- a/winsup/cygwin/winbase.h
+++ b/winsup/cygwin/winbase.h
@@ -14,10 +14,10 @@ details. */
/* For some unknown reason, InterlockedAdd is only supported on Itanium
when using the Windows headers. Fortunately we're not restricted to the
Windows headers :) */
-extern __inline__ long
-ilockadd (volatile long *m, long value)
+extern __inline__ LONG
+ilockadd (volatile LONG *m, LONG value)
{
- register int __res;
+ register LONG __res;
__asm__ __volatile__ ("\n\
movl %3,%0\n\
lock xadd %0,%1\n\
@@ -26,10 +26,10 @@ ilockadd (volatile long *m, long value)
return __res;
}
-extern __inline__ long
-ilockincr (volatile long *m)
+extern __inline__ LONG
+ilockincr (volatile LONG *m)
{
- register int __res;
+ register LONG __res;
__asm__ __volatile__ ("\n\
movl $1,%0\n\
lock xadd %0,%1\n\
@@ -38,10 +38,10 @@ ilockincr (volatile long *m)
return __res;
}
-extern __inline__ long
-ilockdecr (volatile long *m)
+extern __inline__ LONG
+ilockdecr (volatile LONG *m)
{
- register int __res;
+ register LONG __res;
__asm__ __volatile__ ("\n\
movl $0xffffffff,%0\n\
lock xadd %0,%1\n\
@@ -50,12 +50,12 @@ ilockdecr (volatile long *m)
return __res;
}
-extern __inline__ long
-ilockexch (volatile long *t, long v)
+extern __inline__ LONG
+ilockexch (volatile LONG *t, long v)
{
return
({
- register long ret __asm ("%eax");
+ register LONG ret __asm ("%eax");
__asm __volatile ("\n"
"1: lock cmpxchgl %2, %1\n"
" jne 1b\n"
@@ -66,12 +66,12 @@ ilockexch (volatile long *t, long v)
});
}
-extern __inline__ long
-ilockcmpexch (volatile long *t, long v, long c)
+extern __inline__ LONG
+ilockcmpexch (volatile LONG *t, LONG v, LONG c)
{
return
({
- register long ret __asm ("%eax");
+ register LONG ret __asm ("%eax");
__asm __volatile ("lock cmpxchgl %2, %1"
: "=a" (ret), "=m" (*t)
: "r" (v), "m" (*t), "0" (c)
@@ -90,4 +90,9 @@ ilockcmpexch (volatile long *t, long v, long c)
#define InterlockedExchange ilockexch
#undef InterlockedCompareExchange
#define InterlockedCompareExchange ilockcmpexch
+#undef InterlockedCompareExchangePointer
+#ifndef __x86_64
+#define InterlockedCompareExchangePointer(d,e,c) \
+ (PVOID)InterlockedCompareExchange((LONG volatile *)(d),(LONG)(e),(LONG)(c))
+#endif /* !__x86_64 */
#endif /*_WINBASE2_H*/