Author: dgorbachev
Date: Wed Jan  6 12:44:54 2010
New Revision: 44974

URL: http://svn.reactos.org/svn/reactos?rev=44974&view=rev
Log:
[freeldr]
- Do not use GetSystemMemorySize(), which truncates size to 32 bit.
- Other minor changes.

Removed:
    trunk/reactos/boot/freeldr/freeldr/.cvsignore
Modified:
    trunk/reactos/boot/freeldr/freeldr/cache/cache.c
    trunk/reactos/boot/freeldr/freeldr/include/mm.h
    trunk/reactos/boot/freeldr/freeldr/mm/mm.c
    trunk/reactos/boot/freeldr/freeldr/windows/i386/wlmemory.c
    trunk/reactos/boot/freeldr/freeldr/windows/wlmemory.c

Removed: trunk/reactos/boot/freeldr/freeldr/.cvsignore
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/.cvsignore?rev=44973&view=auto
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/.cvsignore [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/.cvsignore (removed)
@@ -1,1 +1,0 @@
-obj

Modified: trunk/reactos/boot/freeldr/freeldr/cache/cache.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/cache/cache.c?rev=44974&r1=44973&r2=44974&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/cache/cache.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/cache/cache.c [iso-8859-1] Wed Jan  6 
12:44:54 2010
@@ -89,7 +89,7 @@
        CacheManagerDrive.BlockSize = 
MachDiskGetCacheableBlockCount(DriveNumber);
 
        CacheBlockCount = 0;
-       CacheSizeLimit = GetSystemMemorySize() / 8;
+       CacheSizeLimit = TotalPagesInLookupTable / 8 * MM_PAGE_SIZE;
        CacheSizeCurrent = 0;
        if (CacheSizeLimit < (64 * 1024))
        {

Modified: trunk/reactos/boot/freeldr/freeldr/include/mm.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/include/mm.h?rev=44974&r1=44973&r2=44974&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/mm.h [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/include/mm.h [iso-8859-1] Wed Jan  6 
12:44:54 2010
@@ -104,7 +104,6 @@
 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
 
 

Modified: trunk/reactos/boot/freeldr/freeldr/mm/mm.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/mm/mm.c?rev=44974&r1=44973&r2=44974&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/mm/mm.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/mm/mm.c [iso-8859-1] Wed Jan  6 12:44:54 
2010
@@ -337,11 +337,6 @@
 }
 #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;

Modified: trunk/reactos/boot/freeldr/freeldr/windows/i386/wlmemory.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/windows/i386/wlmemory.c?rev=44974&r1=44973&r2=44974&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/windows/i386/wlmemory.c [iso-8859-1] 
(original)
+++ trunk/reactos/boot/freeldr/freeldr/windows/i386/wlmemory.c [iso-8859-1] Wed 
Jan  6 12:44:54 2010
@@ -53,13 +53,13 @@
        // 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 @@
 
 BOOLEAN
 MempSetupPaging(IN ULONG StartPage,
-                               IN ULONG NumberOfPages)
+               IN ULONG NumberOfPages)
 {
        PHARDWARE_PTE PhysicalPT;
        PHARDWARE_PTE KernelPT;
@@ -163,7 +163,7 @@
        //
        // 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 @@
                        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;
-
-                       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;
-               }
+               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 = (Page != 0);
+               KernelPT[Page & 0x3ff].Write = (Page != 0);
        }
 
        return TRUE;

Modified: trunk/reactos/boot/freeldr/freeldr/windows/wlmemory.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/windows/wlmemory.c?rev=44974&r1=44973&r2=44974&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/windows/wlmemory.c [iso-8859-1] 
(original)
+++ trunk/reactos/boot/freeldr/freeldr/windows/wlmemory.c [iso-8859-1] Wed Jan  
6 12:44:54 2010
@@ -184,7 +184,7 @@
        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 @@
 
        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 @@
        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 &&


Reply via email to