mirror of
https://github.com/reactos/reactos.git
synced 2025-08-01 23:53:07 +00:00
[BOOTLIB]: Separate free and zero memory, and code vs data runtime data, as newer bootlibs do.
[BOOTLIB]: Fix bugs in MmMdpHasPrecedence and cleanup. [BOOTLIB]: Fix bug in MmMdFreeDescriptor. [BOOTLIB]: Cleanup MmMdpSaveCurrentListPointer. [BOOTLIB]: Fix bug in MmMdpCoalesceDescriptor. [BOOTLIB]: Fix multiple bugs in MmMdAddDescriptorToList, and cleanup. svn path=/trunk/; revision=74536
This commit is contained in:
parent
c7afd6f90c
commit
29d82352a3
4 changed files with 129 additions and 122 deletions
|
@ -329,12 +329,14 @@ typedef enum _BL_MEMORY_TYPE
|
||||||
BlUnusableMemory = 0xF0000002,
|
BlUnusableMemory = 0xF0000002,
|
||||||
BlReservedMemory = 0xF0000003,
|
BlReservedMemory = 0xF0000003,
|
||||||
BlEfiBootMemory = 0xF0000004,
|
BlEfiBootMemory = 0xF0000004,
|
||||||
BlEfiRuntimeMemory = 0xF0000006,
|
BlConventionalZeroedMemory = 0xF000005,
|
||||||
|
BlEfiRuntimeCodeMemory = 0xF0000006,
|
||||||
BlAcpiReclaimMemory = 0xF0000008,
|
BlAcpiReclaimMemory = 0xF0000008,
|
||||||
BlAcpiNvsMemory = 0xF0000009,
|
BlAcpiNvsMemory = 0xF0000009,
|
||||||
BlDeviceIoMemory = 0xF000000A,
|
BlDeviceIoMemory = 0xF000000A,
|
||||||
BlDevicePortMemory = 0xF000000B,
|
BlDevicePortMemory = 0xF000000B,
|
||||||
BlPalMemory = 0xF000000C,
|
BlPalMemory = 0xF000000C,
|
||||||
|
BlEfiRuntimeDataMemory = 0xF000000E,
|
||||||
} BL_MEMORY_TYPE;
|
} BL_MEMORY_TYPE;
|
||||||
|
|
||||||
typedef enum _BL_MEMORY_ATTR
|
typedef enum _BL_MEMORY_ATTR
|
||||||
|
|
|
@ -1343,8 +1343,11 @@ MmFwpGetOsMemoryType (
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EfiRuntimeServicesCode:
|
case EfiRuntimeServicesCode:
|
||||||
|
OsType = BlEfiRuntimeCodeMemory;
|
||||||
|
break;
|
||||||
|
|
||||||
case EfiRuntimeServicesData:
|
case EfiRuntimeServicesData:
|
||||||
OsType = BlEfiRuntimeMemory;
|
OsType = BlEfiRuntimeDataMemory;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EfiConventionalMemory:
|
case EfiConventionalMemory:
|
||||||
|
|
|
@ -26,14 +26,39 @@ BL_MEMORY_TYPE MmPlatformMemoryTypePrecedence[] =
|
||||||
BlDeviceIoMemory,
|
BlDeviceIoMemory,
|
||||||
BlDevicePortMemory,
|
BlDevicePortMemory,
|
||||||
BlPalMemory,
|
BlPalMemory,
|
||||||
BlEfiRuntimeMemory,
|
BlEfiRuntimeCodeMemory,
|
||||||
|
BlEfiRuntimeDataMemory,
|
||||||
BlAcpiNvsMemory,
|
BlAcpiNvsMemory,
|
||||||
BlAcpiReclaimMemory,
|
BlAcpiReclaimMemory,
|
||||||
BlEfiBootMemory
|
BlEfiBootMemory,
|
||||||
|
BlConventionalMemory,
|
||||||
|
BlConventionalZeroedMemory
|
||||||
};
|
};
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
LONG
|
||||||
|
MmMdpLookupTypePrecedenceIndex (
|
||||||
|
_In_ BL_MEMORY_TYPE Type
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ULONG i;
|
||||||
|
|
||||||
|
/* Check the precedence array */
|
||||||
|
for (i = 0; i < RTL_NUMBER_OF(MmPlatformMemoryTypePrecedence); i++)
|
||||||
|
{
|
||||||
|
/* Check for a match */
|
||||||
|
if (MmPlatformMemoryTypePrecedence[i] == Type)
|
||||||
|
{
|
||||||
|
/* Return the index */
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Invalid index type */
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* The order is Conventional > Other > System > Loader > Application */
|
/* The order is Conventional > Other > System > Loader > Application */
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
MmMdpHasPrecedence (
|
MmMdpHasPrecedence (
|
||||||
|
@ -44,14 +69,14 @@ MmMdpHasPrecedence (
|
||||||
BL_MEMORY_CLASS Class1, Class2;
|
BL_MEMORY_CLASS Class1, Class2;
|
||||||
ULONG i, j;
|
ULONG i, j;
|
||||||
|
|
||||||
/* Descriptor is free RAM -- it precedes */
|
/* It isn't free RAM, but the comparator is -- it succeeds it */
|
||||||
if (Type1 == BlConventionalMemory)
|
if (Type2 == BlConventionalMemory)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* It isn't free RAM, but the comparator is -- it succeeds it */
|
/* Descriptor is free RAM -- it precedes */
|
||||||
if (Type2 == BlConventionalMemory)
|
if (Type1 == BlConventionalMemory)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -77,55 +102,30 @@ MmMdpHasPrecedence (
|
||||||
/* Descriptor is system class */
|
/* Descriptor is system class */
|
||||||
if (Class1 == BlSystemClass)
|
if (Class1 == BlSystemClass)
|
||||||
{
|
{
|
||||||
/* And so is the other guy... */
|
/* If the other guy isn't, system wins */
|
||||||
if (Class2 == BlSystemClass)
|
if (Class2 != BlSystemClass)
|
||||||
{
|
{
|
||||||
i = 0;
|
return TRUE;
|
||||||
j = 0;
|
|
||||||
|
|
||||||
/* Scan for the descriptor's system precedence index */
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if (MmPlatformMemoryTypePrecedence[j] == Type1)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} while (++j < RTL_NUMBER_OF(MmPlatformMemoryTypePrecedence));
|
|
||||||
|
|
||||||
/* Use an invalid index if one wasn't found */
|
|
||||||
if (j == RTL_NUMBER_OF(MmPlatformMemoryTypePrecedence))
|
|
||||||
{
|
|
||||||
j = 0xFFFFFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Now scan for the comparator's system precedence index */
|
|
||||||
while (MmPlatformMemoryTypePrecedence[i] != Type2)
|
|
||||||
{
|
|
||||||
/* Use an invalid index if one wasn't found */
|
|
||||||
if (++i >= RTL_NUMBER_OF(MmPlatformMemoryTypePrecedence))
|
|
||||||
{
|
|
||||||
i = 0xFFFFFFFF;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Does the current have a valid index? */
|
|
||||||
if (j != 0xFFFFFFFF)
|
|
||||||
{
|
|
||||||
/* Yes, what about the comparator? */
|
|
||||||
if (i != 0xFFFFFFFF)
|
|
||||||
{
|
|
||||||
/* Let the indexes fight! */
|
|
||||||
return i >= j;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Succeed the comparator, its index is unknown */
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The comparator isn't system, so it precedes it */
|
/* Scan for the descriptor's system precedence index */
|
||||||
return TRUE;
|
i = MmMdpLookupTypePrecedenceIndex(Type1);
|
||||||
|
j = MmMdpLookupTypePrecedenceIndex(Type2);
|
||||||
|
|
||||||
|
/* Does the current have a valid index? */
|
||||||
|
if (i == 0xFFFFFFFF)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Yes, what about the comparator? */
|
||||||
|
if (j == 0xFFFFFFFF)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Let the indexes fight! */
|
||||||
|
return i <= j;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Descriptor is not system class, but comparator is -- it succeeds it */
|
/* Descriptor is not system class, but comparator is -- it succeeds it */
|
||||||
|
@ -134,7 +134,7 @@ MmMdpHasPrecedence (
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Descriptor is loader class -- it precedes */
|
/* Descriptor is loader class -- it preceedes */
|
||||||
if (Class1 == BlLoaderClass)
|
if (Class1 == BlLoaderClass)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -163,8 +163,9 @@ MmMdFreeDescriptor (
|
||||||
/* Check if this is a valid static descriptor */
|
/* Check if this is a valid static descriptor */
|
||||||
if (((MmDynamicMemoryDescriptors) &&
|
if (((MmDynamicMemoryDescriptors) &&
|
||||||
(MemoryDescriptor >= MmDynamicMemoryDescriptors) &&
|
(MemoryDescriptor >= MmDynamicMemoryDescriptors) &&
|
||||||
(MemoryDescriptor < (MmDynamicMemoryDescriptors + MmDynamicMemoryDescriptorCount))) ||
|
(MemoryDescriptor < &MmDynamicMemoryDescriptors[MmDynamicMemoryDescriptorCount])) ||
|
||||||
((MemoryDescriptor >= MmStaticMemoryDescriptors) && (MemoryDescriptor < &MmStaticMemoryDescriptors[511])))
|
((MemoryDescriptor >= MmStaticMemoryDescriptors) &&
|
||||||
|
(MemoryDescriptor < &MmStaticMemoryDescriptors[RTL_NUMBER_OF(MmStaticMemoryDescriptors)])))
|
||||||
{
|
{
|
||||||
/* It's a global/static descriptor, so just zero it */
|
/* It's a global/static descriptor, so just zero it */
|
||||||
RtlZeroMemory(MemoryDescriptor, sizeof(BL_MEMORY_DESCRIPTOR));
|
RtlZeroMemory(MemoryDescriptor, sizeof(BL_MEMORY_DESCRIPTOR));
|
||||||
|
@ -188,9 +189,13 @@ MmMdpSaveCurrentListPointer (
|
||||||
_In_ PLIST_ENTRY Current
|
_In_ PLIST_ENTRY Current
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
PBL_MEMORY_DESCRIPTOR FirstEntry, LastEntry;
|
||||||
|
|
||||||
/* Make sure that this is not a global descriptor and not the first one */
|
/* Make sure that this is not a global descriptor and not the first one */
|
||||||
if (((Current < &MmGlobalMemoryDescriptors->ListEntry) ||
|
FirstEntry = &MmGlobalMemoryDescriptors[0];
|
||||||
(Current >= &MmGlobalMemoryDescriptors[MmGlobalMemoryDescriptorCount].ListEntry)) &&
|
LastEntry = &MmGlobalMemoryDescriptors[MmGlobalMemoryDescriptorCount];
|
||||||
|
if ((((ULONG_PTR)Current < (ULONG_PTR)FirstEntry) ||
|
||||||
|
((ULONG_PTR)Current >= (ULONG_PTR)LastEntry)) &&
|
||||||
(Current != MdList->First))
|
(Current != MdList->First))
|
||||||
{
|
{
|
||||||
/* Save this as the current pointer */
|
/* Save this as the current pointer */
|
||||||
|
@ -390,7 +395,7 @@ MmMdInitByteGranularDescriptor (
|
||||||
|
|
||||||
/* Take one of the available descriptors and fill it out */
|
/* Take one of the available descriptors and fill it out */
|
||||||
MemoryDescriptor = &MmGlobalMemoryDescriptors[MmGlobalMemoryDescriptorsUsed];
|
MemoryDescriptor = &MmGlobalMemoryDescriptors[MmGlobalMemoryDescriptorsUsed];
|
||||||
MemoryDescriptor->BaseAddress = BasePage;
|
MemoryDescriptor->BasePage = BasePage;
|
||||||
MemoryDescriptor->VirtualPage = VirtualPage;
|
MemoryDescriptor->VirtualPage = VirtualPage;
|
||||||
MemoryDescriptor->PageCount = PageCount;
|
MemoryDescriptor->PageCount = PageCount;
|
||||||
MemoryDescriptor->Flags = Flags;
|
MemoryDescriptor->Flags = Flags;
|
||||||
|
@ -485,9 +490,9 @@ MmMdpCoalesceDescriptor (
|
||||||
(NextDescriptor->Type == MemoryDescriptor->Type) &&
|
(NextDescriptor->Type == MemoryDescriptor->Type) &&
|
||||||
((NextDescriptor->Flags ^ MemoryDescriptor->Flags) & 0x1B19FFFF) &&
|
((NextDescriptor->Flags ^ MemoryDescriptor->Flags) & 0x1B19FFFF) &&
|
||||||
(EndPage == NextDescriptor->BasePage) &&
|
(EndPage == NextDescriptor->BasePage) &&
|
||||||
((!(MemoryDescriptor->VirtualPage) && !(PreviousDescriptor->VirtualPage)) ||
|
((!(MemoryDescriptor->VirtualPage) && !(NextDescriptor->VirtualPage)) ||
|
||||||
((MemoryDescriptor->VirtualPage) && (PreviousDescriptor->VirtualPage) &&
|
((MemoryDescriptor->VirtualPage) && (NextDescriptor->VirtualPage) &&
|
||||||
(MappedEndPage == NextDescriptor->VirtualPage))))
|
(MappedEndPage == NextDescriptor->VirtualPage))))
|
||||||
{
|
{
|
||||||
EfiPrintf(L"Next descriptor coalescable!\r\n");
|
EfiPrintf(L"Next descriptor coalescable!\r\n");
|
||||||
}
|
}
|
||||||
|
@ -516,15 +521,12 @@ MmMdAddDescriptorToList (
|
||||||
if (Flags & BL_MM_ADD_DESCRIPTOR_NEVER_COALESCE_FLAG)
|
if (Flags & BL_MM_ADD_DESCRIPTOR_NEVER_COALESCE_FLAG)
|
||||||
{
|
{
|
||||||
/* Then we won't be coalescing */
|
/* Then we won't be coalescing */
|
||||||
Flags &= BL_MM_ADD_DESCRIPTOR_COALESCE_FLAG;
|
Flags &= ~BL_MM_ADD_DESCRIPTOR_COALESCE_FLAG;
|
||||||
}
|
}
|
||||||
else
|
else if (MemoryDescriptor->Flags & BlMemoryCoalesced)
|
||||||
{
|
{
|
||||||
/* Coalesce if the descriptor requires it */
|
/* Coalesce if the descriptor requires it */
|
||||||
if (MemoryDescriptor->Flags & BlMemoryCoalesced)
|
Flags |= BL_MM_ADD_DESCRIPTOR_COALESCE_FLAG;
|
||||||
{
|
|
||||||
Flags |= BL_MM_ADD_DESCRIPTOR_COALESCE_FLAG;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if truncation is forcefully disabled */
|
/* Check if truncation is forcefully disabled */
|
||||||
|
@ -548,82 +550,81 @@ MmMdAddDescriptorToList (
|
||||||
|
|
||||||
/* Check if there's no current pointer, or if it's higher than the new one */
|
/* Check if there's no current pointer, or if it's higher than the new one */
|
||||||
if (!(ThisEntry) ||
|
if (!(ThisEntry) ||
|
||||||
(MemoryDescriptor->BaseAddress <= ThisDescriptor->BaseAddress))
|
(MemoryDescriptor->BasePage <= ThisDescriptor->BasePage))
|
||||||
{
|
{
|
||||||
/* Start at the first descriptor instead, since current is past us */
|
/* Start at the first descriptor instead, since current is past us */
|
||||||
ThisEntry = FirstEntry->Flink;
|
ThisEntry = FirstEntry->Flink;
|
||||||
ThisDescriptor = CONTAINING_RECORD(ThisEntry, BL_MEMORY_DESCRIPTOR, ListEntry);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Loop until we find the right location to insert */
|
/* Loop until we find the right location to insert */
|
||||||
while (1)
|
while (ThisEntry != FirstEntry)
|
||||||
{
|
{
|
||||||
/* Have we gotten back to the first entry? */
|
/* Get the descriptor part of this entry */
|
||||||
if (ThisEntry == FirstEntry)
|
ThisDescriptor = CONTAINING_RECORD(ThisEntry, BL_MEMORY_DESCRIPTOR, ListEntry);
|
||||||
{
|
|
||||||
/* Then we didn't find a good match, so insert it right here */
|
|
||||||
InsertTailList(FirstEntry, &MemoryDescriptor->ListEntry);
|
|
||||||
|
|
||||||
/* Do we have to truncate? */
|
/* Is the address smaller, or equal but more important? */
|
||||||
if (Flags & BL_MM_ADD_DESCRIPTOR_TRUNCATE_FLAG)
|
if ((MemoryDescriptor->BasePage < ThisDescriptor->BasePage) ||
|
||||||
{
|
((MemoryDescriptor->BasePage == ThisDescriptor->BasePage) &&
|
||||||
/* Do it and then exit */
|
(MmMdpHasPrecedence(MemoryDescriptor->Type, ThisDescriptor->Type))))
|
||||||
if (MmMdpTruncateDescriptor(MdList, MemoryDescriptor, Flags))
|
|
||||||
{
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Do we have to coalesce? */
|
|
||||||
if (Flags & BL_MM_ADD_DESCRIPTOR_COALESCE_FLAG)
|
|
||||||
{
|
|
||||||
/* Do it and then exit */
|
|
||||||
if (MmMdpCoalesceDescriptor(MdList, MemoryDescriptor, Flags))
|
|
||||||
{
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Do we have to update the current pointer? */
|
|
||||||
if (Flags & BL_MM_ADD_DESCRIPTOR_UPDATE_LIST_POINTER_FLAG)
|
|
||||||
{
|
|
||||||
/* Do it */
|
|
||||||
MmMdpSaveCurrentListPointer(MdList, &MemoryDescriptor->ListEntry);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We're done */
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Is the new descriptor below this address, and has precedence over it? */
|
|
||||||
if ((MemoryDescriptor->BaseAddress < ThisDescriptor->BaseAddress) &&
|
|
||||||
(MmMdpHasPrecedence(MemoryDescriptor->Type, ThisDescriptor->Type)))
|
|
||||||
{
|
{
|
||||||
/* Then insert right here */
|
/* Then insert right here */
|
||||||
InsertTailList(ThisEntry, &MemoryDescriptor->ListEntry);
|
InsertTailList(ThisEntry, &MemoryDescriptor->ListEntry);
|
||||||
return STATUS_SUCCESS;
|
goto Quickie;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try the next descriptor */
|
/* Try the next entry */
|
||||||
ThisEntry = ThisEntry->Flink;
|
ThisEntry = ThisEntry->Flink;
|
||||||
ThisDescriptor = CONTAINING_RECORD(ThisEntry, BL_MEMORY_DESCRIPTOR, ListEntry);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Then we didn't find a good match, so insert it right here */
|
||||||
|
InsertTailList(FirstEntry, &MemoryDescriptor->ListEntry);
|
||||||
|
|
||||||
|
Quickie:
|
||||||
|
/* Do we have to truncate? */
|
||||||
|
if (Flags & BL_MM_ADD_DESCRIPTOR_TRUNCATE_FLAG)
|
||||||
|
{
|
||||||
|
/* Do it and then exit */
|
||||||
|
if (MmMdpTruncateDescriptor(MdList, MemoryDescriptor, Flags))
|
||||||
|
{
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Do we have to coalesce? */
|
||||||
|
if (Flags & BL_MM_ADD_DESCRIPTOR_COALESCE_FLAG)
|
||||||
|
{
|
||||||
|
/* Do it and then exit */
|
||||||
|
if (MmMdpCoalesceDescriptor(MdList, MemoryDescriptor, Flags))
|
||||||
|
{
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Do we have to update the current pointer? */
|
||||||
|
if (Flags & BL_MM_ADD_DESCRIPTOR_UPDATE_LIST_POINTER_FLAG)
|
||||||
|
{
|
||||||
|
/* Do it */
|
||||||
|
MmMdpSaveCurrentListPointer(MdList, &MemoryDescriptor->ListEntry);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We're done */
|
||||||
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
MmMdRemoveRegionFromMdlEx (
|
MmMdRemoveRegionFromMdlEx (
|
||||||
__in PBL_MEMORY_DESCRIPTOR_LIST MdList,
|
_In_ PBL_MEMORY_DESCRIPTOR_LIST MdList,
|
||||||
__in ULONG Flags,
|
_In_ ULONG Flags,
|
||||||
__in ULONGLONG BasePage,
|
_In_ ULONGLONG BasePage,
|
||||||
__in ULONGLONG PageCount,
|
_In_ ULONGLONG PageCount,
|
||||||
__in PBL_MEMORY_DESCRIPTOR_LIST NewMdList
|
_Out_opt_ PBL_MEMORY_DESCRIPTOR_LIST NewMdList
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
BOOLEAN HaveNewList, UseVirtualPage;
|
BOOLEAN HaveNewList, UseVirtualPage;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PLIST_ENTRY ListHead, NextEntry;
|
PLIST_ENTRY ListHead, NextEntry;
|
||||||
PBL_MEMORY_DESCRIPTOR Descriptor;
|
PBL_MEMORY_DESCRIPTOR Descriptor;
|
||||||
BL_MEMORY_DESCRIPTOR NewDescriptor;
|
//BL_MEMORY_DESCRIPTOR NewDescriptor;
|
||||||
ULONGLONG RegionSize;
|
ULONGLONG RegionSize;
|
||||||
ULONGLONG FoundBasePage, FoundEndPage, FoundPageCount, EndPage;
|
ULONGLONG FoundBasePage, FoundEndPage, FoundPageCount, EndPage;
|
||||||
|
|
||||||
|
@ -683,7 +684,7 @@ MmMdRemoveRegionFromMdlEx (
|
||||||
EndPage = PageCount + BasePage;
|
EndPage = PageCount + BasePage;
|
||||||
|
|
||||||
/* Make a copy of the original descriptor */
|
/* Make a copy of the original descriptor */
|
||||||
RtlCopyMemory(&NewDescriptor, NextEntry, sizeof(NewDescriptor));
|
//NewDescriptor = *Descriptor; // FIXME: Need to use this somewhere...
|
||||||
|
|
||||||
/* Check if the region to be removed starts after the found region starts */
|
/* Check if the region to be removed starts after the found region starts */
|
||||||
if ((BasePage > FoundBasePage) || (FoundBasePage >= EndPage))
|
if ((BasePage > FoundBasePage) || (FoundBasePage >= EndPage))
|
||||||
|
|
|
@ -790,7 +790,8 @@ Mmx86pMapMemoryRegions (
|
||||||
/* Check if this is a UEFI-related descriptor, unless it's the self-map page */
|
/* Check if this is a UEFI-related descriptor, unless it's the self-map page */
|
||||||
Descriptor = CONTAINING_RECORD(NextEntry, BL_MEMORY_DESCRIPTOR, ListEntry);
|
Descriptor = CONTAINING_RECORD(NextEntry, BL_MEMORY_DESCRIPTOR, ListEntry);
|
||||||
if (((Descriptor->Type == BlEfiBootMemory) ||
|
if (((Descriptor->Type == BlEfiBootMemory) ||
|
||||||
(Descriptor->Type == BlEfiRuntimeMemory) ||
|
(Descriptor->Type == BlEfiRuntimeCodeMemory) ||
|
||||||
|
(Descriptor->Type == BlEfiRuntimeDataMemory) || // WINBUG?
|
||||||
(Descriptor->Type == BlLoaderMemory)) &&
|
(Descriptor->Type == BlLoaderMemory)) &&
|
||||||
((Descriptor->BasePage << PAGE_SHIFT) != Mmx86SelfMapBase.QuadPart))
|
((Descriptor->BasePage << PAGE_SHIFT) != Mmx86SelfMapBase.QuadPart))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue