#include <ntoskrnl.h>
#include <debug.h>
Go to the source code of this file.
◆ NDEBUG
◆ ExAllocateCacheAwareRundownProtection()
Definition at line 562 of file rundown.c.
564{
566 PVOID PoolToFree, RunRefs;
569
571
572
574 if (RunRefCacheAware ==
NULL)
575 {
577 }
578
579
582 {
584 }
585 else
586 {
590 }
591
592
595
596
598 if (PoolToFree ==
NULL)
599 {
602 }
603
604
606 {
607
609
610
612 if (PoolToFree ==
NULL)
613 {
616 }
617
619 }
620 else
621 {
622 RunRefs = PoolToFree;
623 }
624
625 RunRefCacheAware->
RunRefs = RunRefs;
627
628
629 if (RunRefCacheAware->
Number != 0)
630 {
632 {
635 }
636 }
637
638 return RunRefCacheAware;
639}
#define ALIGN_UP_BY(size, align)
#define ExAllocatePoolWithTag(hernya, size, tag)
FORCEINLINE VOID _ExInitializeRundownProtection(IN PEX_RUNDOWN_REF RunRef)
FORCEINLINE PEX_RUNDOWN_REF ExGetRunRefForGivenProcessor(IN PEX_RUNDOWN_REF_CACHE_AWARE RunRefCacheAware, IN ULONG ProcNumber)
#define ExFreePoolWithTag(_P, _T)
ULONG NTAPI KeGetRecommendedSharedDataAlignment(VOID)
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
struct _EX_RUNDOWN_REF EX_RUNDOWN_REF
◆ ExfAcquireRundownProtection()
Definition at line 36 of file rundown.c.
37{
39
40
41 for (;;)
42 {
43
45
46
48
49
52
53
55 }
56}
#define ExpChangeRundown(x, y, z)
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
#define EX_RUNDOWN_COUNT_INC
#define EX_RUNDOWN_ACTIVE
◆ ExfAcquireRundownProtectionCacheAware()
Definition at line 384 of file rundown.c.
385{
387
390}
FORCEINLINE BOOLEAN _ExAcquireRundownProtection(IN PEX_RUNDOWN_REF RunRef)
FORCEINLINE ULONG KeGetCurrentProcessorNumber(VOID)
◆ ExfAcquireRundownProtectionCacheAwareEx()
Definition at line 397 of file rundown.c.
399{
401
404}
BOOLEAN FASTCALL ExfAcquireRundownProtectionEx(IN PEX_RUNDOWN_REF RunRef, IN ULONG Count)
◆ ExfAcquireRundownProtectionEx()
◆ ExfInitializeRundownProtection()
Definition at line 118 of file rundown.c.
119{
120
121 RunRef->Count = 0;
122}
◆ ExFreeCacheAwareRundownProtection()
Definition at line 646 of file rundown.c.
647{
649
650
651
652
653
654
655 ASSERT(RunRefCacheAware->PoolToFree != (
PVOID)0xBADCA11);
656
657
660}
◆ ExfReInitializeRundownProtection()
Definition at line 141 of file rundown.c.
142{
144
145
147
148
150}
#define ExpSetRundown(x, y)
◆ ExfReInitializeRundownProtectionCacheAware()
Definition at line 534 of file rundown.c.
535{
537 ULONG ProcCount, Current;
538
539 ProcCount = RunRefCacheAware->Number;
540
541 if (ProcCount == 0)
542 {
543 return;
544 }
545
546
547 for (Current = 0; Current < ProcCount; ++Current)
548 {
549
552
554 }
555}
◆ ExfReleaseRundownProtection()
Definition at line 197 of file rundown.c.
198{
201
202
203 for (;;)
204 {
205
207 {
208
210
211
213
214
216 if (NewValue ==
Value)
break;
217
218
220 }
221 else
222 {
223
226
227
229 {
230
232 }
233
234
235 break;
236 }
237 }
238}
#define KeSetEvent(pEvt, foo, foo2)
#define InterlockedDecrementSizeT(a)
struct _EX_RUNDOWN_WAIT_BLOCK * PEX_RUNDOWN_WAIT_BLOCK
◆ ExfReleaseRundownProtectionCacheAware()
Definition at line 411 of file rundown.c.
412{
414
417}
FORCEINLINE VOID _ExReleaseRundownProtection(IN PEX_RUNDOWN_REF RunRef)
◆ ExfReleaseRundownProtectionCacheAwareEx()
Definition at line 424 of file rundown.c.
426{
428
431}
VOID FASTCALL ExfReleaseRundownProtectionEx(IN PEX_RUNDOWN_REF RunRef, IN ULONG Count)
◆ ExfReleaseRundownProtectionEx()
◆ ExfRundownCompleted()
Definition at line 169 of file rundown.c.
170{
172
173
175
176
178}
◆ ExfRundownCompletedCacheAware()
Definition at line 506 of file rundown.c.
507{
509 ULONG ProcCount, Current;
510
511 ProcCount = RunRefCacheAware->Number;
512
513 if (ProcCount == 0)
514 {
515 return;
516 }
517
518
519 for (Current = 0; Current < ProcCount; ++Current)
520 {
521
524
526 }
527}
◆ ExfWaitForRundownProtectionRelease()
Definition at line 324 of file rundown.c.
325{
331
332
335
336
340
341
342 for (;;)
343 {
344
346
347
349 {
350
354
355
357 }
358
359
361
362
364 if (NewValue ==
Value)
break;
365
366
369 }
370
371
373
374
377}
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
#define KeInitializeEvent(pEvt, foo, foo2)
#define EX_RUNDOWN_COUNT_SHIFT
◆ ExfWaitForRundownProtectionReleaseCacheAware()
Definition at line 438 of file rundown.c.
439{
444
445 ProcCount = RunRefCacheAware->Number;
446
447 if (ProcCount == 0)
448 {
449 return;
450 }
451
452 TotalCount = 0;
456
457 for (Current = 0; Current < ProcCount; ++Current)
458 {
459
461
462 do
463 {
466
467
469 if (OldValue ==
Value)
470 {
471 break;
472 }
473
475 }
477
478
480 }
481
482
484 if (TotalCount != 0)
485 {
486
490
491
495 {
497 }
498 }
499}
◆ ExInitializeRundownProtectionCacheAware()
Definition at line 667 of file rundown.c.
669{
673
675
676
678
679
681
682
683
684
685
687 {
689 }
690 else
691 {
692
694
695
699 }
700
701
702 RunRefCacheAware->RunRefs =
Pool;
704 RunRefCacheAware->Number =
Count;
705
706
707 RunRefCacheAware->PoolToFree = (
PVOID)0xBADCA11u;
708
709
710 if (RunRefCacheAware->Number != 0)
711 {
713 {
716 }
717 }
718}
struct _EX_RUNDOWN_REF_CACHE_AWARE EX_RUNDOWN_REF_CACHE_AWARE
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
◆ ExSizeOfRundownProtectionCacheAware()
Definition at line 725 of file rundown.c.
726{
728
730
731
733 {
735 }
736 else
737 {
738
740 }
741
742
744}