--- winbase.h.org 2002-06-24 03:12:37.000000000 +0200 +++ winbase.h 2002-12-12 10:11:47.000000000 +0100 @@ -7,46 +7,83 @@ #define _WINBASE2_H #endif -#ifndef _WINBASE2_H -#define _WINBASE2_H +#if defined(__INSIDE_CYGWIN__) && !defined (__NO_INTERLOCKED__) + +#ifndef __INTERLOCKED_DEFINED__ +#define __INTERLOCKED_DEFINED__ + +#ifdef __cplusplus +extern "C" { +#endif extern __inline__ long ilockincr (long *m) { - register int __res; - __asm__ __volatile__ ("\n\ - movl $1,%0\n\ - lock xadd %0,(%1)\n\ - inc %0\n\ - ": "=a" (__res), "=r" (m): "1" (m)); + int __res; + __asm__ volatile ("\n\ + movl $1,%0\n\ + lock xadd %0,(%1)\n\ + inc %0\n" + : "=a" (__res), "=q" (m) + : "1" (m) + : "memory" ); return __res; } + extern __inline__ long ilockdecr (long *m) { - register int __res; - __asm__ __volatile__ ("\n\ - movl $0xffffffff,%0\n\ - lock xadd %0,(%1)\n\ - dec %0\n\ - ": "=a" (__res), "=r" (m): "1" (m)); + int __res; + __asm__ volatile ("\n\ + movl $0xffffffff,%0\n\ + lock xadd %0,(%1)\n\ + dec %0\n" + : "=a" (__res), "=q" (m) + : "1" (m) + : "memory" ); return __res; } + extern __inline__ long ilockexch (long *t, long v) { - register int __res; - __asm__ __volatile__ ("\n\ - movl (%2),%0\n\ -1: lock cmpxchgl %3,(%1)\n\ - jne 1b\n\ - ": "=a" (__res), "=c" (t): "1" (t), "d" (v)); + int __res; + __asm__ volatile ("\n\ +1: lock cmpxchgl %3,(%1)\n\ + jne 1b\n" + : "=a" (__res), "=q" (t) + : "1" (t), "q" (v), "0" (*t) + : "memory" ); return __res; } +extern __inline__ long ilockcmpexch (long *t, long v, long c) +{ + int __res; + __asm__ volatile ("\n\ + lock cmpxchgl %3,(%1)\n" + : "=a" (__res), "=q" (t) + : "1" (t), "q" (v), "0" (c) + : "memory" ); + return __res; +} + +#ifdef __cplusplus +} +#endif + #undef InterlockedIncrement #define InterlockedIncrement ilockincr #undef InterlockedDecrement #define InterlockedDecrement ilockdecr #undef InterlockedExchange #define InterlockedExchange ilockexch +#undef InterlockedCompareExchange +#define InterlockedCompareExchange ilockcmpexch + +#endif /*__INTERLOCKED_DEFINED__*/ + +#endif /*defined(__INSIDE_CYGWIN__) && !defined (__NO_INTERLOCKED__)*/ + +#ifndef _WINBASE2_H +#define _WINBASE2_H extern long tls_ix; extern char * volatile *__stackbase __asm__ ("%fs:4");