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