- Fixed a crash which occurs if the maxmem option

reduces the memory size from the bios memory map.

svn path=/trunk/; revision=6418
This commit is contained in:
Hartmut Birr 2003-10-23 19:36:33 +00:00
parent 360e3be08a
commit 85a1b9d2bd

View file

@ -233,7 +233,7 @@ MiParseRangeToFreeList(PADDRESS_RANGE Range)
first = (Range->BaseAddrLow + PAGE_SIZE - 1) / PAGE_SIZE; first = (Range->BaseAddrLow + PAGE_SIZE - 1) / PAGE_SIZE;
last = first + ((Range->LengthLow + PAGE_SIZE - 1) / PAGE_SIZE); last = first + ((Range->LengthLow + PAGE_SIZE - 1) / PAGE_SIZE);
for (i = first; i < last; i++) for (i = first; i < last && i < MmPageArraySize; i++)
{ {
if (MmPageArray[i].Flags.Type == 0) if (MmPageArray[i].Flags.Type == 0)
{ {
@ -260,7 +260,7 @@ MiParseRangeToBiosList(PADDRESS_RANGE Range)
first = (Range->BaseAddrLow + PAGE_SIZE - 1) / PAGE_SIZE; first = (Range->BaseAddrLow + PAGE_SIZE - 1) / PAGE_SIZE;
last = first + ((Range->LengthLow + PAGE_SIZE - 1) / PAGE_SIZE); last = first + ((Range->LengthLow + PAGE_SIZE - 1) / PAGE_SIZE);
for (i = first; i < last; i++) for (i = first; i < last && i < MmPageArraySize; i++)
{ {
/* Remove the page from the free list if it is there */ /* Remove the page from the free list if it is there */
if (MmPageArray[i].Flags.Type == MM_PHYSICAL_PAGE_FREE) if (MmPageArray[i].Flags.Type == MM_PHYSICAL_PAGE_FREE)
@ -280,17 +280,14 @@ MiParseRangeToBiosList(PADDRESS_RANGE Range)
} }
VOID INIT_FUNCTION VOID INIT_FUNCTION
MiParseBIOSMemoryMap(ULONG MemorySizeInPages, MiParseBIOSMemoryMap(PADDRESS_RANGE BIOSMemoryMap,
PADDRESS_RANGE BIOSMemoryMap,
ULONG AddressRangeCount) ULONG AddressRangeCount)
{ {
PADDRESS_RANGE p; PADDRESS_RANGE p;
ULONG i; ULONG i;
p = BIOSMemoryMap; p = BIOSMemoryMap;
for (i = 0; i < AddressRangeCount; i++) for (i = 0; i < AddressRangeCount; i++, p++)
{
if (((p->BaseAddrLow + PAGE_SIZE - 1) / PAGE_SIZE) < MemorySizeInPages)
{ {
if (p->Type == 1) if (p->Type == 1)
{ {
@ -301,8 +298,6 @@ MiParseBIOSMemoryMap(ULONG MemorySizeInPages,
MiParseRangeToBiosList(p); MiParseRangeToBiosList(p);
} }
} }
p += 1;
}
} }
PVOID INIT_FUNCTION PVOID INIT_FUNCTION
@ -502,7 +497,6 @@ MmInitializePageList(PVOID FirstPhysKernelAddress,
if ((BIOSMemoryMap != NULL) && (AddressRangeCount > 0)) if ((BIOSMemoryMap != NULL) && (AddressRangeCount > 0))
{ {
MiParseBIOSMemoryMap( MiParseBIOSMemoryMap(
MemorySizeInPages,
BIOSMemoryMap, BIOSMemoryMap,
AddressRangeCount); AddressRangeCount);
} }