- add missing 64 bit intrinsic Interlocked functions

- readd Interlocked definitions to winddk.h that someone stole

svn path=/branches/ros-amd64-bringup/; revision=34916
This commit is contained in:
Timo Kreuzer 2008-07-28 21:39:55 +00:00
parent 2ff232d781
commit f677303425
2 changed files with 30 additions and 0 deletions

View file

@ -5796,6 +5796,17 @@ InterlockedExchangeAdd(
#define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer
#define InterlockedExchangePointer _InterlockedExchangePointer
#define ExInterlockedPopEntrySList(Head, Lock) ExpInterlockedPopEntrySList(Head)
#define ExInterlockedPushEntrySList(Head, Entry, Lock) ExpInterlockedPushEntrySList(Head, Entry)
#define ExInterlockedFlushSList(Head) ExpInterlockedFlushSList(Head)
#if !defined(_WINBASE_)
#define InterlockedPopEntrySList(Head) ExpInterlockedPopEntrySList(Head)
#define InterlockedPushEntrySList(Head, Entry) ExpInterlockedPushEntrySList(Head, Entry)
#define InterlockedFlushSList(Head) ExpInterlockedFlushSList(Head)
#define QueryDepthSList(Head) ExQueryDepthSList(Head)
#endif // !defined(_WINBASE_
#endif // _M_AMD64
#endif /* !__INTERLOCKED_DECLARED */

View file

@ -147,6 +147,13 @@ static __inline__ __attribute__((always_inline)) long _InterlockedExchangeAdd(vo
return __sync_fetch_and_add(Addend, Value);
}
#if defined(_M_AMD64)
static __inline__ __attribute__((always_inline)) long long _InterlockedExchangeAdd64(volatile long long * const Addend, const long long Value)
{
return __sync_fetch_and_add(Addend, Value);
}
#endif
static __inline__ __attribute__((always_inline)) char _InterlockedAnd8(volatile char * const value, const char mask)
{
return __sync_fetch_and_and(value, mask);
@ -471,6 +478,18 @@ static __inline__ __attribute__((always_inline)) long _InterlockedIncrement16(vo
return _InterlockedExchangeAdd16(lpAddend, 1) + 1;
}
#if defined(_M_AMD64)
static __inline__ __attribute__((always_inline)) long long _InterlockedDecrement64(volatile long long * const lpAddend)
{
return _InterlockedExchangeAdd(lpAddend, -1) - 1;
}
static __inline__ __attribute__((always_inline)) long long _InterlockedIncrement64(volatile long long * const lpAddend)
{
return _InterlockedExchangeAdd64(lpAddend, 1) + 1;
}
#endif
static __inline__ __attribute__((always_inline)) unsigned char _interlockedbittestandreset(volatile long * a, const long b)
{
unsigned char retval;