Fixed interpretation of BIOS memory map.

Patch by Hartmut Birr.

svn path=/trunk/; revision=2167
This commit is contained in:
Eric Kohl 2001-08-13 16:39:01 +00:00
parent 9dd23174c8
commit 25f3f80f1e
2 changed files with 27 additions and 9 deletions

View file

@ -130,7 +130,7 @@ VOID MiParseRangeToFreeList(
Range->Type); Range->Type);
first = (Range->BaseAddrLow + PAGESIZE - 1) / PAGESIZE; first = (Range->BaseAddrLow + PAGESIZE - 1) / PAGESIZE;
last = first + ((Range->LengthLow + PAGESIZE - 1) / PAGESIZE) + 1; last = first + ((Range->LengthLow + PAGESIZE - 1) / PAGESIZE);
for (i = first; i < last; i++) for (i = first; i < last; i++)
{ {
if (MmPageArray[i].Flags == 0) if (MmPageArray[i].Flags == 0)
@ -156,7 +156,7 @@ VOID MiParseRangeToBiosList(
Range->Type); Range->Type);
first = (Range->BaseAddrLow + PAGESIZE - 1) / PAGESIZE; first = (Range->BaseAddrLow + PAGESIZE - 1) / PAGESIZE;
last = first + ((Range->LengthLow + PAGESIZE - 1) / PAGESIZE) + 1; last = first + ((Range->LengthLow + PAGESIZE - 1) / PAGESIZE);
for (i = first; i < last; i++) for (i = first; i < last; i++)
{ {
/* Remove the page from the free list if it is there */ /* Remove the page from the free list if it is there */

View file

@ -1,4 +1,4 @@
/* $Id: mminit.c,v 1.23 2001/08/03 09:36:18 ei Exp $ /* $Id: mminit.c,v 1.24 2001/08/13 16:39:01 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top directory * COPYRIGHT: See COPYING in the top directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -187,26 +187,44 @@ VOID MmInitVirtualMemory(ULONG LastKernelAddress,
DPRINT("MmInitVirtualMemory() done\n"); DPRINT("MmInitVirtualMemory() done\n");
} }
VOID MmInit1(ULONG FirstKrnlPhysAddr, VOID MmInit1(ULONG FirstKrnlPhysAddr,
ULONG LastKrnlPhysAddr, ULONG LastKrnlPhysAddr,
ULONG LastKernelAddress, ULONG LastKernelAddress,
PADDRESS_RANGE BIOSMemoryMap, PADDRESS_RANGE BIOSMemoryMap,
ULONG AddressRangeCount) ULONG AddressRangeCount)
/* /*
* FUNCTION: Initalize memory managment * FUNCTION: Initalize memory managment
*/ */
{ {
ULONG i; ULONG i;
ULONG kernel_len; ULONG kernel_len;
#ifndef MP #ifndef MP
extern unsigned int unmap_me, unmap_me2, unmap_me3; extern unsigned int unmap_me, unmap_me2, unmap_me3;
#endif #endif
DPRINT("MmInit1(FirstKrnlPhysAddr, %x, LastKrnlPhysAddr %x, LastKernelAddress %x)\n", DPRINT("MmInit1(FirstKrnlPhysAddr, %x, LastKrnlPhysAddr %x, LastKernelAddress %x)\n",
FirstKrnlPhysAddr, FirstKrnlPhysAddr,
LastKrnlPhysAddr, LastKrnlPhysAddr,
LastKernelAddress); LastKernelAddress);
if ((BIOSMemoryMap != NULL) && (AddressRangeCount > 0))
{
// If we have a bios memory map, recalulate the the memory size
ULONG last = 0;
for (i = 0; i < AddressRangeCount; i++)
{
if (BIOSMemoryMap[i].Type == 1
&& (BIOSMemoryMap[i].BaseAddrLow + BIOSMemoryMap[i].LengthLow + PAGESIZE -1) / PAGESIZE > last)
{
last = (BIOSMemoryMap[i].BaseAddrLow + BIOSMemoryMap[i].LengthLow + PAGESIZE -1) / PAGESIZE;
}
}
if ((last - 256) * 4 > KeLoaderBlock.MemHigher)
{
KeLoaderBlock.MemHigher = (last - 256) * 4;
}
}
/* /*
* FIXME: Set this based on the system command line * FIXME: Set this based on the system command line
*/ */