mirror of
https://github.com/reactos/reactos.git
synced 2026-05-30 23:33:24 +08:00
[NTOS:MM] Assert PFN lock ownership in MiInsertPageInFreeList.
AMD64 initialization previously only raised the IRQL. It now acquires the lock where needed, as i386 does.
This commit is contained in:
@@ -611,7 +611,7 @@ MiInsertPageInFreeList(IN PFN_NUMBER PageFrameIndex)
|
||||
PMMCOLOR_TABLES ColorTable;
|
||||
|
||||
/* Make sure the page index is valid */
|
||||
ASSERT(KeGetCurrentIrql() >= DISPATCH_LEVEL);
|
||||
MI_ASSERT_PFN_LOCK_HELD();
|
||||
ASSERT((PageFrameIndex != 0) &&
|
||||
(PageFrameIndex <= MmHighestPhysicalPage) &&
|
||||
(PageFrameIndex >= MmLowestPhysicalPage));
|
||||
|
||||
@@ -533,6 +533,7 @@ MiAddDescriptorToDatabase(
|
||||
TYPE_OF_MEMORY MemoryType)
|
||||
{
|
||||
PMMPFN Pfn;
|
||||
KIRQL OldIrql;
|
||||
|
||||
ASSERT(!MiIsMemoryTypeInvisible(MemoryType));
|
||||
|
||||
@@ -542,6 +543,9 @@ MiAddDescriptorToDatabase(
|
||||
/* Get the last pfn of this descriptor. Note we loop backwards */
|
||||
Pfn = &MmPfnDatabase[BasePage + PageCount - 1];
|
||||
|
||||
/* Lock the PFN Database */
|
||||
OldIrql = MiAcquirePfnLock();
|
||||
|
||||
/* Loop all pages */
|
||||
while (PageCount--)
|
||||
{
|
||||
@@ -552,6 +556,9 @@ MiAddDescriptorToDatabase(
|
||||
/* Go to the previous page */
|
||||
Pfn--;
|
||||
}
|
||||
|
||||
/* Release PFN database */
|
||||
MiReleasePfnLock(OldIrql);
|
||||
}
|
||||
else if (MemoryType == LoaderXIPRom)
|
||||
{
|
||||
@@ -668,8 +675,6 @@ NTAPI
|
||||
INIT_FUNCTION
|
||||
MiInitMachineDependent(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
{
|
||||
KIRQL OldIrql;
|
||||
|
||||
ASSERT(MxPfnAllocation != 0);
|
||||
|
||||
/* Set some hardcoded addresses */
|
||||
@@ -693,9 +698,6 @@ MiInitMachineDependent(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
|
||||
MiBuildSystemPteSpace();
|
||||
|
||||
/* Need to be at DISPATCH_LEVEL for MiInsertPageInFreeList */
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
||||
|
||||
/* Map the PFN database pages */
|
||||
MiBuildPfnDatabase(LoaderBlock);
|
||||
|
||||
@@ -705,16 +707,9 @@ MiInitMachineDependent(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
/* PFNs are initialized now! */
|
||||
MiPfnsInitialized = TRUE;
|
||||
|
||||
//KeLowerIrql(OldIrql);
|
||||
|
||||
/* Need to be at DISPATCH_LEVEL for InitializePool */
|
||||
//KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
||||
|
||||
/* Initialize the nonpaged pool */
|
||||
InitializePool(NonPagedPool, 0);
|
||||
|
||||
KeLowerIrql(OldIrql);
|
||||
|
||||
/* Initialize the balancer */
|
||||
MmInitializeBalancer((ULONG)MmAvailablePages, 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user