https://git.reactos.org/?p=reactos.git;a=commitdiff;h=da5949280c3c97449ebf0…
commit da5949280c3c97449ebf0776936d62a58e5ed7a0
Author: Thomas Faber <thomas.faber(a)reactos.org>
AuthorDate: Tue Nov 21 23:33:42 2017 +0100
[NTOS:MM] Use inline functions to acquire/release the PFN lock.
---
ntoskrnl/cache/section/data.c | 4 +--
ntoskrnl/cache/section/fault.c | 4 +--
ntoskrnl/include/internal/mm.h | 17 +++++++++++++
ntoskrnl/mm/ARM3/contmem.c | 10 ++++----
ntoskrnl/mm/ARM3/dynamic.c | 4 +--
ntoskrnl/mm/ARM3/i386/init.c | 8 +++---
ntoskrnl/mm/ARM3/mdlsup.c | 34 ++++++++++++-------------
ntoskrnl/mm/ARM3/mminit.c | 12 ++++-----
ntoskrnl/mm/ARM3/pagfault.c | 56 ++++++++++++++++++++--------------------
ntoskrnl/mm/ARM3/pfnlist.c | 28 ++++++++++----------
ntoskrnl/mm/ARM3/pool.c | 4 +--
ntoskrnl/mm/ARM3/procsup.c | 34 ++++++++++++-------------
ntoskrnl/mm/ARM3/section.c | 58 +++++++++++++++++++++---------------------
ntoskrnl/mm/ARM3/session.c | 32 +++++++++++------------
ntoskrnl/mm/ARM3/special.c | 16 ++++++------
ntoskrnl/mm/ARM3/sysldr.c | 4 +--
ntoskrnl/mm/ARM3/virtual.c | 26 +++++++++----------
ntoskrnl/mm/ARM3/zeropage.c | 8 +++---
ntoskrnl/mm/amd64/page.c | 8 +++---
ntoskrnl/mm/balance.c | 6 ++---
ntoskrnl/mm/freelist.c | 50 ++++++++++++++++++------------------
ntoskrnl/mm/marea.c | 8 +++---
ntoskrnl/mm/section.c | 4 +--
23 files changed, 226 insertions(+), 209 deletions(-)
diff --git a/ntoskrnl/cache/section/data.c b/ntoskrnl/cache/section/data.c
index 198787b6e7..1fb0fc20c5 100644
--- a/ntoskrnl/cache/section/data.c
+++ b/ntoskrnl/cache/section/data.c
@@ -192,9 +192,9 @@ _MiFlushMappedSection(PVOID BaseAddress,
(MmIsDirtyPageRmap(Page) || IS_DIRTY_SSE(Entry)) &&
FileOffset.QuadPart < FileSize->QuadPart)
{
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
MmReferencePage(Page);
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
Pages[(PageAddress - BeginningAddress) >> PAGE_SHIFT] = Entry;
}
else
diff --git a/ntoskrnl/cache/section/fault.c b/ntoskrnl/cache/section/fault.c
index 169d436891..c70805a71a 100644
--- a/ntoskrnl/cache/section/fault.c
+++ b/ntoskrnl/cache/section/fault.c
@@ -236,9 +236,9 @@ MmNotPresentFaultCachePage (
KeBugCheck(CACHE_MANAGER);
}
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
MmReferencePage(Page);
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
Status = MmCreateVirtualMapping(Process, Address, Attributes, &Page, 1);
if (NT_SUCCESS(Status))
diff --git a/ntoskrnl/include/internal/mm.h b/ntoskrnl/include/internal/mm.h
index 694c51f1f0..d96900b27e 100644
--- a/ntoskrnl/include/internal/mm.h
+++ b/ntoskrnl/include/internal/mm.h
@@ -868,6 +868,23 @@ MmPageOutPhysicalAddress(PFN_NUMBER Page);
/* freelist.c **********************************************************/
+FORCEINLINE
+KIRQL
+MiAcquirePfnLock(VOID)
+{
+ return KeAcquireQueuedSpinLock(LockQueuePfnLock);
+}
+
+FORCEINLINE
+VOID
+MiReleasePfnLock(
+ _In_ KIRQL OldIrql)
+{
+ KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+}
+
+#define MI_ASSERT_PFN_LOCK_HELD() ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL)
+
FORCEINLINE
PMMPFN
MiGetPfnEntry(IN PFN_NUMBER Pfn)
diff --git a/ntoskrnl/mm/ARM3/contmem.c b/ntoskrnl/mm/ARM3/contmem.c
index b250ebc941..6a7fe01cbd 100644
--- a/ntoskrnl/mm/ARM3/contmem.c
+++ b/ntoskrnl/mm/ARM3/contmem.c
@@ -109,7 +109,7 @@ MiFindContiguousPages(IN PFN_NUMBER LowestPfn,
//
// Acquire the PFN lock
//
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
do
{
//
@@ -164,7 +164,7 @@ MiFindContiguousPages(IN PFN_NUMBER LowestPfn,
//
// Now it's safe to let go of the PFN lock
//
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
//
// Quick sanity check that the last PFN is consistent
@@ -196,7 +196,7 @@ MiFindContiguousPages(IN PFN_NUMBER LowestPfn,
// If we got here, something changed while we hadn't acquired
// the PFN lock yet, so we'll have to restart
//
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
Length = 0;
}
}
@@ -540,7 +540,7 @@ MiFreeContiguousMemory(IN PVOID BaseAddress)
//
// Lock the PFN database
//
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
//
// Loop all the pages
@@ -556,7 +556,7 @@ MiFreeContiguousMemory(IN PVOID BaseAddress)
//
// Release the PFN lock
//
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
}
/* PUBLIC FUNCTIONS ***********************************************************/
diff --git a/ntoskrnl/mm/ARM3/dynamic.c b/ntoskrnl/mm/ARM3/dynamic.c
index dc3469c8a2..d0d3167064 100644
--- a/ntoskrnl/mm/ARM3/dynamic.c
+++ b/ntoskrnl/mm/ARM3/dynamic.c
@@ -91,7 +91,7 @@ MmGetPhysicalMemoryRanges(VOID)
//
// Lock the PFN database
//
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
//
// Make sure it hasn't changed before we had acquired the lock
@@ -121,6 +121,6 @@ MmGetPhysicalMemoryRanges(VOID)
//
// Release the lock and return
//
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
return Buffer;
}
diff --git a/ntoskrnl/mm/ARM3/i386/init.c b/ntoskrnl/mm/ARM3/i386/init.c
index 05c1007d51..58cb5ba03c 100644
--- a/ntoskrnl/mm/ARM3/i386/init.c
+++ b/ntoskrnl/mm/ARM3/i386/init.c
@@ -487,7 +487,7 @@ MiInitMachineDependent(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
StartPde = MiAddressToPde(HYPER_SPACE);
/* Lock PFN database */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
/* Allocate a page for hyperspace and create it */
MI_SET_USAGE(MI_USAGE_PAGE_TABLE);
@@ -501,7 +501,7 @@ MiInitMachineDependent(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
KeFlushCurrentTb();
/* Release the lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
//
// Zero out the page table now
@@ -532,7 +532,7 @@ MiInitMachineDependent(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
MiFirstReservedZeroingPte->u.Hard.PageFrameNumber = MI_ZERO_PTES - 1;
/* Lock PFN database */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
/* Reset the ref/share count so that MmInitializeProcessAddressSpace works */
Pfn1 = MiGetPfnEntry(PFN_FROM_PTE(MiAddressToPde(PDE_BASE)));
@@ -565,7 +565,7 @@ MiInitMachineDependent(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
}
/* Release the lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
/* Initialize the bogus address space */
Flags = 0;
diff --git a/ntoskrnl/mm/ARM3/mdlsup.c b/ntoskrnl/mm/ARM3/mdlsup.c
index 85bbfd1854..7317a9a30f 100644
--- a/ntoskrnl/mm/ARM3/mdlsup.c
+++ b/ntoskrnl/mm/ARM3/mdlsup.c
@@ -218,9 +218,9 @@ MiMapLockedPagesInUserSpace(
/* Acquire a share count */
Pfn1 = MI_PFN_ELEMENT(PointerPde->u.Hard.PageFrameNumber);
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
Pfn1->u2.ShareCount++;
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
/* Next page */
MdlPages++;
@@ -293,7 +293,7 @@ MiUnmapLockedPagesInUserSpace(
ASSERT(Process->VadRoot.NodeHint != Vad);
PointerPte = MiAddressToPte(BaseAddress);
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
while (NumberOfPages != 0 &&
*MdlPages != LIST_HEAD)
{
@@ -336,7 +336,7 @@ MiUnmapLockedPagesInUserSpace(
}
KeFlushProcessTb();
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
MiUnlockProcessWorkingSetUnsafe(Process, Thread);
MmUnlockAddressSpace(&Process->Vm);
ExFreePoolWithTag(Vad, 'ldaV');
@@ -560,7 +560,7 @@ MmFreePagesFromMdl(IN PMDL Mdl)
//
// Acquire PFN lock
//
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
//
// Loop all the MDL pages
@@ -618,7 +618,7 @@ MmFreePagesFromMdl(IN PMDL Mdl)
//
// Release the lock
//
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
//
// Remove the pages locked flag
@@ -1121,7 +1121,7 @@ MmProbeAndLockPages(IN PMDL Mdl,
// Use the PFN lock
//
UsePfnLock = TRUE;
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
}
else
{
@@ -1180,7 +1180,7 @@ MmProbeAndLockPages(IN PMDL Mdl,
//
// Release PFN lock
//
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
}
else
{
@@ -1212,7 +1212,7 @@ MmProbeAndLockPages(IN PMDL Mdl,
//
// Grab the PFN lock
//
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
}
else
{
@@ -1250,7 +1250,7 @@ MmProbeAndLockPages(IN PMDL Mdl,
//
// Release PFN lock
//
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
}
else
{
@@ -1281,7 +1281,7 @@ MmProbeAndLockPages(IN PMDL Mdl,
//
// Grab the PFN lock
//
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
}
else
{
@@ -1353,7 +1353,7 @@ MmProbeAndLockPages(IN PMDL Mdl,
//
// Release PFN lock
//
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
}
else
{
@@ -1381,7 +1381,7 @@ CleanupWithLock:
//
// Release PFN lock
//
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
}
else
{
@@ -1462,7 +1462,7 @@ MmUnlockPages(IN PMDL Mdl)
//
// Acquire PFN lock
//
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
//
// Loop every page
@@ -1485,7 +1485,7 @@ MmUnlockPages(IN PMDL Mdl)
//
// Release the lock
//
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
//
// Check if we have a process
@@ -1564,7 +1564,7 @@ MmUnlockPages(IN PMDL Mdl)
//
// Now grab the PFN lock for the actual unlock and dereference
//
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
do
{
/* Get the current entry and reference count */
@@ -1575,7 +1575,7 @@ MmUnlockPages(IN PMDL Mdl)
//
// Release the lock
//
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
//
// We're done
diff --git a/ntoskrnl/mm/ARM3/mminit.c b/ntoskrnl/mm/ARM3/mminit.c
index 597cf050b2..c92db6ca1d 100644
--- a/ntoskrnl/mm/ARM3/mminit.c
+++ b/ntoskrnl/mm/ARM3/mminit.c
@@ -949,7 +949,7 @@ MiBuildPfnDatabaseFromLoaderBlock(IN PLOADER_PARAMETER_BLOCK
LoaderBlock)
Pfn1 = MiGetPfnEntry(PageFrameIndex);
/* Lock the PFN Database */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
while (PageCount--)
{
/* If the page really has no references, mark it as free */
@@ -966,7 +966,7 @@ MiBuildPfnDatabaseFromLoaderBlock(IN PLOADER_PARAMETER_BLOCK
LoaderBlock)
}
/* Release PFN database */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
/* Done with this block */
break;
@@ -1138,7 +1138,7 @@ MmFreeLoaderBlock(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
}
/* Acquire the PFN lock */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
/* Loop the runs */
LoaderPages = 0;
@@ -1180,7 +1180,7 @@ MmFreeLoaderBlock(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
/* Release the PFN lock and flush the TLB */
DPRINT("Loader pages freed: %lx\n", LoaderPages);
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
KeFlushCurrentTb();
/* Free our run structure */
@@ -1829,7 +1829,7 @@ MiBuildPagedPool(VOID)
//
// Lock the PFN database
//
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
#if (_MI_PAGING_LEVELS >= 3)
/* On these systems, there's no double-mapping, so instead, the PPEs
@@ -1890,7 +1890,7 @@ MiBuildPagedPool(VOID)
//
// Release the PFN database lock
//
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
//
// We only have one PDE mapped for now... at fault time, additional PDEs
diff --git a/ntoskrnl/mm/ARM3/pagfault.c b/ntoskrnl/mm/ARM3/pagfault.c
index 0ded2d6c79..2e962edd92 100644
--- a/ntoskrnl/mm/ARM3/pagfault.c
+++ b/ntoskrnl/mm/ARM3/pagfault.c
@@ -638,12 +638,12 @@ MiResolveDemandZeroFault(IN PVOID Address,
if (OldIrql == MM_NOIRQL)
{
/* Acquire it and remember we should release it after */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
HaveLock = TRUE;
}
/* We either manually locked the PFN DB, or already came with it locked */
- ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
+ MI_ASSERT_PFN_LOCK_HELD();
ASSERT(PointerPte->u.Hard.Valid == 0);
/* Assert we have enough pages */
@@ -692,7 +692,7 @@ MiResolveDemandZeroFault(IN PVOID Address,
if (HaveLock)
{
/* Release it */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
/* Update performance counters */
if (Process > HYDRA_PROCESS) Process->NumberOfPrivatePages++;
@@ -763,7 +763,7 @@ MiCompleteProtoPteFault(IN BOOLEAN StoreInstruction,
BOOLEAN OriginalProtection, DirtyPage;
/* Must be called with an valid prototype PTE, with the PFN lock held */
- ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
+ MI_ASSERT_PFN_LOCK_HELD();
ASSERT(PointerProtoPte->u.Hard.Valid == 1);
/* Get the page */
@@ -825,7 +825,7 @@ MiCompleteProtoPteFault(IN BOOLEAN StoreInstruction,
}
/* Release the PFN lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
/* Remove special/caching bits */
Protection &= ~MM_PROTECT_SPECIAL;
@@ -892,7 +892,7 @@ MiResolvePageFileFault(_In_ BOOLEAN StoreInstruction,
ASSERT(*OldIrql != MM_NOIRQL);
/* We must hold the PFN lock */
- ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
+ MI_ASSERT_PFN_LOCK_HELD();
/* Some sanity checks */
ASSERT(TempPte.u.Hard.Valid == 0);
@@ -919,13 +919,13 @@ MiResolvePageFileFault(_In_ BOOLEAN StoreInstruction,
MI_WRITE_INVALID_PTE(PointerPte, TempPte);
/* Release the PFN lock while we proceed */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, *OldIrql);
+ MiReleasePfnLock(*OldIrql);
/* Do the paging IO */
Status = MiReadPageFile(Page, PageFileIndex, PageFileOffset);
/* Lock the PFN database again */
- *OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ *OldIrql = MiAcquirePfnLock();
/* Nobody should have changed that while we were not looking */
ASSERT(Pfn1->u3.e1.ReadInProgress == 1);
@@ -1106,7 +1106,7 @@ MiResolveProtoPteFault(IN BOOLEAN StoreInstruction,
ULONG Protection;
/* Must be called with an invalid, prototype PTE, with the PFN lock held */
- ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
+ MI_ASSERT_PFN_LOCK_HELD();
ASSERT(PointerPte->u.Hard.Valid == 0);
ASSERT(PointerPte->u.Soft.Prototype == 1);
@@ -1136,7 +1136,7 @@ MiResolveProtoPteFault(IN BOOLEAN StoreInstruction,
{
/* Release the lock */
DPRINT1("Access on reserved section?\n");
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
return STATUS_ACCESS_VIOLATION;
}
@@ -1193,7 +1193,7 @@ MiResolveProtoPteFault(IN BOOLEAN StoreInstruction,
}
/* Lock again the PFN lock, MiResolveProtoPteFault unlocked it */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
/* And re-read the proto PTE */
TempPte = *PointerProtoPte;
@@ -1236,7 +1236,7 @@ MiResolveProtoPteFault(IN BOOLEAN StoreInstruction,
MI_WRITE_VALID_PTE(PointerPte, PteContents);
/* The caller expects us to release the PFN lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
return Status;
}
@@ -1330,7 +1330,7 @@ MiDispatchFault(IN BOOLEAN StoreInstruction,
if (Address >= MmSystemRangeStart)
{
/* Lock the PFN database */
- LockIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ LockIrql = MiAcquirePfnLock();
/* Has the PTE been made valid yet? */
if (!SuperProtoPte->u.Hard.Valid)
@@ -1381,7 +1381,7 @@ MiDispatchFault(IN BOOLEAN StoreInstruction,
ProcessedPtes = 0;
/* Lock the PFN database */
- LockIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ LockIrql = MiAcquirePfnLock();
/* We only handle the valid path */
ASSERT(SuperProtoPte->u.Hard.Valid == 1);
@@ -1518,14 +1518,14 @@ MiDispatchFault(IN BOOLEAN StoreInstruction,
{
/* We had a locked PFN, so acquire the PFN lock to dereference it */
ASSERT(PointerProtoPte != NULL);
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
/* Dereference the locked PFN */
MiDereferencePfnAndDropLockCount(OutPfn);
ASSERT(OutPfn->u3.e2.ReferenceCount >= 1);
/* And now release the lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
}
/* Complete this as a transition fault */
@@ -1544,7 +1544,7 @@ MiDispatchFault(IN BOOLEAN StoreInstruction,
KEVENT CurrentPageEvent;
/* Lock the PFN database */
- LockIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ LockIrql = MiAcquirePfnLock();
/* Resolve */
Status = MiResolveTransitionFault(StoreInstruction, Address, PointerPte, Process,
LockIrql, &InPageBlock);
@@ -1560,7 +1560,7 @@ MiDispatchFault(IN BOOLEAN StoreInstruction,
}
/* And now release the lock and leave*/
- KeReleaseQueuedSpinLock(LockQueuePfnLock, LockIrql);
+ MiReleasePfnLock(LockIrql);
if (InPageBlock != NULL)
{
@@ -1583,13 +1583,13 @@ MiDispatchFault(IN BOOLEAN StoreInstruction,
if (TempPte.u.Soft.PageFileHigh != 0)
{
/* Lock the PFN database */
- LockIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ LockIrql = MiAcquirePfnLock();
/* Resolve */
Status = MiResolvePageFileFault(StoreInstruction, Address, PointerPte, Process,
&LockIrql);
/* And now release the lock and leave*/
- KeReleaseQueuedSpinLock(LockQueuePfnLock, LockIrql);
+ MiReleasePfnLock(LockIrql);
ASSERT(OldIrql == KeGetCurrentIrql());
ASSERT(OldIrql <= APC_LEVEL);
@@ -1777,7 +1777,7 @@ MmArmAccessFault(IN BOOLEAN StoreInstruction,
if (!IsSessionAddress)
{
/* Check if the PTE is still valid under PFN lock */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
TempPte = *PointerPte;
if (TempPte.u.Hard.Valid)
{
@@ -1800,7 +1800,7 @@ MmArmAccessFault(IN BOOLEAN StoreInstruction,
}
/* Release PFN lock and return all good */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
return STATUS_SUCCESS;
}
}
@@ -2147,7 +2147,7 @@ UserFault:
PFN_NUMBER PageFrameIndex, OldPageFrameIndex;
PMMPFN Pfn1;
- LockIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ LockIrql = MiAcquirePfnLock();
ASSERT(MmAvailablePages > 0);
@@ -2172,7 +2172,7 @@ UserFault:
MI_WRITE_VALID_PTE(PointerPte, TempPte);
- KeReleaseQueuedSpinLock(LockQueuePfnLock, LockIrql);
+ MiReleasePfnLock(LockIrql);
/* Return the status */
MiUnlockProcessWorkingSet(CurrentProcess, CurrentThread);
@@ -2282,7 +2282,7 @@ UserFault:
}
/* Lock the PFN database since we're going to grab a page */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
/* Make sure we have enough pages */
ASSERT(MmAvailablePages >= 32);
@@ -2299,20 +2299,20 @@ UserFault:
ASSERT(PageFrameIndex);
/* Release the lock since we need to do some zeroing */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
/* Zero out the page, since it's for user-mode */
MiZeroPfn(PageFrameIndex);
/* Grab the lock again so we can initialize the PFN entry */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
}
/* Initialize the PFN entry now */
MiInitializePfn(PageFrameIndex, PointerPte, 1);
/* And we're done with the lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
/* Increment the count of pages in the process */
CurrentProcess->NumberOfPrivatePages++;
diff --git a/ntoskrnl/mm/ARM3/pfnlist.c b/ntoskrnl/mm/ARM3/pfnlist.c
index 8fc607c794..0373fff2de 100644
--- a/ntoskrnl/mm/ARM3/pfnlist.c
+++ b/ntoskrnl/mm/ARM3/pfnlist.c
@@ -144,7 +144,7 @@ MiUnlinkFreeOrZeroedPage(IN PMMPFN Entry)
PMMPFN Pfn1;
/* Make sure the PFN lock is held */
- ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
+ MI_ASSERT_PFN_LOCK_HELD();
/* Make sure the PFN entry isn't in-use */
ASSERT(Entry->u3.e1.WriteInProgress == 0);
@@ -267,7 +267,7 @@ MiUnlinkPageFromList(IN PMMPFN Pfn)
PFN_NUMBER OldFlink, OldBlink;
/* Make sure the PFN lock is held */
- ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
+ MI_ASSERT_PFN_LOCK_HELD();
/* ARM3 should only call this for dead pages */
ASSERT(Pfn->u3.e2.ReferenceCount == 0);
@@ -371,7 +371,7 @@ MiRemovePageByColor(IN PFN_NUMBER PageIndex,
PMMCOLOR_TABLES ColorTable;
/* Make sure PFN lock is held */
- ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
+ MI_ASSERT_PFN_LOCK_HELD();
ASSERT(Color < MmSecondaryColors);
/* Get the PFN entry */
@@ -478,7 +478,7 @@ MiRemoveAnyPage(IN ULONG Color)
PMMPFN Pfn1;
/* Make sure PFN lock is held and we have pages */
- ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
+ MI_ASSERT_PFN_LOCK_HELD();
ASSERT(MmAvailablePages != 0);
ASSERT(Color < MmSecondaryColors);
@@ -535,7 +535,7 @@ MiRemoveZeroPage(IN ULONG Color)
BOOLEAN Zero = FALSE;
/* Make sure PFN lock is held and we have pages */
- ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
+ MI_ASSERT_PFN_LOCK_HELD();
ASSERT(MmAvailablePages != 0);
ASSERT(Color < MmSecondaryColors);
@@ -723,7 +723,7 @@ MiInsertStandbyListAtFront(IN PFN_NUMBER PageFrameIndex)
/* Make sure the lock is held */
DPRINT("Inserting page: %lx into standby list !\n", PageFrameIndex);
- ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
+ MI_ASSERT_PFN_LOCK_HELD();
/* Make sure the PFN is valid */
ASSERT((PageFrameIndex != 0) &&
@@ -788,7 +788,7 @@ MiInsertPageInList(IN PMMPFNLIST ListHead,
ASSERT(ListHead != &MmFreePageListHead);
/* Make sure the lock is held */
- ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
+ MI_ASSERT_PFN_LOCK_HELD();
/* Make sure the PFN is valid */
ASSERT((PageFrameIndex) &&
@@ -973,7 +973,7 @@ MiInitializePfn(IN PFN_NUMBER PageFrameIndex,
PMMPFN Pfn1;
NTSTATUS Status;
PMMPTE PointerPtePte;
- ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
+ MI_ASSERT_PFN_LOCK_HELD();
/* Setup the PTE */
Pfn1 = MI_PFN_ELEMENT(PageFrameIndex);
@@ -1040,7 +1040,7 @@ MiInitializePfnAndMakePteValid(IN PFN_NUMBER PageFrameIndex,
PMMPFN Pfn1;
NTSTATUS Status;
PMMPTE PointerPtePte;
- ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
+ MI_ASSERT_PFN_LOCK_HELD();
/* PTE must be invalid */
ASSERT(PointerPte->u.Hard.Valid == 0);
@@ -1102,13 +1102,13 @@ MiInitializeAndChargePfn(OUT PPFN_NUMBER PageFrameIndex,
TempPde = SessionAllocation ? ValidKernelPdeLocal : ValidKernelPde;
/* Lock the PFN database */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
/* Make sure nobody is racing us */
if (PointerPde->u.Hard.Valid == 1)
{
/* Return special error if that was the case */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
return STATUS_RETRY;
}
@@ -1124,7 +1124,7 @@ MiInitializeAndChargePfn(OUT PPFN_NUMBER PageFrameIndex,
ASSERT(MI_PFN_ELEMENT(*PageFrameIndex)->u1.WsIndex == 0);
/* Release the lock and return success */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
return STATUS_SUCCESS;
}
@@ -1186,7 +1186,7 @@ MiDecrementShareCount(IN PMMPFN Pfn1,
Pfn1->u3.e1.PageLocation = TransitionPage;
/* PFN lock must be held */
- ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
+ MI_ASSERT_PFN_LOCK_HELD();
if (Pfn1->u3.e2.ReferenceCount == 1)
{
@@ -1223,7 +1223,7 @@ MiDecrementReferenceCount(IN PMMPFN Pfn1,
IN PFN_NUMBER PageFrameIndex)
{
/* PFN lock must be held */
- ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
+ MI_ASSERT_PFN_LOCK_HELD();
/* Sanity checks on the page */
if (PageFrameIndex > MmHighestPhysicalPage ||
diff --git a/ntoskrnl/mm/ARM3/pool.c b/ntoskrnl/mm/ARM3/pool.c
index ce72c16724..b47ee2608e 100644
--- a/ntoskrnl/mm/ARM3/pool.c
+++ b/ntoskrnl/mm/ARM3/pool.c
@@ -536,7 +536,7 @@ MiAllocatePoolPages(IN POOL_TYPE PoolType,
//
// Lock the PFN database and loop pages
//
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
do
{
//
@@ -577,7 +577,7 @@ MiAllocatePoolPages(IN POOL_TYPE PoolType,
//
// Release the PFN database lock
//
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
//
// These pages are now available, clear their availablity bits
diff --git a/ntoskrnl/mm/ARM3/procsup.c b/ntoskrnl/mm/ARM3/procsup.c
index e415a6e27b..7522e35497 100644
--- a/ntoskrnl/mm/ARM3/procsup.c
+++ b/ntoskrnl/mm/ARM3/procsup.c
@@ -203,7 +203,7 @@ MmDeleteKernelStack(IN PVOID StackBase,
MmLargeStackSize : KERNEL_STACK_SIZE);
/* Acquire the PFN lock */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
//
// Loop them
@@ -245,7 +245,7 @@ MmDeleteKernelStack(IN PVOID StackBase,
ASSERT(PointerPte->u.Hard.Valid == 0);
/* Release the PFN lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
//
// Release the PTEs
@@ -330,7 +330,7 @@ MmCreateKernelStack(IN BOOLEAN GuiStack,
//
// Acquire the PFN DB lock
//
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
//
// Loop each stack page
@@ -359,7 +359,7 @@ MmCreateKernelStack(IN BOOLEAN GuiStack,
//
// Release the PFN lock
//
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
//
// Return the stack address
@@ -421,7 +421,7 @@ MmGrowKernelStackEx(IN PVOID StackPointer,
//
// Acquire the PFN DB lock
//
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
//
// Loop each stack page
@@ -447,7 +447,7 @@ MmGrowKernelStackEx(IN PVOID StackPointer,
//
// Release the PFN lock
//
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
//
// Set the new limit
@@ -918,7 +918,7 @@ MmInitializeProcessAddressSpace(IN PEPROCESS Process,
Process->VadRoot.BalancedRoot.u1.Parent = &Process->VadRoot.BalancedRoot;
/* Lock PFN database */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
/* Setup the PFN for the PDE base of this process */
#ifdef _M_AMD64
@@ -957,7 +957,7 @@ MmInitializeProcessAddressSpace(IN PEPROCESS Process,
ASSERT(Process->PhysicalVadRoot == NULL);
/* Release PFN lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
/* Check if there's a Section Object */
if (SectionObject)
@@ -1087,7 +1087,7 @@ MmCreateProcessAddressSpace(IN ULONG MinWs,
KeInitializeSpinLock(&Process->HyperSpaceLock);
/* Lock PFN database */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
/* Get a zero page for the PDE, if possible */
Color = MI_GET_NEXT_PROCESS_COLOR(Process);
@@ -1099,9 +1099,9 @@ MmCreateProcessAddressSpace(IN ULONG MinWs,
PdeIndex = MiRemoveAnyPage(Color);
/* Zero it outside the PFN lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
MiZeroPhysicalPage(PdeIndex);
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
}
/* Get a zero page for hyperspace, if possible */
@@ -1114,9 +1114,9 @@ MmCreateProcessAddressSpace(IN ULONG MinWs,
HyperIndex = MiRemoveAnyPage(Color);
/* Zero it outside the PFN lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
MiZeroPhysicalPage(HyperIndex);
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
}
/* Get a zero page for the woring set list, if possible */
@@ -1129,13 +1129,13 @@ MmCreateProcessAddressSpace(IN ULONG MinWs,
WsListIndex = MiRemoveAnyPage(Color);
/* Zero it outside the PFN lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
MiZeroPhysicalPage(WsListIndex);
}
else
{
/* Release the PFN lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
}
/* Switch to phase 1 initialization */
@@ -1334,7 +1334,7 @@ MmDeleteProcessAddressSpace2(IN PEPROCESS Process)
//ASSERT(Process->CommitCharge == 0);
/* Acquire the PFN lock */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
/* Check for fully initialized process */
if (Process->AddressSpaceInitialized == 2)
@@ -1378,7 +1378,7 @@ MmDeleteProcessAddressSpace2(IN PEPROCESS Process)
}
/* Release the PFN lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
/* Drop a reference on the session */
if (Process->Session)
MiReleaseProcessReferenceToSessionDataPage(Process->Session);
diff --git a/ntoskrnl/mm/ARM3/section.c b/ntoskrnl/mm/ARM3/section.c
index 6b5aadd1aa..c9b5daf13d 100644
--- a/ntoskrnl/mm/ARM3/section.c
+++ b/ntoskrnl/mm/ARM3/section.c
@@ -499,7 +499,7 @@ MiFillSystemPageDirectory(IN PVOID Base,
while (PointerPde <= LastPde)
{
/* Lock the PFN database */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
/* Check if we don't already have this PDE mapped */
if (SystemMapPde->u.Hard.Valid == 0)
@@ -533,7 +533,7 @@ MiFillSystemPageDirectory(IN PVOID Base,
}
/* Release the lock and keep going with the next PDE */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
SystemMapPde++;
PointerPde++;
}
@@ -550,7 +550,7 @@ MiCheckPurgeAndUpMapCount(IN PCONTROL_AREA ControlArea,
ASSERT(FailIfSystemViews == FALSE);
/* Lock the PFN database */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
/* State not yet supported */
ASSERT(ControlArea->u.Flags.BeingPurged == 0);
@@ -561,7 +561,7 @@ MiCheckPurgeAndUpMapCount(IN PCONTROL_AREA ControlArea,
ASSERT(ControlArea->NumberOfSectionReferences != 0);
/* Release the PFN lock and return success */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
return STATUS_SUCCESS;
}
@@ -633,7 +633,7 @@ MiSegmentDelete(IN PSEGMENT Segment)
LastPte = PointerPte + Segment->NonExtendedPtes;
/* Lock the PFN database */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
/* Check if the master PTE is invalid */
PteForProto = MiAddressToPte(PointerPte);
@@ -716,7 +716,7 @@ MiSegmentDelete(IN PSEGMENT Segment)
}
/* Release the PFN lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
/* Free the structures */
ExFreePool(ControlArea);
@@ -729,7 +729,7 @@ MiCheckControlArea(IN PCONTROL_AREA ControlArea,
IN KIRQL OldIrql)
{
BOOLEAN DeleteSegment = FALSE;
- ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
+ MI_ASSERT_PFN_LOCK_HELD();
/* Check if this is the last reference or view */
if (!(ControlArea->NumberOfMappedViews) &&
@@ -747,7 +747,7 @@ MiCheckControlArea(IN PCONTROL_AREA ControlArea,
}
/* Release the PFN lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
/* Delete the segment if needed */
if (DeleteSegment)
@@ -765,7 +765,7 @@ MiDereferenceControlArea(IN PCONTROL_AREA ControlArea)
KIRQL OldIrql;
/* Lock the PFN database */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
/* Drop reference counts */
ControlArea->NumberOfMappedViews--;
@@ -802,7 +802,7 @@ MiRemoveMappedView(IN PEPROCESS CurrentProcess,
MiUnlockProcessWorkingSetUnsafe(CurrentProcess, CurrentThread);
/* Lock the PFN database */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
/* Remove references */
ControlArea->NumberOfMappedViews--;
@@ -993,7 +993,7 @@ _WARN("MiSessionCommitPageTables halfplemented for amd64")
ASSERT(MmAvailablePages >= 32);
/* Acquire the PFN lock and grab a zero page */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
MI_SET_USAGE(MI_USAGE_PAGE_TABLE);
MI_SET_PROCESS2(PsGetCurrentProcess()->ImageFileName);
Color = (++MmSessionSpace->Color) & MmSecondaryColorMask;
@@ -1011,7 +1011,7 @@ _WARN("MiSessionCommitPageTables halfplemented for
amd64")
MmSessionSpace->SessionPageDirectoryIndex);
/* And now release the lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
/* Get the PFN entry and make sure there's no event for it */
Pfn1 = MI_PFN_ELEMENT(PageFrameNumber);
@@ -1145,11 +1145,11 @@ MiSetControlAreaSymbolsLoaded(IN PCONTROL_AREA ControlArea)
ASSERT(KeGetCurrentIrql() <= APC_LEVEL);
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
ControlArea->u.Flags.DebugSymbolsLoaded |= 1;
ASSERT(OldIrql <= APC_LEVEL);
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
ASSERT(KeGetCurrentIrql() <= APC_LEVEL);
}
@@ -1976,7 +1976,7 @@ MiFlushTbAndCapture(IN PMMVAD FoundVad,
PointerPte,
ProtectionMask,
PreviousPte.u.Hard.PageFrameNumber);
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
//
// We don't support I/O mappings in this path yet
@@ -2050,7 +2050,7 @@ MiFlushTbAndCapture(IN PMMVAD FoundVad,
//
// Release the PFN lock, we are done
//
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
}
//
@@ -2257,7 +2257,7 @@ MiRemoveMappedPtes(IN PVOID BaseAddress,
PointerPde = MiPteToPde(PointerPte);
/* Lock the PFN database and make sure this isn't a mapped file */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
ASSERT(((Pfn1->u3.e1.PrototypePte) &&
(Pfn1->OriginalPte.u.Soft.Prototype)) == 0);
/* Mark the page as modified accordingly */
@@ -2287,7 +2287,7 @@ MiRemoveMappedPtes(IN PVOID BaseAddress,
MiDecrementShareCount(Pfn1, PFN_FROM_PTE(&PteContents));
/* Release the PFN lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
}
else
{
@@ -2317,7 +2317,7 @@ MiRemoveMappedPtes(IN PVOID BaseAddress,
KeFlushCurrentTb();
/* Acquire the PFN lock */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
/* Decrement the accounting counters */
ControlArea->NumberOfUserReferences--;
@@ -2514,7 +2514,7 @@ MmCreateArm3Section(OUT PVOID *SectionObject,
}
/* Lock the PFN database while we play with the section pointers */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
/* Image-file backed sections are not yet supported */
ASSERT((AllocationAttributes & SEC_IMAGE) == 0);
@@ -2530,7 +2530,7 @@ MmCreateArm3Section(OUT PVOID *SectionObject,
File->SectionObjectPointer->DataSectionObject = ControlArea;
/* We can release the PFN lock now */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
/* We don't support previously-mapped file */
ASSERT(NewSegment == NULL);
@@ -2548,7 +2548,7 @@ MmCreateArm3Section(OUT PVOID *SectionObject,
if (!NT_SUCCESS(Status))
{
/* Lock the PFN database while we play with the section pointers */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
/* Reset the waiting-for-deletion event */
ASSERT(ControlArea->WaitingForDeletion == NULL);
@@ -2566,7 +2566,7 @@ MmCreateArm3Section(OUT PVOID *SectionObject,
ControlArea->u.Flags.BeingCreated = FALSE;
/* We can release the PFN lock now */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
/* Check if we locked and set the IRP */
if (FileLock)
@@ -2630,7 +2630,7 @@ MmCreateArm3Section(OUT PVOID *SectionObject,
ASSERT(File != NULL);
/* Acquire the PFN lock while we set control area flags */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
/* We don't support this race condition yet, so assume no waiters */
ASSERT(ControlArea->WaitingForDeletion == NULL);
@@ -2642,7 +2642,7 @@ MmCreateArm3Section(OUT PVOID *SectionObject,
/* Take off the being created flag, and then release the lock */
ControlArea->u.Flags.BeingCreated = FALSE;
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
}
/* Check if we locked the file earlier */
@@ -2725,7 +2725,7 @@ MmCreateArm3Section(OUT PVOID *SectionObject,
if (UserRefIncremented)
{
/* Acquire the PFN lock while we change counters */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
/* Decrement the accounting counters */
ControlArea->NumberOfSectionReferences--;
@@ -2795,13 +2795,13 @@ MmCreateArm3Section(OUT PVOID *SectionObject,
if (ControlArea->u.Flags.BeingCreated == 1)
{
/* Acquire the PFN lock while we set control area flags */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
/* Take off the being created flag, and then release the lock */
ControlArea->u.Flags.BeingCreated = 0;
NewSection->u.Flags.BeingCreated = 0;
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
}
/* Migrate the attribute into a flag */
@@ -3258,7 +3258,7 @@ MiDeleteARM3Section(PVOID ObjectBody)
}
/* Lock the PFN database */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
ASSERT(SectionObject->Segment);
ASSERT(SectionObject->Segment->ControlArea);
diff --git a/ntoskrnl/mm/ARM3/session.c b/ntoskrnl/mm/ARM3/session.c
index 2404a88d86..8760623968 100644
--- a/ntoskrnl/mm/ARM3/session.c
+++ b/ntoskrnl/mm/ARM3/session.c
@@ -246,7 +246,7 @@ MiReleaseProcessReferenceToSessionDataPage(IN PMM_SESSION_SPACE
SessionGlobal)
}
/* Loop every data page and drop a reference count */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
for (i = 0; i < MiSessionDataPages; i++)
{
/* Sanity check that the page is correct, then decrement it */
@@ -257,7 +257,7 @@ MiReleaseProcessReferenceToSessionDataPage(IN PMM_SESSION_SPACE
SessionGlobal)
}
/* Done playing with pages, release the lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
/* Decrement the number of data pages */
InterlockedDecrement(&MmSessionDataPages);
@@ -505,7 +505,7 @@ MiSessionInitializeWorkingSetList(VOID)
/* Initialize the working set lock, and lock the PFN database */
ExInitializePushLock(&SessionGlobal->Vm.WorkingSetMutex);
//MmLockPageableSectionByHandle(ExPageLockHandle);
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
/* Check if we need a page table */
if (AllocatedPageTable != FALSE)
@@ -520,9 +520,9 @@ MiSessionInitializeWorkingSetList(VOID)
PageFrameIndex = MiRemoveAnyPage(Color);
/* Zero it outside the PFN lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
MiZeroPhysicalPage(PageFrameIndex);
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
}
/* Write a valid PDE for it */
@@ -552,9 +552,9 @@ MiSessionInitializeWorkingSetList(VOID)
PageFrameIndex = MiRemoveAnyPage(Color);
/* Zero it outside the PFN lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
MiZeroPhysicalPage(PageFrameIndex);
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
}
/* Write a valid PTE for it */
@@ -566,7 +566,7 @@ MiSessionInitializeWorkingSetList(VOID)
MiInitializePfnAndMakePteValid(PageFrameIndex, PointerPte, TempPte);
/* Now we can release the PFN database lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
/* Fill out the working set structure */
MmSessionSpace->Vm.Flags.SessionSpace = 1;
@@ -674,7 +674,7 @@ MiSessionCreateInternal(OUT PULONG SessionId)
ASSERT(SessionPte != NULL);
/* Acquire the PFN lock while we set everything up */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
/* Loop the global PTEs */
TempPte = ValidKernelPte;
@@ -690,9 +690,9 @@ MiSessionCreateInternal(OUT PULONG SessionId)
DataPage[i] = MiRemoveAnyPage(Color);
/* Zero it outside the PFN lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
MiZeroPhysicalPage(DataPage[i]);
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
}
/* Fill the PTE out */
@@ -713,9 +713,9 @@ MiSessionCreateInternal(OUT PULONG SessionId)
SessionPageDirIndex = MiRemoveAnyPage(Color);
/* Zero it outside the PFN lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
MiZeroPhysicalPage(SessionPageDirIndex);
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
}
/* Fill the PTE out */
@@ -755,9 +755,9 @@ MiSessionCreateInternal(OUT PULONG SessionId)
TagPage[i] = MiRemoveAnyPage(Color);
/* Zero it outside the PFN lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
MiZeroPhysicalPage(TagPage[i]);
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
}
/* Fill the PTE out */
@@ -768,7 +768,7 @@ MiSessionCreateInternal(OUT PULONG SessionId)
}
/* PTEs have been setup, release the PFN lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
/* Fill out the session space structure now */
MmSessionSpace->GlobalVirtualAddress = SessionGlobal;
diff --git a/ntoskrnl/mm/ARM3/special.c b/ntoskrnl/mm/ARM3/special.c
index bb0a5f8165..6d40315bc0 100644
--- a/ntoskrnl/mm/ARM3/special.c
+++ b/ntoskrnl/mm/ARM3/special.c
@@ -206,7 +206,7 @@ MmExpandSpecialPool(VOID)
ULONG i;
PMMPTE PointerPte;
- ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
+ MI_ASSERT_PFN_LOCK_HELD();
if (MiSpecialPoolExtraCount == 0)
return STATUS_INSUFFICIENT_RESOURCES;
@@ -292,13 +292,13 @@ MmAllocateSpecialPool(SIZE_T NumberOfBytes, ULONG Tag, POOL_TYPE
PoolType, ULONG
}
/* Lock PFN database */
- Irql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ Irql = MiAcquirePfnLock();
/* Reject allocation in case amount of available pages is too small */
if (MmAvailablePages < 0x100)
{
/* Release the PFN database lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, Irql);
+ MiReleasePfnLock(Irql);
DPRINT1("Special pool: MmAvailablePages 0x%x is too small\n",
MmAvailablePages);
return NULL;
}
@@ -311,7 +311,7 @@ MmAllocateSpecialPool(SIZE_T NumberOfBytes, ULONG Tag, POOL_TYPE
PoolType, ULONG
{
/* No reserves left, reject this allocation */
static int once;
- KeReleaseQueuedSpinLock(LockQueuePfnLock, Irql);
+ MiReleasePfnLock(Irql);
if (!once++) DPRINT1("Special pool: No PTEs left!\n");
return NULL;
}
@@ -344,7 +344,7 @@ MmAllocateSpecialPool(SIZE_T NumberOfBytes, ULONG Tag, POOL_TYPE
PoolType, ULONG
MiInitializePfnAndMakePteValid(PageFrameNumber, PointerPte, TempPte);
/* Release the PFN database lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, Irql);
+ MiReleasePfnLock(Irql);
/* Increase page counter */
PagesInUse = InterlockedIncrementUL(&MmSpecialPagesInUse);
@@ -601,7 +601,7 @@ MmFreeSpecialPool(PVOID P)
InterlockedDecrementUL(&MiSpecialPagesNonPaged);
/* Lock PFN database */
- Irql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ Irql = MiAcquirePfnLock();
/* Delete this PFN */
MI_SET_PFN_DELETED(Pfn);
@@ -624,7 +624,7 @@ MmFreeSpecialPool(PVOID P)
InterlockedDecrementUL(&MiSpecialPagesPagable);
/* Lock PFN database */
- Irql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ Irql = MiAcquirePfnLock();
}
/* Mark next PTE as invalid */
@@ -641,7 +641,7 @@ MmFreeSpecialPool(PVOID P)
MiSpecialPoolLastPte = PointerPte;
/* Release the PFN database lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, Irql);
+ MiReleasePfnLock(Irql);
/* Update page counter */
InterlockedDecrementUL(&MmSpecialPagesInUse);
diff --git a/ntoskrnl/mm/ARM3/sysldr.c b/ntoskrnl/mm/ARM3/sysldr.c
index 0b929f7bf8..471551184f 100644
--- a/ntoskrnl/mm/ARM3/sysldr.c
+++ b/ntoskrnl/mm/ARM3/sysldr.c
@@ -176,7 +176,7 @@ MiLoadImageSection(IN OUT PVOID *SectionPtr,
DPRINT1("Loading: %wZ at %p with %lx pages\n", FileName, DriverBase,
PteCount);
/* Lock the PFN database */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
/* Loop the new driver PTEs */
TempPte = ValidKernelPte;
@@ -213,7 +213,7 @@ MiLoadImageSection(IN OUT PVOID *SectionPtr,
}
/* Release the PFN lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
/* Copy the image */
RtlCopyMemory(DriverBase, Base, PteCount << PAGE_SHIFT);
diff --git a/ntoskrnl/mm/ARM3/virtual.c b/ntoskrnl/mm/ARM3/virtual.c
index 8f0591db0b..0e5fe77a23 100644
--- a/ntoskrnl/mm/ARM3/virtual.c
+++ b/ntoskrnl/mm/ARM3/virtual.c
@@ -267,7 +267,7 @@ MiMakeSystemAddressValidPfn(IN PVOID VirtualAddress,
while (!MmIsAddressValid(VirtualAddress))
{
/* Release the PFN database */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
/* Fault it in */
Status = MmAccessFault(FALSE, VirtualAddress, KernelMode, NULL);
@@ -285,7 +285,7 @@ MiMakeSystemAddressValidPfn(IN PVOID VirtualAddress,
LockChange = TRUE;
/* Lock the PFN database */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
}
/* Let caller know what the lock state is */
@@ -337,7 +337,7 @@ MiDeleteSystemPageableVm(IN PMMPTE PointerPte,
Pfn2 = MiGetPfnEntry(PageTableIndex);
/* Lock the PFN database */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
/* Delete it the page */
MI_SET_PFN_DELETED(Pfn1);
@@ -347,7 +347,7 @@ MiDeleteSystemPageableVm(IN PMMPTE PointerPte,
MiDecrementShareCount(Pfn2, PageTableIndex);
/* Release the PFN database */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
/* Destroy the PTE */
MI_ERASE_PTE(PointerPte);
@@ -399,7 +399,7 @@ MiDeletePte(IN PMMPTE PointerPte,
PMMPDE PointerPde;
/* PFN lock must be held */
- ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
+ MI_ASSERT_PFN_LOCK_HELD();
/* Capture the PTE */
TempPte = *PointerPte;
@@ -626,7 +626,7 @@ MiDeleteVirtualAddresses(IN ULONG_PTR Va,
}
/* Lock the PFN Database while we delete the PTEs */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
do
{
/* Capture the PDE and make sure it exists */
@@ -708,7 +708,7 @@ MiDeleteVirtualAddresses(IN ULONG_PTR Va,
}
/* Release the lock and get out if we're done */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
if (Va > EndingAddress) return;
/* Otherwise, we exited because we hit a new PDE boundary, so start over */
@@ -1379,7 +1379,7 @@ MiGetPageProtection(IN PMMPTE PointerPte)
{
/* The PTE is valid, so we might need to get the protection from
the PFN. Lock the PFN database */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
/* Check if the PDE is still valid */
if (MiAddressToPte(PointerPte)->u.Hard.Valid == 0)
@@ -1407,7 +1407,7 @@ MiGetPageProtection(IN PMMPTE PointerPte)
}
/* Release the PFN database */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
}
/* Lock the working set again */
@@ -2301,7 +2301,7 @@ MiProtectVirtualMemory(IN PEPROCESS Process,
if ((NewAccessProtection & PAGE_NOACCESS) ||
(NewAccessProtection & PAGE_GUARD))
{
- KIRQL OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ KIRQL OldIrql = MiAcquirePfnLock();
/* Mark the PTE as transition and change its protection */
PteContents.u.Hard.Valid = 0;
@@ -2318,7 +2318,7 @@ MiProtectVirtualMemory(IN PEPROCESS Process,
KeInvalidateTlbEntry(MiPteToAddress(PointerPte));
/* We are done for this PTE */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
}
else
{
@@ -2459,7 +2459,7 @@ MiProcessValidPteList(IN PMMPTE *ValidPteList,
//
// Acquire the PFN lock and loop all the PTEs in the list
//
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
for (i = 0; i != Count; i++)
{
//
@@ -2494,7 +2494,7 @@ MiProcessValidPteList(IN PMMPTE *ValidPteList,
// and then release the PFN lock
//
KeFlushCurrentTb();
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
}
ULONG
diff --git a/ntoskrnl/mm/ARM3/zeropage.c b/ntoskrnl/mm/ARM3/zeropage.c
index 4b0b9cbe64..e2b96ca56a 100644
--- a/ntoskrnl/mm/ARM3/zeropage.c
+++ b/ntoskrnl/mm/ARM3/zeropage.c
@@ -67,7 +67,7 @@ MmZeroPageThread(VOID)
FALSE,
NULL,
NULL);
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
MmZeroingPageThreadActive = TRUE;
while (TRUE)
@@ -75,7 +75,7 @@ MmZeroPageThread(VOID)
if (!MmFreePageListHead.Total)
{
MmZeroingPageThreadActive = FALSE;
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
break;
}
@@ -97,14 +97,14 @@ MmZeroPageThread(VOID)
}
Pfn1->u1.Flink = LIST_HEAD;
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
ZeroAddress = MiMapPagesInZeroSpace(Pfn1, 1);
ASSERT(ZeroAddress);
RtlZeroMemory(ZeroAddress, PAGE_SIZE);
MiUnmapPagesInZeroSpace(ZeroAddress, 1);
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
MiInsertPageInList(&MmZeroedPageListHead, PageIndex);
}
diff --git a/ntoskrnl/mm/amd64/page.c b/ntoskrnl/mm/amd64/page.c
index 964d488479..864302bd42 100644
--- a/ntoskrnl/mm/amd64/page.c
+++ b/ntoskrnl/mm/amd64/page.c
@@ -165,7 +165,7 @@ MiGetPteForProcess(
TmplPte.u.Flush.Owner = (Address < MmHighestUserAddress) ? 1 : 0;
/* Lock the PFN database */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
/* Get the PXE */
Pte = MiAddressToPxe(Address);
@@ -192,7 +192,7 @@ MiGetPteForProcess(
}
/* Unlock PFN database */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
}
else
{
@@ -610,7 +610,7 @@ MmCreateProcessAddressSpace(IN ULONG MinWs,
KeInitializeSpinLock(&Process->HyperSpaceLock);
/* Lock PFN database */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
/* Get a page for the table base and one for hyper space. The PFNs for
these pages will be initialized in MmInitializeProcessAddressSpace,
@@ -622,7 +622,7 @@ MmCreateProcessAddressSpace(IN ULONG MinWs,
WorkingSetPfn = MiRemoveAnyPage(MI_GET_NEXT_PROCESS_COLOR(Process));
/* Release PFN lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
/* Zero pages */ /// FIXME:
MiZeroPhysicalPage(HyperPfn);
diff --git a/ntoskrnl/mm/balance.c b/ntoskrnl/mm/balance.c
index e4b108aa07..324f3d84f7 100644
--- a/ntoskrnl/mm/balance.c
+++ b/ntoskrnl/mm/balance.c
@@ -357,7 +357,7 @@ MiBalancerThread(PVOID Unused)
PEPROCESS Process = PsGetCurrentProcess();
/* Acquire PFN lock */
- KIRQL OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ KIRQL OldIrql = MiAcquirePfnLock();
PMMPDE pointerPde;
for (Address = (ULONG_PTR)MI_LOWEST_VAD_ADDRESS;
Address < (ULONG_PTR)MM_HIGHEST_VAD_ADDRESS;
@@ -372,7 +372,7 @@ MiBalancerThread(PVOID Unused)
}
}
/* Release lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
}
#endif
do
@@ -410,7 +410,7 @@ BOOLEAN MmRosNotifyAvailablePage(PFN_NUMBER Page)
PMMPFN Pfn1;
/* Make sure the PFN lock is held */
- ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
+ MI_ASSERT_PFN_LOCK_HELD();
if (!MiMinimumAvailablePages)
{
diff --git a/ntoskrnl/mm/freelist.c b/ntoskrnl/mm/freelist.c
index 9cff79cb21..93d9bbd9f5 100644
--- a/ntoskrnl/mm/freelist.c
+++ b/ntoskrnl/mm/freelist.c
@@ -66,9 +66,9 @@ MmGetLRUFirstUserPage(VOID)
KIRQL OldIrql;
/* Find the first user page */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
Position = RtlFindSetBits(&MiUserPfnBitMap, 1, 0);
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
if (Position == 0xFFFFFFFF) return 0;
/* Return it */
@@ -87,9 +87,9 @@ MmInsertLRULastUserPage(PFN_NUMBER Pfn)
ASSERT(Pfn != 0);
ASSERT_IS_ROS_PFN(MiGetPfnEntry(Pfn));
ASSERT(!RtlCheckBit(&MiUserPfnBitMap, (ULONG)Pfn));
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
RtlSetBit(&MiUserPfnBitMap, (ULONG)Pfn);
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
}
PFN_NUMBER
@@ -100,9 +100,9 @@ MmGetLRUNextUserPage(PFN_NUMBER PreviousPfn)
KIRQL OldIrql;
/* Find the next user page */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
Position = RtlFindSetBits(&MiUserPfnBitMap, 1, (ULONG)PreviousPfn + 1);
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
if (Position == 0xFFFFFFFF) return 0;
/* Return it */
@@ -121,9 +121,9 @@ MmRemoveLRUUserPage(PFN_NUMBER Page)
ASSERT(Page != 0);
ASSERT_IS_ROS_PFN(MiGetPfnEntry(Page));
ASSERT(RtlCheckBit(&MiUserPfnBitMap, (ULONG)Page));
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
RtlClearBit(&MiUserPfnBitMap, (ULONG)Page);
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
}
BOOLEAN
@@ -217,7 +217,7 @@ MiAllocatePagesForMdl(IN PHYSICAL_ADDRESS LowAddress,
//
// Lock the PFN database
//
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
//
// Are we looking for any pages, without discriminating?
@@ -332,7 +332,7 @@ MiAllocatePagesForMdl(IN PHYSICAL_ADDRESS LowAddress,
//
// Now release the PFN count
//
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
//
// We might've found less pages, but not more ;-)
@@ -395,7 +395,7 @@ MmSetRmapListHeadPage(PFN_NUMBER Pfn, PMM_RMAP_ENTRY ListHead)
KIRQL oldIrql;
PMMPFN Pfn1;
- oldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ oldIrql = MiAcquirePfnLock();
Pfn1 = MiGetPfnEntry(Pfn);
ASSERT(Pfn1);
ASSERT_IS_ROS_PFN(Pfn1);
@@ -419,7 +419,7 @@ MmSetRmapListHeadPage(PFN_NUMBER Pfn, PMM_RMAP_ENTRY ListHead)
/* ReactOS semantics will now release the page, which will make it free and enter
a colored list */
}
- KeReleaseQueuedSpinLock(LockQueuePfnLock, oldIrql);
+ MiReleasePfnLock(oldIrql);
}
PMM_RMAP_ENTRY
@@ -431,7 +431,7 @@ MmGetRmapListHeadPage(PFN_NUMBER Pfn)
PMMPFN Pfn1;
/* Lock PFN database */
- oldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ oldIrql = MiAcquirePfnLock();
/* Get the entry */
Pfn1 = MiGetPfnEntry(Pfn);
@@ -445,7 +445,7 @@ MmGetRmapListHeadPage(PFN_NUMBER Pfn)
ASSERT(MiIsPfnInUse(Pfn1) == TRUE);
/* Release PFN database and return rmap list head */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, oldIrql);
+ MiReleasePfnLock(oldIrql);
return ListHead;
}
@@ -460,9 +460,9 @@ MmSetSavedSwapEntryPage(PFN_NUMBER Pfn, SWAPENTRY SwapEntry)
ASSERT(Pfn1);
ASSERT_IS_ROS_PFN(Pfn1);
- oldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ oldIrql = MiAcquirePfnLock();
Pfn1->u1.SwapEntry = SwapEntry;
- KeReleaseQueuedSpinLock(LockQueuePfnLock, oldIrql);
+ MiReleasePfnLock(oldIrql);
}
SWAPENTRY
@@ -477,9 +477,9 @@ MmGetSavedSwapEntryPage(PFN_NUMBER Pfn)
ASSERT(Pfn1);
ASSERT_IS_ROS_PFN(Pfn1);
- oldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ oldIrql = MiAcquirePfnLock();
SwapEntry = Pfn1->u1.SwapEntry;
- KeReleaseQueuedSpinLock(LockQueuePfnLock, oldIrql);
+ MiReleasePfnLock(oldIrql);
return(SwapEntry);
}
@@ -492,7 +492,7 @@ MmReferencePage(PFN_NUMBER Pfn)
DPRINT("MmReferencePage(PysicalAddress %x)\n", Pfn << PAGE_SHIFT);
- ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
+ MI_ASSERT_PFN_LOCK_HELD();
ASSERT(Pfn != 0);
ASSERT(Pfn <= MmHighestPhysicalPage);
@@ -514,14 +514,14 @@ MmGetReferenceCountPage(PFN_NUMBER Pfn)
DPRINT("MmGetReferenceCountPage(PhysicalAddress %x)\n", Pfn <<
PAGE_SHIFT);
- oldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ oldIrql = MiAcquirePfnLock();
Pfn1 = MiGetPfnEntry(Pfn);
ASSERT(Pfn1);
ASSERT_IS_ROS_PFN(Pfn1);
RCount = Pfn1->u3.e2.ReferenceCount;
- KeReleaseQueuedSpinLock(LockQueuePfnLock, oldIrql);
+ MiReleasePfnLock(oldIrql);
return(RCount);
}
@@ -540,7 +540,7 @@ MmDereferencePage(PFN_NUMBER Pfn)
KIRQL OldIrql;
DPRINT("MmDereferencePage(PhysicalAddress %x)\n", Pfn <<
PAGE_SHIFT);
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
Pfn1 = MiGetPfnEntry(Pfn);
ASSERT(Pfn1);
@@ -561,7 +561,7 @@ MmDereferencePage(PFN_NUMBER Pfn)
MiInsertPageInFreeList(Pfn);
}
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
}
PFN_NUMBER
@@ -572,7 +572,7 @@ MmAllocPage(ULONG Type)
PMMPFN Pfn1;
KIRQL OldIrql;
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
PfnOffset = MiRemoveZeroPage(MI_GET_NEXT_COLOR());
if (!PfnOffset)
@@ -592,7 +592,7 @@ MmAllocPage(ULONG Type)
Pfn1->u1.SwapEntry = 0;
Pfn1->RmapListHead = NULL;
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
return PfnOffset;
}
diff --git a/ntoskrnl/mm/marea.c b/ntoskrnl/mm/marea.c
index 12dcc6fd7d..1dc4d612d4 100644
--- a/ntoskrnl/mm/marea.c
+++ b/ntoskrnl/mm/marea.c
@@ -332,12 +332,12 @@ MmFreeMemoryArea(
if (MiQueryPageTableReferences((PVOID)Address) == 0)
{
/* No PTE relies on this PDE. Release it */
- KIRQL OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ KIRQL OldIrql = MiAcquirePfnLock();
PMMPDE PointerPde = MiAddressToPde(Address);
ASSERT(PointerPde->u.Hard.Valid == 1);
MiDeletePte(PointerPde, MiPdeToPte(PointerPde), Process, NULL);
ASSERT(PointerPde->u.Hard.Valid == 0);
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
}
}
#endif
@@ -594,7 +594,7 @@ MmDeleteProcessAddressSpace(PEPROCESS Process)
KeAttachProcess(&Process->Pcb);
/* Acquire PFN lock */
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
for (Address = MI_LOWEST_VAD_ADDRESS;
Address < MM_HIGHEST_VAD_ADDRESS;
@@ -619,7 +619,7 @@ MmDeleteProcessAddressSpace(PEPROCESS Process)
}
/* Release lock */
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
/* Detach */
KeDetachProcess();
diff --git a/ntoskrnl/mm/section.c b/ntoskrnl/mm/section.c
index 1b679fd224..66fa6d2245 100644
--- a/ntoskrnl/mm/section.c
+++ b/ntoskrnl/mm/section.c
@@ -1982,9 +1982,9 @@ MmPageOutSectionView(PMMSUPPORT AddressSpace,
}
else
{
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ OldIrql = MiAcquirePfnLock();
MmReferencePage(Page);
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ MiReleasePfnLock(OldIrql);
}
MmDeleteAllRmaps(Page, (PVOID)&Context, MmPageOutDeleteMapping);