{
PEX_RUNDOWN_REF RunRef;
- RunRef = ExGetRunRefForCurrentProcessor(RunRefCacheAware);
+ RunRef = ExGetRunRefForGivenProcessor(RunRefCacheAware, KeGetCurrentProcessorNumber());
return _ExAcquireRundownProtection(RunRef);
}
{
PEX_RUNDOWN_REF RunRef;
- RunRef = ExGetRunRefForCurrentProcessor(RunRefCacheAware);
+ RunRef = ExGetRunRefForGivenProcessor(RunRefCacheAware, KeGetCurrentProcessorNumber());
return ExfAcquireRundownProtectionEx(RunRef, Count);
}
{
PEX_RUNDOWN_REF RunRef;
- RunRef = ExGetRunRefForCurrentProcessor(RunRefCacheAware);
+ RunRef = ExGetRunRefForGivenProcessor(RunRefCacheAware, KeGetCurrentProcessorNumber());
return _ExReleaseRundownProtection(RunRef);
}
{
PEX_RUNDOWN_REF RunRef;
- RunRef = ExGetRunRefForCurrentProcessor(RunRefCacheAware);
+ RunRef = ExGetRunRefForGivenProcessor(RunRefCacheAware, KeGetCurrentProcessorNumber());
return ExfReleaseRundownProtectionEx(RunRef, Count);
}
for (Current = 0; Current < ProcCount; ++Current)
{
/* Get the runref for the proc */
- RunRef = (PEX_RUNDOWN_REF)((ULONG_PTR)RunRefCacheAware->RunRefs +
- RunRefCacheAware->RunRefSize *
- (Current % RunRefCacheAware->Number));
-
+ RunRef = ExGetRunRefForGivenProcessor(RunRefCacheAware, Current);
/* Loop for setting the wait block */
do
{
{
PEX_RUNDOWN_REF RunRef;
PVOID PoolToFree, RunRefs;
- ULONG RunRefSize, Count, Offset, Align;
+ ULONG RunRefSize, Count, Align;
PEX_RUNDOWN_REF_CACHE_AWARE RunRefCacheAware;
PAGED_CODE();
{
for (Count = 0; Count < RunRefCacheAware->Number; ++Count)
{
- Offset = RunRefCacheAware->RunRefSize * Count;
- RunRef = (PEX_RUNDOWN_REF)((ULONG_PTR)RunRefCacheAware->RunRefs + Offset);
+ RunRef = ExGetRunRefForGivenProcessor(RunRefCacheAware, Count);
_ExInitializeRundownProtection(RunRef);
}
}
{
PVOID Pool;
PEX_RUNDOWN_REF RunRef;
- ULONG Count, RunRefSize, Offset, Align;
+ ULONG Count, RunRefSize, Align;
PAGED_CODE();
{
for (Count = 0; Count < RunRefCacheAware->Number; ++Count)
{
- Offset = RunRefCacheAware->RunRefSize * Count;
- RunRef = (PEX_RUNDOWN_REF)((ULONG_PTR)RunRefCacheAware->RunRefs + Offset);
+ RunRef = ExGetRunRefForGivenProcessor(RunRefCacheAware, Count);
_ExInitializeRundownProtection(RunRef);
}
}
return (ULONG)FastRef.RefCnt;
}
-FORCEINLINE
-PEX_RUNDOWN_REF
-ExGetRunRefForCurrentProcessor(IN PEX_RUNDOWN_REF_CACHE_AWARE RunRefCacheAware)
-{
- return (PEX_RUNDOWN_REF)((ULONG_PTR)RunRefCacheAware->RunRefs +
- RunRefCacheAware->RunRefSize *
- (KeGetCurrentProcessorNumber() % RunRefCacheAware->Number));
-}
-
FORCEINLINE
VOID
ExInitializeFastReference(OUT PEX_FAST_REF FastRef,
/* RUNDOWN *******************************************************************/
+FORCEINLINE
+PEX_RUNDOWN_REF
+ExGetRunRefForGivenProcessor(IN PEX_RUNDOWN_REF_CACHE_AWARE RunRefCacheAware,
+ IN ULONG ProcNumber)
+{
+ return (PEX_RUNDOWN_REF)((ULONG_PTR)RunRefCacheAware->RunRefs +
+ RunRefCacheAware->RunRefSize *
+ (ProcNumber % RunRefCacheAware->Number));
+}
+
/*++
* @name ExfAcquireRundownProtection
* INTERNAL MACRO