Author: tkreuzer
Date: Tue Feb 10 10:11:13 2009
New Revision: 39534
URL:
http://svn.reactos.org/svn/reactos?rev=39534&view=rev
Log:
- Move interlocked functions from winddk.h to wdm.h
- Fix some typos
- Define ExGetCurrentResourceThread for _WIN64, too
- Fix ExReleaseResource and move it to wdm.h
Modified:
trunk/reactos/include/ddk/wdm.h
trunk/reactos/include/ddk/winddk.h
trunk/reactos/include/ddk/winnt4.h
Modified: trunk/reactos/include/ddk/wdm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/wdm.h?rev=3953…
==============================================================================
--- trunk/reactos/include/ddk/wdm.h [iso-8859-1] (original)
+++ trunk/reactos/include/ddk/wdm.h [iso-8859-1] Tue Feb 10 10:11:13 2009
@@ -224,11 +224,140 @@
#define BitScanForward _BitScanForward
#define BitScanReverse _BitScanReverse
-#ifdef _M_AMD64
+#define BitTest _bittest
+#define BitTestAndComplement _bittestandcomplement
+#define BitTestAndSet _bittestandset
+#define BitTestAndReset _bittestandreset
+#define InterlockedBitTestAndSet _interlockedbittestandset
+#define InterlockedBitTestAndReset _interlockedbittestandreset
+
+
+/** INTERLOCKED FUNCTIONS *****************************************************/
+
+#if !defined(__INTERLOCKED_DECLARED)
+#define __INTERLOCKED_DECLARED
+
+#if defined (_X86_)
+#if defined(NO_INTERLOCKED_INTRINSICS)
+NTKERNELAPI
+LONG
+FASTCALL
+InterlockedIncrement(
+ IN OUT LONG volatile *Addend);
+
+NTKERNELAPI
+LONG
+FASTCALL
+InterlockedDecrement(
+ IN OUT LONG volatile *Addend);
+
+NTKERNELAPI
+LONG
+FASTCALL
+InterlockedCompareExchange(
+ IN OUT LONG volatile *Destination,
+ IN LONG Exchange,
+ IN LONG Comparand);
+
+NTKERNELAPI
+LONG
+FASTCALL
+InterlockedExchange(
+ IN OUT LONG volatile *Destination,
+ IN LONG Value);
+
+NTKERNELAPI
+LONG
+FASTCALL
+InterlockedExchangeAdd(
+ IN OUT LONG volatile *Addend,
+ IN LONG Value);
+
+#else // !defined(NO_INTERLOCKED_INTRINSICS)
+
+#define InterlockedExchange _InterlockedExchange
+#define InterlockedIncrement _InterlockedIncrement
+#define InterlockedDecrement _InterlockedDecrement
+#define InterlockedExchangeAdd _InterlockedExchangeAdd
+#define InterlockedCompareExchange _InterlockedCompareExchange
+#define InterlockedOr _InterlockedOr
+#define InterlockedAnd _InterlockedAnd
+#define InterlockedXor _InterlockedXor
+
+#endif // !defined(NO_INTERLOCKED_INTRINSICS)
+
+#endif // defined (_X86_)
+
+#if !defined (_WIN64)
+/*
+ * PVOID
+ * InterlockedExchangePointer(
+ * IN OUT PVOID VOLATILE *Target,
+ * IN PVOID Value)
+ */
+#define InterlockedExchangePointer(Target, Value) \
+ ((PVOID) InterlockedExchange((PLONG) Target, (LONG) Value))
+
+/*
+ * PVOID
+ * InterlockedCompareExchangePointer(
+ * IN OUT PVOID *Destination,
+ * IN PVOID Exchange,
+ * IN PVOID Comparand)
+ */
+#define InterlockedCompareExchangePointer(Destination, Exchange, Comparand) \
+ ((PVOID) InterlockedCompareExchange((PLONG) Destination, (LONG) Exchange, (LONG)
Comparand))
+
+#define InterlockedExchangeAddSizeT(a, b) InterlockedExchangeAdd((LONG *)a, b)
+#define InterlockedIncrementSizeT(a) InterlockedIncrement((LONG *)a)
+#define InterlockedDecrementSizeT(a) InterlockedDecrement((LONG *)a)
+
+#endif // !defined (_WIN64)
+
+#if defined (_M_AMD64)
+
+#define InterlockedExchangeAddSizeT(a, b) InterlockedExchangeAdd64((LONGLONG *)a,
(LONGLONG)b)
+#define InterlockedIncrementSizeT(a) InterlockedIncrement64((LONGLONG *)a)
+#define InterlockedDecrementSizeT(a) InterlockedDecrement64((LONGLONG *)a)
+#define InterlockedAnd _InterlockedAnd
+#define InterlockedOr _InterlockedOr
+#define InterlockedXor _InterlockedXor
+#define InterlockedIncrement _InterlockedIncrement
+#define InterlockedDecrement _InterlockedDecrement
+#define InterlockedAdd _InterlockedAdd
+#define InterlockedExchange _InterlockedExchange
+#define InterlockedExchangeAdd _InterlockedExchangeAdd
+#define InterlockedCompareExchange _InterlockedCompareExchange
+#define InterlockedAnd64 _InterlockedAnd64
+#define InterlockedOr64 _InterlockedOr64
+#define InterlockedXor64 _InterlockedXor64
+#define InterlockedIncrement64 _InterlockedIncrement64
+#define InterlockedDecrement64 _InterlockedDecrement64
+#define InterlockedAdd64 _InterlockedAdd64
+#define InterlockedExchange64 _InterlockedExchange64
+#define InterlockedExchangeAdd64 _InterlockedExchangeAdd64
+#define InterlockedCompareExchange64 _InterlockedCompareExchange64
+#define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer
+#define InterlockedExchangePointer _InterlockedExchangePointer
#define InterlockedBitTestAndSet64 _interlockedbittestandset64
#define InterlockedBitTestAndReset64 _interlockedbittestandreset64
-#endif
-
+
+#endif // _M_AMD64
+
+#if defined(_M_AMD64) && !defined(RC_INVOKED) && !defined(MIDL_PASS)
+//#if !defined(_X86AMD64_) // FIXME: what's _X86AMD64_ used for?
+FORCEINLINE
+LONG64
+InterlockedAdd64(
+ IN OUT LONG64 volatile *Addend,
+ IN LONG64 Value)
+{
+ return InterlockedExchangeAdd64(Addend, Value) + Value;
+}
+//#endif
+#endif
+
+#endif /* !__INTERLOCKED_DECLARED */
#if defined(_M_IX86)
#define YieldProcessor _mm_pause
@@ -1629,7 +1758,7 @@
{
volatile char* vptr = (volatile char*)Pointer;
#if defined(_M_AMD64)
- _stosb((PUCHAR)vptr, 0, Size);
+ __stosb((PUCHAR)vptr, 0, Size);
#else
char * endptr = (char *)vptr + Size;
while (vptr < endptr)
@@ -1645,7 +1774,7 @@
ULONG
RtlCheckBit(
IN PRTL_BITMAP BitMapHeader,
- IN ULONG BitPosition);
+ IN ULONG BitPosition)
{
return BitTest((LONG CONST*)BitMapHeader->Buffer, BitPosition);
}
@@ -1773,7 +1902,7 @@
#if !defined(_WIN64) && (defined(_NTDDK_) || defined(_NTIFS_) ||
defined(_NDIS_))
#define LOOKASIDE_ALIGN
#else
-#define LOOKASIDE_ALIGN DECLSPEC_CACHEALIGN
+#define LOOKASIDE_ALIGN /* FIXME: DECLSPEC_CACHEALIGN */
#endif
typedef struct _LOOKASIDE_LIST_EX *PLOOKASIDE_LIST_EX;
@@ -1873,25 +2002,35 @@
* Executive Functions *
******************************************************************************/
-#if defined (_WIN64)
-#if defined(_NTDRIVER_) || defined(_NTDDK) || defined(_NTIFS_) || \
+#if defined(_X86_)
+#if defined(_NTHAL_)
+#define ExAcquireFastMutex ExiAcquireFastMutex
+#define ExReleaseFastMutex ExiReleaseFastMutex
+#define ExTryToAcquireFastMutex ExiTryToAcquireFastMutex
+#endif
+#define ExInterlockedAddUlong ExfInterlockedAddUlong
+#define ExInterlockedInsertHeadList ExfInterlockedInsertHeadList
+#define ExInterlockedInsertTailList ExfInterlockedInsertTailList
+#define ExInterlockedRemoveHeadList ExfInterlockedRemoveHeadList
+#define ExInterlockedPopEntryList ExfInterlockedPopEntryList
+#define ExInterlockedPushEntryList ExfInterlockedPushEntryList
+#endif
+
+#if defined(_WIN64)
+
+#if defined(_NTDRIVER_) || defined(_NTDDK_) || defined(_NTIFS_) || \
defined(_NTHAL_) || defined(_NTOSP_)
-NTKRNLAPI
+NTKERNELAPI
USHORT
-ExQueryDepthSList(IN PSLIST_HEADER Listhead);
+ExQueryDepthSList(IN PSLIST_HEADER ListHead);
#else
FORCEINLINE
USHORT
-ExQueryDepthSList(IN PSLIST_HEADER Listhead)
+ExQueryDepthSList(IN PSLIST_HEADER ListHead)
{
return (USHORT)(ListHead->Alignment & 0xffff);
}
#endif
-#else
-#define ExQueryDepthSList(listhead) (listhead)->Depth
-#endif
-
-#if defined(_WIN64)
NTKERNELAPI
PSLIST_ENTRY
@@ -1917,6 +2056,8 @@
ExpInterlockedPushEntrySList(Head, Entry)
#else // !defined(_WIN64)
+
+#define ExQueryDepthSList(listhead) (listhead)->Depth
NTKERNELAPI
PSINGLE_LIST_ENTRY
@@ -1946,30 +2087,17 @@
InterlockedPushEntrySList(_ListHead, _ListEntry)
#endif // _WIN2K_COMPAT_SLIST_USAGE
+#endif // !defined(_WIN64)
+
/* ERESOURCE_THREAD
* ExGetCurrentResourceThread(
* VOID);
*/
#define ExGetCurrentResourceThread() ((ERESOURCE_THREAD)PsGetCurrentThread())
-#endif // !defined(_WIN64)
+#define ExReleaseResource(R) (ExReleaseResourceLite(R))
#if (NTDDI_VERSION >= NTDDI_WIN2K)
-
-#if defined(_NTHAL_) && defined(_X86_)
-#define ExAcquireFastMutex ExiAcquireFastMutex
-#define ExReleaseFastMutex ExiReleaseFastMutex
-#define ExTryToAcquireFastMutex ExiTryToAcquireFastMutex
-#endif
-
-#if defined(_X86_)
-#define ExInterlockedAddUlong ExfInterlockedAddUlong
-#define ExInterlockedInsertHeadList ExfInterlockedInsertHeadList
-#define ExInterlockedInsertTailList ExfInterlockedInsertTailList
-#define ExInterlockedRemoveHeadList ExfInterlockedRemoveHeadList
-#define ExInterlockedPopEntryList ExfInterlockedPopEntryList
-#define ExInterlockedPushEntryList ExfInterlockedPushEntryList
-#endif
NTKERNELAPI
VOID
Modified: trunk/reactos/include/ddk/winddk.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/winddk.h?rev=3…
==============================================================================
--- trunk/reactos/include/ddk/winddk.h [iso-8859-1] (original)
+++ trunk/reactos/include/ddk/winddk.h [iso-8859-1] Tue Feb 10 10:11:13 2009
@@ -5786,119 +5786,6 @@
} PCIBUSDATA, *PPCIBUSDATA;
-/** INTERLOCKED FUNCTIONS *****************************************************/
-
-#if !defined(__INTERLOCKED_DECLARED)
-#define __INTERLOCKED_DECLARED
-
-#if defined (_X86_)
-#if defined(NO_INTERLOCKED_INTRINSICS)
-NTKERNELAPI
-LONG
-FASTCALL
-InterlockedIncrement(
- IN OUT LONG volatile *Addend);
-
-NTKERNELAPI
-LONG
-FASTCALL
-InterlockedDecrement(
- IN OUT LONG volatile *Addend);
-
-NTKERNELAPI
-LONG
-FASTCALL
-InterlockedCompareExchange(
- IN OUT LONG volatile *Destination,
- IN LONG Exchange,
- IN LONG Comparand);
-
-NTKERNELAPI
-LONG
-FASTCALL
-InterlockedExchange(
- IN OUT LONG volatile *Destination,
- IN LONG Value);
-
-NTKERNELAPI
-LONG
-FASTCALL
-InterlockedExchangeAdd(
- IN OUT LONG volatile *Addend,
- IN LONG Value);
-
-#else // !defined(NO_INTERLOCKED_INTRINSICS)
-
-#define InterlockedExchange _InterlockedExchange
-#define InterlockedIncrement _InterlockedIncrement
-#define InterlockedDecrement _InterlockedDecrement
-#define InterlockedExchangeAdd _InterlockedExchangeAdd
-#define InterlockedCompareExchange _InterlockedCompareExchange
-#define InterlockedOr _InterlockedOr
-#define InterlockedAnd _InterlockedAnd
-#define InterlockedXor _InterlockedXor
-
-#endif // !defined(NO_INTERLOCKED_INTRINSICS)
-
-#endif // defined (_X86_)
-
-#if !defined (_WIN64)
-/*
- * PVOID
- * InterlockedExchangePointer(
- * IN OUT PVOID VOLATILE *Target,
- * IN PVOID Value)
- */
-#define InterlockedExchangePointer(Target, Value) \
- ((PVOID) InterlockedExchange((PLONG) Target, (LONG) Value))
-
-/*
- * PVOID
- * InterlockedCompareExchangePointer(
- * IN OUT PVOID *Destination,
- * IN PVOID Exchange,
- * IN PVOID Comparand)
- */
-#define InterlockedCompareExchangePointer(Destination, Exchange, Comparand) \
- ((PVOID) InterlockedCompareExchange((PLONG) Destination, (LONG) Exchange, (LONG)
Comparand))
-
-#define InterlockedExchangeAddSizeT(a, b) InterlockedExchangeAdd((LONG *)a, b)
-#define InterlockedIncrementSizeT(a) InterlockedIncrement((LONG *)a)
-#define InterlockedDecrementSizeT(a) InterlockedDecrement((LONG *)a)
-
-#endif // !defined (_WIN64)
-
-#if defined (_M_AMD64)
-
-#define InterlockedExchangeAddSizeT(a, b) InterlockedExchangeAdd64((LONGLONG *)a,
(LONGLONG)b)
-#define InterlockedIncrementSizeT(a) InterlockedIncrement64((LONGLONG *)a)
-#define InterlockedDecrementSizeT(a) InterlockedDecrement64((LONGLONG *)a)
-#define InterlockedAnd _InterlockedAnd
-#define InterlockedOr _InterlockedOr
-#define InterlockedXor _InterlockedXor
-#define InterlockedIncrement _InterlockedIncrement
-#define InterlockedDecrement _InterlockedDecrement
-#define InterlockedAdd _InterlockedAdd
-#define InterlockedExchange _InterlockedExchange
-#define InterlockedExchangeAdd _InterlockedExchangeAdd
-#define InterlockedCompareExchange _InterlockedCompareExchange
-#define InterlockedAnd64 _InterlockedAnd64
-#define InterlockedOr64 _InterlockedOr64
-#define InterlockedXor64 _InterlockedXor64
-#define InterlockedIncrement64 _InterlockedIncrement64
-#define InterlockedDecrement64 _InterlockedDecrement64
-#define InterlockedAdd64 _InterlockedAdd64
-#define InterlockedExchange64 _InterlockedExchange64
-#define InterlockedExchangeAdd64 _InterlockedExchangeAdd64
-#define InterlockedCompareExchange64 _InterlockedCompareExchange64
-#define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer
-#define InterlockedExchangePointer _InterlockedExchangePointer
-
-#endif // _M_AMD64
-
-#endif /* !__INTERLOCKED_DECLARED */
-
-
/** SPINLOCK FUNCTIONS ********************************************************/
NTKERNELAPI
Modified: trunk/reactos/include/ddk/winnt4.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/winnt4.h?rev=3…
==============================================================================
--- trunk/reactos/include/ddk/winnt4.h [iso-8859-1] (original)
+++ trunk/reactos/include/ddk/winnt4.h [iso-8859-1] Tue Feb 10 10:11:13 2009
@@ -140,12 +140,6 @@
IN PZONE_HEADER Zone,
IN PVOID Object);
-NTKERNELAPI
-VOID
-NTAPI
-ExReleaseResource(
- IN PERESOURCE Resource);
-
#define ExAcquireResourceExclusive ExAcquireResourceExclusiveLite
#define ExAcquireResourceShared ExAcquireResourceSharedLite
#define ExConvertExclusiveToShared ExConvertExclusiveToSharedLite