提交 6b822bc7 编写于 作者: V vit9696

OcMemoryLib: Handle appending entries from MMAP to MAT end

上级 dfe685d8
......@@ -192,6 +192,7 @@ OcExpandAttributesByMap (
UINTN MatIndex;
EFI_PHYSICAL_ADDRESS LastAddress;
BOOLEAN DoneWithMat;
BOOLEAN LastMat;
MatIndex = 0;
Status = EFI_NOT_FOUND;
......@@ -204,13 +205,14 @@ OcExpandAttributesByMap (
DoneWithMat = FALSE;
while (MatIndex < MemoryAttributesTable->NumberOfEntries && !DoneWithMat) {
LastMat = (MatIndex + 1) == MemoryAttributesTable->NumberOfEntries;
if (MemoryAttributesEntry->PhysicalStart >= MemoryMap->PhysicalStart
&& MemoryAttributesEntry->PhysicalStart <= LastAddress) {
//
// We have an attribute for that memory map descriptor, assume it is parsed.
//
DoneWithMat = TRUE;
} else if (LastAddress < MemoryAttributesEntry->PhysicalStart) {
} else if (LastAddress < MemoryAttributesEntry->PhysicalStart || LastMat) {
//
// We have an attribute past the memory map descriptor, insert the new one here.
//
......@@ -244,6 +246,12 @@ OcExpandAttributesByMap (
++MemoryAttributesTable->NumberOfEntries;
DoneWithMat = TRUE;
Status = EFI_SUCCESS;
//
// Do not increment on last mat, as we may add multiple entries past last.
//
if (LastMat) {
break;
}
}
MemoryAttributesEntry = NEXT_MEMORY_DESCRIPTOR (
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册