mirror of
https://github.com/reactos/reactos.git
synced 2025-06-22 20:30:18 +00:00
[NTOSKRNL]
Make definitions of ExpChangeRundown, ExpChangePushlock and ExpSetRundown 64 bit safe (have one portable definition and use it accordingly) svn path=/trunk/; revision=50152
This commit is contained in:
parent
0093430c81
commit
e8fc5482a0
2 changed files with 46 additions and 52 deletions
|
@ -145,7 +145,7 @@ ExfReInitializeRundownProtection(IN PEX_RUNDOWN_REF RunRef)
|
|||
ASSERT((RunRef->Count & EX_RUNDOWN_ACTIVE) != 0);
|
||||
|
||||
/* Reset the count */
|
||||
ExpSetRundown(&RunRef->Count, 0);
|
||||
ExpSetRundown(RunRef, 0);
|
||||
}
|
||||
|
||||
/*++
|
||||
|
@ -173,7 +173,7 @@ ExfRundownCompleted(IN PEX_RUNDOWN_REF RunRef)
|
|||
ASSERT((RunRef->Count & EX_RUNDOWN_ACTIVE) != 0);
|
||||
|
||||
/* Mark the counter as active */
|
||||
ExpSetRundown(&RunRef->Count, EX_RUNDOWN_ACTIVE);
|
||||
ExpSetRundown(RunRef, EX_RUNDOWN_ACTIVE);
|
||||
}
|
||||
|
||||
/*++
|
||||
|
@ -359,7 +359,7 @@ ExfWaitForRundownProtectionRelease(IN PEX_RUNDOWN_REF RunRef)
|
|||
WaitBlock.Count = Count;
|
||||
|
||||
/* Now set the pointer */
|
||||
NewValue = ExpChangeRundown(RunRef, PtrToUlong(WaitBlockPointer), Value);
|
||||
NewValue = ExpChangeRundown(RunRef, (ULONG_PTR)WaitBlockPointer, Value);
|
||||
if (NewValue == Value) break;
|
||||
|
||||
/* Loop again */
|
||||
|
|
|
@ -119,15 +119,9 @@ typedef struct
|
|||
|
||||
#endif
|
||||
|
||||
#ifdef _WIN64
|
||||
#define ExpChangeRundown(x, y, z) InterlockedCompareExchange64((PLONGLONG)x, y, z)
|
||||
#define ExpChangeRundown(x, y, z) (ULONG_PTR)InterlockedCompareExchangePointer(&x->Ptr, (PVOID)y, (PVOID)z)
|
||||
#define ExpChangePushlock(x, y, z) InterlockedCompareExchangePointer((PVOID*)x, (PVOID)y, (PVOID)z)
|
||||
#define ExpSetRundown(x, y) InterlockedExchange64((PLONGLONG)x, y)
|
||||
#else
|
||||
#define ExpChangeRundown(x, y, z) PtrToUlong(InterlockedCompareExchange((PLONG)x, PtrToLong(y), PtrToLong(z)))
|
||||
#define ExpChangePushlock(x, y, z) LongToPtr(InterlockedCompareExchange((PLONG)x, PtrToLong(y), PtrToLong(z)))
|
||||
#define ExpSetRundown(x, y) InterlockedExchange((PLONG)x, y)
|
||||
#endif
|
||||
#define ExpSetRundown(x, y) InterlockedExchangePointer(&x->Ptr, (PVOID)y)
|
||||
|
||||
/* INITIALIZATION FUNCTIONS *************************************************/
|
||||
|
||||
|
@ -849,7 +843,7 @@ _ExRundownCompleted(IN PEX_RUNDOWN_REF RunRef)
|
|||
ASSERT((RunRef->Count & EX_RUNDOWN_ACTIVE) != 0);
|
||||
|
||||
/* Mark the counter as active */
|
||||
ExpSetRundown(&RunRef->Count, EX_RUNDOWN_ACTIVE);
|
||||
ExpSetRundown(RunRef, EX_RUNDOWN_ACTIVE);
|
||||
}
|
||||
|
||||
/* PUSHLOCKS *****************************************************************/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue