Sync with trunk (48237)
[reactos.git] / ntoskrnl / mm / mminit.c
index a03ce8e..d2db58e 100644 (file)
@@ -109,7 +109,7 @@ MiInitSystemMemoryAreas()
     //
     // Protect the PFN database
     //
-    BaseAddress = MmPfnDatabase[0];
+    BaseAddress = MmPfnDatabase;
     Status = MmCreateMemoryArea(MmGetKernelAddressSpace(),
                                 MEMORY_AREA_OWNED_BY_ARM3 | MEMORY_AREA_STATIC,
                                 &BaseAddress,
@@ -292,8 +292,8 @@ MiDbgDumpAddressSpace(VOID)
             (ULONG_PTR)MmPagedPoolBase + MmPagedPoolSize,
             "Paged Pool");
     DPRINT1("          0x%p - 0x%p\t%s\n",
-            MmPfnDatabase[0],
-            (ULONG_PTR)MmPfnDatabase[0] + (MxPfnAllocation << PAGE_SHIFT),
+            MmPfnDatabase,
+            (ULONG_PTR)MmPfnDatabase + (MxPfnAllocation << PAGE_SHIFT),
             "PFN Database");
     DPRINT1("          0x%p - 0x%p\t%s\n",
             MmNonPagedPoolStart,
@@ -371,18 +371,8 @@ MmInitSystem(IN ULONG Phase,
         /* Dump memory descriptors */
         if (MiDbgEnableMdDump) MiDbgDumpMemoryDescriptors();
         
-        //
-        // Initialize ARMĀ³ in phase 0
-        //
+        /* Initialize ARMĀ³ in phase 0 */
         MmArmInitSystem(0, KeLoaderBlock);    
-
-#if defined(_WINKD_)
-        //
-        // Everything required for the debugger to read and write
-        // physical memory is now set up
-        //
-        MiDbgReadyForPhysical = TRUE;
-#endif
         
         /* Put the paged pool after the loaded modules */
         MmPagedPoolBase = (PVOID)PAGE_ROUND_UP((ULONG_PTR)MmSystemRangeStart +
@@ -394,19 +384,12 @@ MmInitSystem(IN ULONG Phase,
 
         /* Dump the address space */
         MiDbgDumpAddressSpace();
-        
-        /* Initialize paged pool */
-        MmInitializePagedPool();
-        
-        /* Initialize the loaded module list */
-        MiInitializeLoadedModuleList(LoaderBlock);
-        
-        /* Initialize working sets */
-        MiInitializeUserPfnBitmap();
-        MmInitializeMemoryConsumer(MC_USER, MmTrimUserMemory);
     }
     else if (Phase == 1)
     {
+        MmInitializePagedPool();
+        MiInitializeUserPfnBitmap();
+        MmInitializeMemoryConsumer(MC_USER, MmTrimUserMemory);
         MmInitializeRmapList();
         MmInitializePageOp();
         MmInitSectionImplementation();
@@ -426,15 +409,15 @@ MmInitSystem(IN ULONG Phase,
         //
         // Now get the PTE for shared data, and read the PFN that holds it
         //
-        PointerPte = MiAddressToPte(KI_USER_SHARED_DATA);
+        PointerPte = MiAddressToPte((PVOID)KI_USER_SHARED_DATA);
         ASSERT(PointerPte->u.Hard.Valid == 1);
         PageFrameNumber = PFN_FROM_PTE(PointerPte);
         
-        //
-        // Now write a copy of it
-        //
-        MI_MAKE_OWNER_PAGE(&TempPte);
-        TempPte.u.Hard.PageFrameNumber = PageFrameNumber;
+        /* Build the PTE and write it */
+        MI_MAKE_HARDWARE_PTE_KERNEL(&TempPte,
+                                    PointerPte,
+                                    MM_READONLY,
+                                    PageFrameNumber);
         *MmSharedUserDataPte = TempPte;
         
         /* Setup the memory threshold events */
@@ -453,10 +436,6 @@ MmInitSystem(IN ULONG Phase,
         /* Initialize the balance set manager */
         MmInitBsmThread();
     }
-    else if (Phase == 2)
-    {
-
-    }
 
     return TRUE;
 }