mirror of
https://github.com/reactos/reactos.git
synced 2024-09-30 14:37:45 +00:00
[NTOSKRNL] Replace ExGetRunRefForCurrentProcessor() by a more generic function
This commit is contained in:
parent
7e849470af
commit
fed61c6305
|
@ -387,7 +387,7 @@ ExfAcquireRundownProtectionCacheAware(IN PEX_RUNDOWN_REF_CACHE_AWARE RunRefCache
|
||||||
{
|
{
|
||||||
PEX_RUNDOWN_REF RunRef;
|
PEX_RUNDOWN_REF RunRef;
|
||||||
|
|
||||||
RunRef = ExGetRunRefForCurrentProcessor(RunRefCacheAware);
|
RunRef = ExGetRunRefForGivenProcessor(RunRefCacheAware, KeGetCurrentProcessorNumber());
|
||||||
return _ExAcquireRundownProtection(RunRef);
|
return _ExAcquireRundownProtection(RunRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,7 +401,7 @@ ExfAcquireRundownProtectionCacheAwareEx(IN PEX_RUNDOWN_REF_CACHE_AWARE RunRefCac
|
||||||
{
|
{
|
||||||
PEX_RUNDOWN_REF RunRef;
|
PEX_RUNDOWN_REF RunRef;
|
||||||
|
|
||||||
RunRef = ExGetRunRefForCurrentProcessor(RunRefCacheAware);
|
RunRef = ExGetRunRefForGivenProcessor(RunRefCacheAware, KeGetCurrentProcessorNumber());
|
||||||
return ExfAcquireRundownProtectionEx(RunRef, Count);
|
return ExfAcquireRundownProtectionEx(RunRef, Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -414,7 +414,7 @@ ExfReleaseRundownProtectionCacheAware(IN PEX_RUNDOWN_REF_CACHE_AWARE RunRefCache
|
||||||
{
|
{
|
||||||
PEX_RUNDOWN_REF RunRef;
|
PEX_RUNDOWN_REF RunRef;
|
||||||
|
|
||||||
RunRef = ExGetRunRefForCurrentProcessor(RunRefCacheAware);
|
RunRef = ExGetRunRefForGivenProcessor(RunRefCacheAware, KeGetCurrentProcessorNumber());
|
||||||
return _ExReleaseRundownProtection(RunRef);
|
return _ExReleaseRundownProtection(RunRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,7 +428,7 @@ ExfReleaseRundownProtectionCacheAwareEx(IN PEX_RUNDOWN_REF_CACHE_AWARE RunRefCac
|
||||||
{
|
{
|
||||||
PEX_RUNDOWN_REF RunRef;
|
PEX_RUNDOWN_REF RunRef;
|
||||||
|
|
||||||
RunRef = ExGetRunRefForCurrentProcessor(RunRefCacheAware);
|
RunRef = ExGetRunRefForGivenProcessor(RunRefCacheAware, KeGetCurrentProcessorNumber());
|
||||||
return ExfReleaseRundownProtectionEx(RunRef, Count);
|
return ExfReleaseRundownProtectionEx(RunRef, Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,10 +459,7 @@ ExfWaitForRundownProtectionReleaseCacheAware(IN PEX_RUNDOWN_REF_CACHE_AWARE RunR
|
||||||
for (Current = 0; Current < ProcCount; ++Current)
|
for (Current = 0; Current < ProcCount; ++Current)
|
||||||
{
|
{
|
||||||
/* Get the runref for the proc */
|
/* Get the runref for the proc */
|
||||||
RunRef = (PEX_RUNDOWN_REF)((ULONG_PTR)RunRefCacheAware->RunRefs +
|
RunRef = ExGetRunRefForGivenProcessor(RunRefCacheAware, Current);
|
||||||
RunRefCacheAware->RunRefSize *
|
|
||||||
(Current % RunRefCacheAware->Number));
|
|
||||||
|
|
||||||
/* Loop for setting the wait block */
|
/* Loop for setting the wait block */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -535,7 +532,7 @@ ExAllocateCacheAwareRundownProtection(IN POOL_TYPE PoolType,
|
||||||
{
|
{
|
||||||
PEX_RUNDOWN_REF RunRef;
|
PEX_RUNDOWN_REF RunRef;
|
||||||
PVOID PoolToFree, RunRefs;
|
PVOID PoolToFree, RunRefs;
|
||||||
ULONG RunRefSize, Count, Offset, Align;
|
ULONG RunRefSize, Count, Align;
|
||||||
PEX_RUNDOWN_REF_CACHE_AWARE RunRefCacheAware;
|
PEX_RUNDOWN_REF_CACHE_AWARE RunRefCacheAware;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
@ -601,8 +598,7 @@ ExAllocateCacheAwareRundownProtection(IN POOL_TYPE PoolType,
|
||||||
{
|
{
|
||||||
for (Count = 0; Count < RunRefCacheAware->Number; ++Count)
|
for (Count = 0; Count < RunRefCacheAware->Number; ++Count)
|
||||||
{
|
{
|
||||||
Offset = RunRefCacheAware->RunRefSize * Count;
|
RunRef = ExGetRunRefForGivenProcessor(RunRefCacheAware, Count);
|
||||||
RunRef = (PEX_RUNDOWN_REF)((ULONG_PTR)RunRefCacheAware->RunRefs + Offset);
|
|
||||||
_ExInitializeRundownProtection(RunRef);
|
_ExInitializeRundownProtection(RunRef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -641,7 +637,7 @@ ExInitializeRundownProtectionCacheAware(IN PEX_RUNDOWN_REF_CACHE_AWARE RunRefCac
|
||||||
{
|
{
|
||||||
PVOID Pool;
|
PVOID Pool;
|
||||||
PEX_RUNDOWN_REF RunRef;
|
PEX_RUNDOWN_REF RunRef;
|
||||||
ULONG Count, RunRefSize, Offset, Align;
|
ULONG Count, RunRefSize, Align;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
@ -683,8 +679,7 @@ ExInitializeRundownProtectionCacheAware(IN PEX_RUNDOWN_REF_CACHE_AWARE RunRefCac
|
||||||
{
|
{
|
||||||
for (Count = 0; Count < RunRefCacheAware->Number; ++Count)
|
for (Count = 0; Count < RunRefCacheAware->Number; ++Count)
|
||||||
{
|
{
|
||||||
Offset = RunRefCacheAware->RunRefSize * Count;
|
RunRef = ExGetRunRefForGivenProcessor(RunRefCacheAware, Count);
|
||||||
RunRef = (PEX_RUNDOWN_REF)((ULONG_PTR)RunRefCacheAware->RunRefs + Offset);
|
|
||||||
_ExInitializeRundownProtection(RunRef);
|
_ExInitializeRundownProtection(RunRef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -545,15 +545,6 @@ ExGetCountFastReference(IN EX_FAST_REF FastRef)
|
||||||
return (ULONG)FastRef.RefCnt;
|
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
|
FORCEINLINE
|
||||||
VOID
|
VOID
|
||||||
ExInitializeFastReference(OUT PEX_FAST_REF FastRef,
|
ExInitializeFastReference(OUT PEX_FAST_REF FastRef,
|
||||||
|
@ -751,6 +742,16 @@ ExCompareSwapFastReference(IN PEX_FAST_REF FastRef,
|
||||||
|
|
||||||
/* RUNDOWN *******************************************************************/
|
/* 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
|
* @name ExfAcquireRundownProtection
|
||||||
* INTERNAL MACRO
|
* INTERNAL MACRO
|
||||||
|
|
Loading…
Reference in a new issue