Sync to trunk head (r42241)
[reactos.git] / reactos / ntoskrnl / ex / fastinterlck.c
index 4edcec9..c247bec 100644 (file)
@@ -8,7 +8,7 @@
 
 /* INCLUDES *******************************************************************/
 
-#if defined(_ARM_) || defined(_PPC_) || defined(_M_AMD64) || defined(NTOS_USE_GENERICS)
+#if defined(_ARM_) || defined(_PPC_) || defined(NTOS_USE_GENERICS)
 
 #include <ntoskrnl.h>
 #define NDEBUG
@@ -19,6 +19,7 @@
 #undef ExInterlockedAddULong
 #undef ExInterlockedIncrementLong
 #undef ExInterlockedDecrementLong
+#undef ExInterlockedAddLargeStatistic
 
 /* FUNCTIONS ******************************************************************/
 
@@ -36,9 +37,9 @@ InterlockedPushEntrySList(IN PSLIST_HEADER ListHead,
     {
         Entry->Next = FirstEntry;
         NextEntry = FirstEntry;
-        FirstEntry = (PVOID)_InterlockedCompareExchange((PLONG)Head,
-                                                        (LONG)Entry,
-                                                        (LONG)FirstEntry);
+        FirstEntry = InterlockedCompareExchangePointer((PVOID*)Head,
+                                                       (PVOID)Entry,
+                                                       (PVOID)FirstEntry);
     } while (FirstEntry != NextEntry);
     
     return FirstEntry;
@@ -56,9 +57,9 @@ InterlockedPopEntrySList(IN PSLIST_HEADER ListHead)
         if (!FirstEntry) return NULL;
 
         NextEntry = FirstEntry;
-        FirstEntry = (PVOID)_InterlockedCompareExchange((PLONG)Head,
-                                                        (LONG)FirstEntry->Next,
-                                                        (LONG)FirstEntry);
+        FirstEntry = InterlockedCompareExchangePointer((PVOID*)Head,
+                                                       (PVOID)FirstEntry->Next,
+                                                       (PVOID)FirstEntry);
     } while (FirstEntry != NextEntry);
 
     return FirstEntry;    
@@ -68,7 +69,7 @@ PSINGLE_LIST_ENTRY
 FASTCALL
 ExInterlockedFlushSList(IN PSLIST_HEADER ListHead)
 {
-    return (PVOID)_InterlockedExchange((PLONG)&ListHead->Next.Next, (LONG)NULL);
+    return InterlockedExchangePointer((PVOID*)&ListHead->Next.Next, NULL);
 }
 
 PSLIST_ENTRY
@@ -288,7 +289,7 @@ ExInterlockedRemoveHeadList(IN PLIST_ENTRY ListHead,
 
 VOID
 FASTCALL
-ExInterlockedAddLargeStatistic(IN PLARGE_INTEGER Addend,
+ExInterlockedAddLargeStatistic(IN PLONGLONG Addend,
                                IN ULONG Increment)
 {
     UNIMPLEMENTED;
@@ -296,7 +297,7 @@ ExInterlockedAddLargeStatistic(IN PLARGE_INTEGER Addend,
 
 LONGLONG
 FASTCALL
-ExInterlockedCompareExchange64(IN OUT PLONGLONG Destination,
+ExInterlockedCompareExchange64(IN OUT LONGLONG volatile *Destination,
                                IN PLONGLONG Exchange,
                                IN PLONGLONG Comparand,
                                IN PKSPIN_LOCK Lock)
@@ -311,7 +312,6 @@ ExInterlockedCompareExchange64(IN OUT PLONGLONG Destination,
     return Result;
 }
 
-#ifndef _M_AMD64
 VOID
 NTAPI
 READ_REGISTER_BUFFER_UCHAR(IN PUCHAR Register,
@@ -455,6 +455,5 @@ WRITE_REGISTER_USHORT(IN PUSHORT Register,
     *(volatile USHORT * const)Register = Value;
     KeFlushWriteBuffer();  
 }
-#endif // !_M_AMD64
 
 #endif