[ros-diffs] [tkreuzer] 48350: [NTOS] - Move more code out of the architecture specific file - Remove checks, whether the pages from a MAD are above MmHighestPhysicalPage, because that was set from the highest page in the MADs.

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Thu Jul 29 10:41:01 UTC 2010


Author: tkreuzer
Date: Thu Jul 29 10:41:00 2010
New Revision: 48350

URL: http://svn.reactos.org/svn/reactos?rev=48350&view=rev
Log:
[NTOS]
- Move more code out of the architecture specific file
- Remove checks, whether the pages from a MAD are above MmHighestPhysicalPage, because that was set from the highest page in the MADs.

Modified:
    branches/ros-amd64-bringup/reactos/ntoskrnl/mm/ARM3/i386/init.c
    branches/ros-amd64-bringup/reactos/ntoskrnl/mm/ARM3/mminit.c

Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/mm/ARM3/i386/init.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntoskrnl/mm/ARM3/i386/init.c?rev=48350&r1=48349&r2=48350&view=diff
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/mm/ARM3/i386/init.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/mm/ARM3/i386/init.c [iso-8859-1] Thu Jul 29 10:41:00 2010
@@ -158,28 +158,6 @@
     ULONG OldCount;
     KIRQL OldIrql;
 
-    /* Check for kernel stack size that's too big */
-    if (MmLargeStackSize > (KERNEL_LARGE_STACK_SIZE / _1KB))
-    {
-        /* Sanitize to default value */
-        MmLargeStackSize = KERNEL_LARGE_STACK_SIZE;
-    }
-    else
-    {
-        /* Take the registry setting, and convert it into bytes */
-        MmLargeStackSize *= _1KB;
-        
-        /* Now align it to a page boundary */
-        MmLargeStackSize = PAGE_ROUND_UP(MmLargeStackSize);
-        
-        /* Sanity checks */
-        ASSERT(MmLargeStackSize <= KERNEL_LARGE_STACK_SIZE);
-        ASSERT((MmLargeStackSize & (PAGE_SIZE - 1)) == 0);
-        
-        /* Make sure it's not too low */
-        if (MmLargeStackSize < KERNEL_STACK_SIZE) MmLargeStackSize = KERNEL_STACK_SIZE;
-    }
-    
     /* Check for global bit */
 #if 0
     if (KeFeatureBits & KF_GLOBAL_PAGE)
@@ -376,28 +354,13 @@
     MiInitializeNonPagedPool();
     MiInitializeNonPagedPoolThresholds();
 
-    /* Map the PFN database pages */
-    MiMapPfnDatabase(LoaderBlock);
-    
-    /* Initialize the color tables */
-    MiInitializeColorTables();
-    
     /* ReactOS Stuff */
     KeInitializeEvent(&ZeroPageThreadEvent, NotificationEvent, TRUE);
     
-    /* Hide the pages, that we already used from the descriptor */
-    MxFreeDescriptor->BasePage = MiEarlyAllocBase;
-    MxFreeDescriptor->PageCount = MiEarlyAllocCount;
-
     /* Build the PFN Database */
     MiInitializePfnDatabase(LoaderBlock);
     MmInitializeBalancer(MmAvailablePages, 0);
 
-    //
-    // Reset the descriptor back so we can create the correct memory blocks
-    //
-    *MxFreeDescriptor = MxOldFreeDescriptor;
-    
     //
     // Initialize the nonpaged pool
     //

Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/mm/ARM3/mminit.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntoskrnl/mm/ARM3/mminit.c?rev=48350&r1=48349&r2=48350&view=diff
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/mm/ARM3/mminit.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/mm/ARM3/mminit.c [iso-8859-1] Thu Jul 29 10:41:00 2010
@@ -872,24 +872,6 @@
         PageCount = MdBlock->PageCount;
         PageFrameIndex = MdBlock->BasePage;
 
-        /* Don't allow memory above what the PFN database is mapping */
-        if (PageFrameIndex > MmHighestPhysicalPage)
-        {
-            /* Since they are ordered, everything past here will be larger */
-            break;
-        }
-
-        /* On the other hand, the end page might be higher up... */
-        if ((PageFrameIndex + PageCount) > (MmHighestPhysicalPage + 1))
-        {
-            /* In which case we'll trim the descriptor to go as high as we can */
-            PageCount = MmHighestPhysicalPage + 1 - PageFrameIndex;
-            MdBlock->PageCount = PageCount;
-            
-            /* But if there's nothing left to trim, we got too high, so quit */
-            if (!PageCount) break;
-        }
-
         /* Now check the descriptor type */
         switch (MdBlock->MemoryType)
         {
@@ -1017,6 +999,16 @@
 NTAPI
 MiInitializePfnDatabase(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
 {
+    /* Map the PFN database pages */
+    MiMapPfnDatabase(LoaderBlock);
+    
+    /* Initialize the color tables */
+    MiInitializeColorTables();
+
+    /* Hide the pages, that we already used from the descriptor */
+    MxFreeDescriptor->BasePage = MiEarlyAllocBase;
+    MxFreeDescriptor->PageCount = MiEarlyAllocCount;
+
     /* Scan memory and start setting up PFN entries */
     MiBuildPfnDatabaseFromPages(LoaderBlock);
     
@@ -1025,7 +1017,10 @@
     
     /* Scan the loader block and build the rest of the PFN database */
     MiBuildPfnDatabaseFromLoaderBlock(LoaderBlock);
-    
+
+    /* Reset the descriptor back so we can create the correct memory blocks */
+    *MxFreeDescriptor = MxOldFreeDescriptor;
+
     /* Finally add the pages for the PFN database itself */ 
     MiBuildPfnDatabaseSelf();
 }
@@ -1909,7 +1904,29 @@
             MmAllocationFragment = max(MmAllocationFragment,
                                        MI_MIN_ALLOCATION_FRAGMENT);
         }
-        
+
+        /* Check for kernel stack size that's too big */
+        if (MmLargeStackSize > (KERNEL_LARGE_STACK_SIZE / _1KB))
+        {
+            /* Sanitize to default value */
+            MmLargeStackSize = KERNEL_LARGE_STACK_SIZE;
+        }
+        else
+        {
+            /* Take the registry setting, and convert it into bytes */
+            MmLargeStackSize *= _1KB;
+            
+            /* Now align it to a page boundary */
+            MmLargeStackSize = PAGE_ROUND_UP(MmLargeStackSize);
+            
+            /* Sanity checks */
+            ASSERT(MmLargeStackSize <= KERNEL_LARGE_STACK_SIZE);
+            ASSERT((MmLargeStackSize & (PAGE_SIZE - 1)) == 0);
+            
+            /* Make sure it's not too low */
+            if (MmLargeStackSize < KERNEL_STACK_SIZE) MmLargeStackSize = KERNEL_STACK_SIZE;
+        }
+
         /* Initialize the platform-specific parts */       
         MiInitMachineDependent(LoaderBlock);
         




More information about the Ros-diffs mailing list