[BOOT] Execution contexts and more refactoring

This commit is contained in:
2024-10-05 15:44:25 -04:00
parent 7c3dafc051
commit 24a31cab26
13 changed files with 317 additions and 118 deletions

View File

@@ -88,14 +88,13 @@ Return Value:
NTSTATUS Status;
PMEMORY_DESCRIPTOR Descriptor, NewDescriptor;
(VOID)MemoryInfo;
DebugPrint(L"Initializing page allocator...\r\n");
PapMinimumAllocationCount = MinimumAllocation;
PapMinimumPhysicalPage = 1;
PapMaximumPhysicalPage = MAXULONGLONG >> PAGE_SHIFT;
//
// Initialize Memory Descriptor Lists
//
InitializeMdl(&MmMdlFwAllocationTracker);
InitializeMdl(&MmMdlBadMemory);
InitializeMdl(&MmMdlTruncatedMemory);
@@ -116,11 +115,18 @@ Return Value:
// MDL the memory manager will use for allocation.
//
Descriptor = (PMEMORY_DESCRIPTOR)((PUCHAR)MemoryInfo + MemoryInfo->MdlOffset);
for (ULONG DescriptorCount = MemoryInfo->DescriptorCount; DescriptorCount > 0; DescriptorCount--) {
for (ULONG DescriptorCount = MemoryInfo->DescriptorCount;
DescriptorCount > 0;
DescriptorCount--) {
//
// Remove from the usable MDL.
//
Status = MmMdRemoveRegionFromMdlEx(&MmMdlUnmappedUnallocated, Descriptor->FirstPage, Descriptor->PageCount, MDL_OPERATION_FLAGS_PHYSICAL, NULL);
Status = MmMdRemoveRegionFromMdl(
&MmMdlUnmappedUnallocated,
Descriptor->FirstPage,
Descriptor->PageCount,
MDL_OPERATION_FLAGS_PHYSICAL
);
if (!NT_SUCCESS(Status)) {
return STATUS_INVALID_PARAMETER;
}