mirror of
https://github.com/reactos/reactos.git
synced 2024-11-04 22:00:55 +00:00
[freeldr]
- Do not use GetSystemMemorySize(), which truncates size to 32 bit. - Other minor changes. svn path=/trunk/; revision=44974
This commit is contained in:
parent
a71c3f0d12
commit
15269e4b77
6 changed files with 14 additions and 34 deletions
|
@ -1 +0,0 @@
|
|||
obj
|
2
reactos/boot/freeldr/freeldr/cache/cache.c
vendored
2
reactos/boot/freeldr/freeldr/cache/cache.c
vendored
|
@ -89,7 +89,7 @@ BOOLEAN CacheInitializeDrive(ULONG DriveNumber)
|
|||
CacheManagerDrive.BlockSize = MachDiskGetCacheableBlockCount(DriveNumber);
|
||||
|
||||
CacheBlockCount = 0;
|
||||
CacheSizeLimit = GetSystemMemorySize() / 8;
|
||||
CacheSizeLimit = TotalPagesInLookupTable / 8 * MM_PAGE_SIZE;
|
||||
CacheSizeCurrent = 0;
|
||||
if (CacheSizeLimit < (64 * 1024))
|
||||
{
|
||||
|
|
|
@ -104,7 +104,6 @@ VOID MmUpdateLastFreePageHint(PVOID PageLookupTable, ULONG TotalPageCount); // S
|
|||
BOOLEAN MmAreMemoryPagesAvailable(PVOID PageLookupTable, ULONG TotalPageCount, PVOID PageAddress, ULONG PageCount); // Returns TRUE if the specified pages of memory are available, otherwise FALSE
|
||||
VOID MmSetMemoryType(PVOID MemoryAddress, ULONG MemorySize, TYPE_OF_MEMORY NewType); // Use with EXTREME caution!
|
||||
|
||||
ULONG GetSystemMemorySize(VOID); // Returns the amount of total memory in the system
|
||||
PPAGE_LOOKUP_TABLE_ITEM MmGetMemoryMap(ULONG *NoEntries); // Returns a pointer to the memory mapping table and a number of entries in it
|
||||
|
||||
|
||||
|
|
|
@ -337,11 +337,6 @@ VOID DumpMemoryAllocMap(VOID)
|
|||
}
|
||||
#endif // DBG
|
||||
|
||||
ULONG GetSystemMemorySize(VOID)
|
||||
{
|
||||
return (TotalPagesInLookupTable * MM_PAGE_SIZE);
|
||||
}
|
||||
|
||||
PPAGE_LOOKUP_TABLE_ITEM MmGetMemoryMap(ULONG *NoEntries)
|
||||
{
|
||||
PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTableAddress;
|
||||
|
|
|
@ -53,13 +53,13 @@ MempAllocatePageTables()
|
|||
// Max number of entries = MaxPageNum >> 10
|
||||
// FIXME: This is a number to describe ALL physical memory
|
||||
// and windows doesn't expect ALL memory mapped...
|
||||
NumPageTables = (GetSystemMemorySize() >> MM_PAGE_SHIFT) >> 10;
|
||||
NumPageTables = TotalPagesInLookupTable >> 10;
|
||||
|
||||
DPRINTM(DPRINT_WINDOWS, "NumPageTables = %d\n", NumPageTables);
|
||||
|
||||
// Allocate memory block for all these things:
|
||||
// PDE, HAL mapping page table, physical mapping, kernel mapping
|
||||
TotalSize = (1+1+NumPageTables*2)*MM_PAGE_SIZE;
|
||||
TotalSize = (1 + 1 + NumPageTables * 2) * MM_PAGE_SIZE;
|
||||
|
||||
// PDE+HAL+KernelPTEs == MemoryData
|
||||
Buffer = MmAllocateMemoryWithType(TotalSize, LoaderMemoryData);
|
||||
|
@ -141,7 +141,7 @@ MempAllocatePTE(ULONG Entry, PHARDWARE_PTE *PhysicalPT, PHARDWARE_PTE *KernelPT)
|
|||
|
||||
BOOLEAN
|
||||
MempSetupPaging(IN ULONG StartPage,
|
||||
IN ULONG NumberOfPages)
|
||||
IN ULONG NumberOfPages)
|
||||
{
|
||||
PHARDWARE_PTE PhysicalPT;
|
||||
PHARDWARE_PTE KernelPT;
|
||||
|
@ -163,7 +163,7 @@ MempSetupPaging(IN ULONG StartPage,
|
|||
//
|
||||
// Now actually set up the page tables for identity mapping
|
||||
//
|
||||
for (Page=StartPage; Page < StartPage+NumberOfPages; Page++)
|
||||
for (Page = StartPage; Page < StartPage + NumberOfPages; Page++)
|
||||
{
|
||||
Entry = Page >> 10;
|
||||
|
||||
|
@ -177,26 +177,13 @@ MempSetupPaging(IN ULONG StartPage,
|
|||
KernelPT = (PHARDWARE_PTE)(PDE[Entry+(KSEG0_BASE >> 22)].PageFrameNumber << MM_PAGE_SHIFT);
|
||||
}
|
||||
|
||||
if (Page == 0)
|
||||
{
|
||||
PhysicalPT[Page & 0x3ff].PageFrameNumber = Page;
|
||||
PhysicalPT[Page & 0x3ff].Valid = 0;
|
||||
PhysicalPT[Page & 0x3ff].Write = 0;
|
||||
PhysicalPT[Page & 0x3ff].PageFrameNumber = Page;
|
||||
PhysicalPT[Page & 0x3ff].Valid = (Page != 0);
|
||||
PhysicalPT[Page & 0x3ff].Write = (Page != 0);
|
||||
|
||||
KernelPT[Page & 0x3ff].PageFrameNumber = Page;
|
||||
KernelPT[Page & 0x3ff].Valid = 0;
|
||||
KernelPT[Page & 0x3ff].Write = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
PhysicalPT[Page & 0x3ff].PageFrameNumber = Page;
|
||||
PhysicalPT[Page & 0x3ff].Valid = 1;
|
||||
PhysicalPT[Page & 0x3ff].Write = 1;
|
||||
|
||||
KernelPT[Page & 0x3ff].PageFrameNumber = Page;
|
||||
KernelPT[Page & 0x3ff].Valid = 1;
|
||||
KernelPT[Page & 0x3ff].Write = 1;
|
||||
}
|
||||
KernelPT[Page & 0x3ff].PageFrameNumber = Page;
|
||||
KernelPT[Page & 0x3ff].Valid = (Page != 0);
|
||||
KernelPT[Page & 0x3ff].Write = (Page != 0);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -184,7 +184,7 @@ MempAddMemoryBlock(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
MadCount++;
|
||||
|
||||
//
|
||||
// Map it (don't map low 1Mb because it was already contigiously
|
||||
// Map it (don't map low 1Mb because it was already contiguously
|
||||
// mapped in WinLdrTurnOnPaging)
|
||||
//
|
||||
if (BasePage >= 0x100)
|
||||
|
@ -255,7 +255,7 @@ WinLdrTurnOnPaging(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
|
||||
DPRINTM(DPRINT_WINDOWS, "Got memory map with %d entries\n", NoEntries);
|
||||
|
||||
// Always contigiously map low 1Mb of memory
|
||||
// Always contiguously map low 1Mb of memory
|
||||
Status = MempSetupPaging(0, 0x100);
|
||||
if (!Status)
|
||||
{
|
||||
|
@ -270,7 +270,7 @@ WinLdrTurnOnPaging(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
PagesCount = 1;
|
||||
LastPageIndex = 0;
|
||||
LastPageType = MemoryMap[0].PageAllocated;
|
||||
for(i=1;i<NoEntries;i++)
|
||||
for (i = 1; i < NoEntries; i++)
|
||||
{
|
||||
// Check if its memory map itself
|
||||
if (i >= MemoryMapStartPage &&
|
||||
|
|
Loading…
Reference in a new issue