diff options
Diffstat (limited to 'winsup/cygwin/winbase.h')
-rw-r--r-- | winsup/cygwin/winbase.h | 48 |
1 files changed, 13 insertions, 35 deletions
diff --git a/winsup/cygwin/winbase.h b/winsup/cygwin/winbase.h index 95fac3045..00c71a923 100644 --- a/winsup/cygwin/winbase.h +++ b/winsup/cygwin/winbase.h @@ -1,6 +1,6 @@ /* winbase.h - Copyright 2002, 2003, 2004, 2008, 2009, 2012 Red Hat, Inc. + Copyright 2002, 2003, 2004, 2008 Red Hat, Inc. This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for @@ -11,25 +11,10 @@ details. */ #ifndef _WINBASE2_H #define _WINBASE2_H -/* 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 +ilockincr (volatile long *m) { - register LONG __res; - __asm__ __volatile__ ("\n\ - movl %3,%0\n\ - lock xadd %0,%1\n\ - addl %3,%0\n\ - ": "=&r" (__res), "=m" (*m): "m" (*m), "r" (value): "cc"); - return __res; -} - -extern __inline__ LONG -ilockincr (volatile LONG *m) -{ - register LONG __res; + register int __res; __asm__ __volatile__ ("\n\ movl $1,%0\n\ lock xadd %0,%1\n\ @@ -38,10 +23,10 @@ ilockincr (volatile LONG *m) return __res; } -extern __inline__ LONG -ilockdecr (volatile LONG *m) +extern __inline__ long +ilockdecr (volatile long *m) { - register LONG __res; + register int __res; __asm__ __volatile__ ("\n\ movl $0xffffffff,%0\n\ lock xadd %0,%1\n\ @@ -50,12 +35,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 +51,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) @@ -80,8 +65,6 @@ ilockcmpexch (volatile LONG *t, LONG v, LONG c) }); } -#undef InterlockedAdd -#define InterlockedAdd ilockadd #undef InterlockedIncrement #define InterlockedIncrement ilockincr #undef InterlockedDecrement @@ -90,9 +73,4 @@ 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*/ |