Fix two minor defects:

1. CoreGetMemoryMap() returns unclean data
2. Zero length memory descriptor might be added to the memory map

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4790 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qhuang8 2008-03-04 11:33:13 +00:00
parent 9521b669f8
commit 383c303c49
2 changed files with 4 additions and 1 deletions

View File

@ -2473,6 +2473,9 @@ Returns:
if (MemorySpaceMap[Index].ImageHandle == NULL) {
BaseAddress = PageAlignAddress (MemorySpaceMap[Index].BaseAddress);
Length = PageAlignLength (MemorySpaceMap[Index].BaseAddress + MemorySpaceMap[Index].Length - BaseAddress);
if (Length == 0 || MemorySpaceMap[Index].BaseAddress + MemorySpaceMap[Index].Length < BaseAddress) {
continue;
}
CoreAddMemoryDescriptor (
EfiConventionalMemory,
BaseAddress,

View File

@ -1432,7 +1432,7 @@ Returns:
//
// Build the map
//
ZeroMem (MemoryMap, Size);
ZeroMem (MemoryMap, BufferSize);
for (Link = gMemoryMap.ForwardLink; Link != &gMemoryMap; Link = Link->ForwardLink) {
Entry = CR (Link, MEMORY_MAP, Link, MEMORY_MAP_SIGNATURE);
ASSERT (Entry->VirtualStart == 0);