mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 17:12:57 +00:00
[NTOSKRNL] Simplify implementation of ExfAcquireRundownProtectionCacheAware(), ExfReleaseRundownProtectionCacheAware()
This commit is contained in:
parent
010b9b5469
commit
afb2214154
1 changed files with 4 additions and 40 deletions
|
@ -384,29 +384,10 @@ BOOLEAN
|
||||||
FASTCALL
|
FASTCALL
|
||||||
ExfAcquireRundownProtectionCacheAware(IN PEX_RUNDOWN_REF_CACHE_AWARE RunRefCacheAware)
|
ExfAcquireRundownProtectionCacheAware(IN PEX_RUNDOWN_REF_CACHE_AWARE RunRefCacheAware)
|
||||||
{
|
{
|
||||||
ULONG Value;
|
|
||||||
BOOLEAN Acquired;
|
|
||||||
PEX_RUNDOWN_REF RunRef;
|
PEX_RUNDOWN_REF RunRef;
|
||||||
|
|
||||||
RunRef = (PEX_RUNDOWN_REF)((ULONG_PTR)RunRefCacheAware->RunRefs +
|
RunRef = ExGetRunRefForCurrentProcessor(RunRefCacheAware);
|
||||||
RunRefCacheAware->RunRefSize *
|
return _ExAcquireRundownProtection(RunRef);
|
||||||
(KeGetCurrentProcessorNumber() % RunRefCacheAware->Number));
|
|
||||||
|
|
||||||
/* Get current value */
|
|
||||||
Value = RunRef->Count & !EX_RUNDOWN_ACTIVE;
|
|
||||||
/* Try to acquire the quick way if already active */
|
|
||||||
if (ExpChangeRundown(RunRef,
|
|
||||||
((RunRef->Count & !EX_RUNDOWN_ACTIVE) + EX_RUNDOWN_COUNT_INC),
|
|
||||||
Value) == Value)
|
|
||||||
{
|
|
||||||
Acquired = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Acquired = ExfAcquireRundownProtection(RunRef);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Acquired;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -430,27 +411,10 @@ VOID
|
||||||
FASTCALL
|
FASTCALL
|
||||||
ExfReleaseRundownProtectionCacheAware(IN PEX_RUNDOWN_REF_CACHE_AWARE RunRefCacheAware)
|
ExfReleaseRundownProtectionCacheAware(IN PEX_RUNDOWN_REF_CACHE_AWARE RunRefCacheAware)
|
||||||
{
|
{
|
||||||
ULONG Value;
|
|
||||||
PEX_RUNDOWN_REF RunRef;
|
PEX_RUNDOWN_REF RunRef;
|
||||||
|
|
||||||
RunRef = (PEX_RUNDOWN_REF)((ULONG_PTR)RunRefCacheAware->RunRefs +
|
RunRef = ExGetRunRefForCurrentProcessor(RunRefCacheAware);
|
||||||
RunRefCacheAware->RunRefSize *
|
return _ExReleaseRundownProtection(RunRef);
|
||||||
(KeGetCurrentProcessorNumber() % RunRefCacheAware->Number));
|
|
||||||
|
|
||||||
/* Get current value */
|
|
||||||
Value = RunRef->Count & !EX_RUNDOWN_ACTIVE;
|
|
||||||
/* Try to release the quick way if multiple actived */
|
|
||||||
if (ExpChangeRundown(RunRef,
|
|
||||||
((RunRef->Count & !EX_RUNDOWN_ACTIVE) - EX_RUNDOWN_COUNT_INC),
|
|
||||||
Value) == Value)
|
|
||||||
{
|
|
||||||
/* Sanity check */
|
|
||||||
ASSERT((Value >= EX_RUNDOWN_COUNT_INC) || (KeNumberProcessors > 1));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ExfReleaseRundownProtection(RunRef);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue