- 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;
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)
{
@ -260,7 +260,7 @@ MiParseRangeToBiosList(PADDRESS_RANGE Range)
first = (Range->BaseAddrLow + 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 */
if (MmPageArray[i].Flags.Type == MM_PHYSICAL_PAGE_FREE)
@ -280,28 +280,23 @@ MiParseRangeToBiosList(PADDRESS_RANGE Range)
}
VOID INIT_FUNCTION
MiParseBIOSMemoryMap(ULONG MemorySizeInPages,
PADDRESS_RANGE BIOSMemoryMap,
MiParseBIOSMemoryMap(PADDRESS_RANGE BIOSMemoryMap,
ULONG AddressRangeCount)
{
PADDRESS_RANGE p;
ULONG i;
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)
{
MiParseRangeToFreeList(p);
}
else
{
MiParseRangeToBiosList(p);
}
MiParseRangeToFreeList(p);
}
else
{
MiParseRangeToBiosList(p);
}
p += 1;
}
}
@ -502,7 +497,6 @@ MmInitializePageList(PVOID FirstPhysKernelAddress,
if ((BIOSMemoryMap != NULL) && (AddressRangeCount > 0))
{
MiParseBIOSMemoryMap(
MemorySizeInPages,
BIOSMemoryMap,
AddressRangeCount);
}