Refactor PFN database initialization loop on i686
This commit is contained in:
@@ -69,27 +69,36 @@ MM::Pfn::InitializePfnDatabase(VOID)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Split PFN DB allocation out of free descriptor */
|
/* Check if this is the modified free descriptor */
|
||||||
if(Descriptor == FreeDescriptor)
|
if(Descriptor == FreeDescriptor)
|
||||||
{
|
{
|
||||||
/* Initialize PFNs for the remaining free memory after the PFN database */
|
/* Switch to the original descriptor */
|
||||||
ProcessMemoryDescriptor(OriginalFreeDescriptor.BasePage + MemoryLayout->PfnDatabaseSize,
|
Descriptor = &OriginalFreeDescriptor;
|
||||||
OriginalFreeDescriptor.PageCount - MemoryLayout->PfnDatabaseSize,
|
}
|
||||||
LoaderFree);
|
|
||||||
|
|
||||||
/* Initialize PFNs for the physical pages backing the PFN database itself */
|
/* Check if the free memory block that was split is being processed */
|
||||||
ProcessMemoryDescriptor(OriginalFreeDescriptor.BasePage, MemoryLayout->PfnDatabaseSize, LoaderMemoryData);
|
if(Descriptor == &OriginalFreeDescriptor)
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
/* Initialize PFNs for the physical pages described by this descriptor */
|
/* Skip loop processing, free memory is initialized separately */
|
||||||
ProcessMemoryDescriptor(Descriptor->BasePage, Descriptor->PageCount, Descriptor->MemoryType);
|
ListEntry = ListEntry->Flink;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Initialize PFNs for this memory range */
|
||||||
|
ProcessMemoryDescriptor(Descriptor->BasePage, Descriptor->PageCount, Descriptor->MemoryType);
|
||||||
|
|
||||||
/* Move to the next descriptor */
|
/* Move to the next descriptor */
|
||||||
ListEntry = ListEntry->Flink;
|
ListEntry = ListEntry->Flink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Initialize PFNs for the free memory */
|
||||||
|
ProcessMemoryDescriptor(FreeDescriptor->BasePage, FreeDescriptor->PageCount, LoaderFree);
|
||||||
|
|
||||||
|
/* Initialize PFNs for the physical pages backing the PFN database */
|
||||||
|
ProcessMemoryDescriptor(OriginalFreeDescriptor.BasePage,
|
||||||
|
FreeDescriptor->BasePage - OriginalFreeDescriptor.BasePage,
|
||||||
|
LoaderMemoryData);
|
||||||
|
|
||||||
/* Restore original free descriptor */
|
/* Restore original free descriptor */
|
||||||
*FreeDescriptor = OriginalFreeDescriptor;
|
*FreeDescriptor = OriginalFreeDescriptor;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user