X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=ntoskrnl%2Fex%2Frundown.c;h=3b24f5e8befbb8eb33c1d02cf03839e6bf2da11b;hp=94a2696286735bfac6bbad7145726c376c7e7ed3;hb=afb2214154886d3717bbb0c9b7623603262c6e5a;hpb=010b9b5469377fbddf2d632de9a3945d7e522643 diff --git a/ntoskrnl/ex/rundown.c b/ntoskrnl/ex/rundown.c index 94a26962867..3b24f5e8bef 100644 --- a/ntoskrnl/ex/rundown.c +++ b/ntoskrnl/ex/rundown.c @@ -384,29 +384,10 @@ BOOLEAN FASTCALL ExfAcquireRundownProtectionCacheAware(IN PEX_RUNDOWN_REF_CACHE_AWARE RunRefCacheAware) { - ULONG Value; - BOOLEAN Acquired; PEX_RUNDOWN_REF RunRef; - RunRef = (PEX_RUNDOWN_REF)((ULONG_PTR)RunRefCacheAware->RunRefs + - RunRefCacheAware->RunRefSize * - (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; + RunRef = ExGetRunRefForCurrentProcessor(RunRefCacheAware); + return _ExAcquireRundownProtection(RunRef); } /* @@ -430,27 +411,10 @@ VOID FASTCALL ExfReleaseRundownProtectionCacheAware(IN PEX_RUNDOWN_REF_CACHE_AWARE RunRefCacheAware) { - ULONG Value; PEX_RUNDOWN_REF RunRef; - RunRef = (PEX_RUNDOWN_REF)((ULONG_PTR)RunRefCacheAware->RunRefs + - RunRefCacheAware->RunRefSize * - (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); - } + RunRef = ExGetRunRefForCurrentProcessor(RunRefCacheAware); + return _ExReleaseRundownProtection(RunRef); } /*