[ros-diffs] [ros-arm-bringup] 41510: - Nonpaged pool MEMORY_AREA is now initialized during nonpaged pool initialization (and it is now a static MEMORY_AREA). - Paged pool MEMORY_AREA is now initialized during paged pool initialization. - Remaining MEMORY_AREAs (KPCR and KUSER_SHARED_DATA) are now created in MiInitSystemMemoryAreas (and they are also static) instead of MmInitVirtualMemory, since this is really what the function was doing. - The page table and hyperspace MEMORY_AREAs are still initialized the same, but are also now static. - The creation of these core/system memory areas is now done much earlier. For example, hyperspace memory area is now created before hyperspace is mapped. - Nonpaged pool, paged pool, and working set initialization is now done outside MiInitSystemMemoryAreas and roughly at the same time as before. - Removed MmInitVirtualMemory as it had become a kitchen sink of random Memory Manager initialization code. - I/O and Local APIC MEMORY_AREAs are not created anymore, since that should be done by the HAL, not the kernel.

ros-arm-bringup at svn.reactos.org ros-arm-bringup at svn.reactos.org
Sun Jun 21 08:36:46 CEST 2009


Author: ros-arm-bringup
Date: Sun Jun 21 10:36:45 2009
New Revision: 41510

URL: http://svn.reactos.org/svn/reactos?rev=41510&view=rev
Log:
- Nonpaged pool MEMORY_AREA is now initialized during nonpaged pool initialization (and it is now a static MEMORY_AREA).
- Paged pool MEMORY_AREA is now initialized during paged pool initialization.
- Remaining MEMORY_AREAs (KPCR and KUSER_SHARED_DATA) are now created in MiInitSystemMemoryAreas (and they are also static) instead of MmInitVirtualMemory, since this is really what the function was doing.
  - The page table and hyperspace MEMORY_AREAs are still initialized the same, but are also now static.
  - The creation of these core/system memory areas is now done much earlier. For example, hyperspace memory area is now created before hyperspace is mapped.
- Nonpaged pool, paged pool, and working set initialization is now done outside MiInitSystemMemoryAreas and roughly at the same time as before.
- Removed MmInitVirtualMemory as it had become a kitchen sink of random Memory Manager initialization code.
- I/O and Local APIC MEMORY_AREAs are not created anymore, since that should be done by the HAL, not the kernel.


Modified:
    trunk/reactos/ntoskrnl/include/internal/mm.h
    trunk/reactos/ntoskrnl/mm/i386/page.c
    trunk/reactos/ntoskrnl/mm/mm.c
    trunk/reactos/ntoskrnl/mm/mminit.c
    trunk/reactos/ntoskrnl/mm/npool.c
    trunk/reactos/ntoskrnl/mm/ppool.c

Modified: trunk/reactos/ntoskrnl/include/internal/mm.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/mm.h?rev=41510&r1=41509&r2=41510&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] Sun Jun 21 10:36:45 2009
@@ -29,7 +29,7 @@
 typedef ULONG SWAPENTRY;
 typedef ULONG PFN_TYPE, *PPFN_TYPE;
 
-#define MI_STATIC_MEMORY_AREAS              (1)
+#define MI_STATIC_MEMORY_AREAS              (6)
 
 #define MEMORY_AREA_INVALID                 (0)
 #define MEMORY_AREA_SECTION_VIEW            (1)

Modified: trunk/reactos/ntoskrnl/mm/i386/page.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/i386/page.c?rev=41510&r1=41509&r2=41510&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/i386/page.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/i386/page.c [iso-8859-1] Sun Jun 21 10:36:45 2009
@@ -1161,7 +1161,7 @@
     BoundaryAddressMultiple.QuadPart = 0;
     BaseAddress = (PVOID)PAGETABLE_MAP;
     Status = MmCreateMemoryArea(MmGetKernelAddressSpace(),
-                                MEMORY_AREA_SYSTEM,
+                                MEMORY_AREA_SYSTEM | MEMORY_AREA_STATIC,
                                 &BaseAddress,
                                 0x400000,
                                 PAGE_READWRITE,
@@ -1175,7 +1175,7 @@
     }
     BaseAddress = (PVOID)HYPERSPACE;
     Status = MmCreateMemoryArea(MmGetKernelAddressSpace(),
-                                MEMORY_AREA_SYSTEM,
+                                MEMORY_AREA_SYSTEM | MEMORY_AREA_STATIC,
                                 &BaseAddress,
                                 0x400000,
                                 PAGE_READWRITE,

Modified: trunk/reactos/ntoskrnl/mm/mm.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/mm.c?rev=41510&r1=41509&r2=41510&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/mm.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/mm.c [iso-8859-1] Sun Jun 21 10:36:45 2009
@@ -293,7 +293,8 @@
             break;
 
          case MEMORY_AREA_SHARED_DATA:
-            Pfn = MmSharedDataPagePhysicalAddress.LowPart >> PAGE_SHIFT;
+            Pfn = MmGetPhysicalAddress((PVOID)PCR).LowPart >> PAGE_SHIFT;
+            Pfn++;
             Status =
                MmCreateVirtualMapping(PsGetCurrentProcess(),
                                       (PVOID)PAGE_ROUND_DOWN(Address),

Modified: trunk/reactos/ntoskrnl/mm/mminit.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/mminit.c?rev=41510&r1=41509&r2=41510&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/mminit.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/mminit.c [iso-8859-1] Sun Jun 21 10:36:45 2009
@@ -47,7 +47,6 @@
 
 BOOLEAN IsThisAnNtAsSystem = FALSE;
 MM_SYSTEMSIZE MmSystemSize = MmSmallSystem;
-PHYSICAL_ADDRESS MmSharedDataPagePhysicalAddress;
 PVOID MiNonPagedPoolStart;
 ULONG MiNonPagedPoolLength;
 ULONG MmBootImageSize;
@@ -107,110 +106,45 @@
 VOID
 INIT_FUNCTION
 NTAPI
-MmInitVirtualMemory()
-{
-   PVOID BaseAddress;
-   ULONG Length;
-   NTSTATUS Status;
-   PHYSICAL_ADDRESS BoundaryAddressMultiple;
-   PMEMORY_AREA MArea;
-
-   BoundaryAddressMultiple.QuadPart = 0;
-
-   DPRINT("NonPagedPool %x - %x, PagedPool %x - %x\n", MiNonPagedPoolStart, (ULONG_PTR)MiNonPagedPoolStart + MiNonPagedPoolLength - 1,
-           MmPagedPoolBase, (ULONG_PTR)MmPagedPoolBase + MmPagedPoolSize - 1);
-
-   MiInitializeNonPagedPool();
-
-   /*
-    * Setup the system area descriptor list
-    */
-   MiInitPageDirectoryMap();
-
-   BaseAddress = (PVOID)PCR;
-   MmCreateMemoryArea(MmGetKernelAddressSpace(),
-                      MEMORY_AREA_SYSTEM,
-                      &BaseAddress,
-                      PAGE_SIZE * KeNumberProcessors,
-                      PAGE_READWRITE,
-                      &MArea,
-                      TRUE,
-                      0,
-                      BoundaryAddressMultiple);
-
-#if defined(_M_IX86)
-   /* Local APIC base */
-   BaseAddress = (PVOID)0xFEE00000;
-   MmCreateMemoryArea(MmGetKernelAddressSpace(),
-                      MEMORY_AREA_SYSTEM,
-                      &BaseAddress,
-                      PAGE_SIZE,
-                      PAGE_READWRITE,
-                      &MArea,
-                      TRUE,
-                      0,
-                      BoundaryAddressMultiple);
-
-   /* i/o APIC base */
-   BaseAddress = (PVOID)0xFEC00000;
-   MmCreateMemoryArea(MmGetKernelAddressSpace(),
-                      MEMORY_AREA_SYSTEM,
-                      &BaseAddress,
-                      PAGE_SIZE,
-                      PAGE_READWRITE,
-                      &MArea,
-                      TRUE,
-                      0,
-                      BoundaryAddressMultiple);
-#endif
-
-   BaseAddress = MiNonPagedPoolStart;
-   MmCreateMemoryArea(MmGetKernelAddressSpace(),
-                      MEMORY_AREA_SYSTEM,
-                      &BaseAddress,
-                      MiNonPagedPoolLength,
-                      PAGE_READWRITE,
-                      &MArea,
-                      TRUE,
-                      0,
-                      BoundaryAddressMultiple);
-
-   BaseAddress = MmPagedPoolBase;
-   Status = MmCreateMemoryArea(MmGetKernelAddressSpace(),
-                               MEMORY_AREA_PAGED_POOL,
-                               &BaseAddress,
-                               MmPagedPoolSize,
-                               PAGE_READWRITE,
-                               &MArea,
-                               TRUE,
-                               0,
-                               BoundaryAddressMultiple);
-
-   MmInitializePagedPool();
-
-   /*
-    * Create the kernel mapping of the user/kernel shared memory.
-    */
-   BaseAddress = (PVOID)KI_USER_SHARED_DATA;
-   Length = PAGE_SIZE;
-   MmCreateMemoryArea(MmGetKernelAddressSpace(),
-                      MEMORY_AREA_SYSTEM,
-                      &BaseAddress,
-                      Length,
-                      PAGE_READWRITE,
-                      &MArea,
-                      TRUE,
-                      0,
-                      BoundaryAddressMultiple);
-
-   /* Shared data are always located the next page after PCR */
-   MmSharedDataPagePhysicalAddress = MmGetPhysicalAddress((PVOID)PCR);
-   MmSharedDataPagePhysicalAddress.QuadPart += PAGE_SIZE;
-
-   /*
-    *
-    */
-   MmInitializeMemoryConsumer(MC_USER, MmTrimUserMemory);
+MiInitSystemMemoryAreas()
+{
+    PVOID BaseAddress;
+    PHYSICAL_ADDRESS BoundaryAddressMultiple;
+    PMEMORY_AREA MArea;
+    BoundaryAddressMultiple.QuadPart = 0;
+    
+    //
+    // First initialize the page table and hyperspace memory areas
+    //
+    MiInitPageDirectoryMap();
+    
+    //
+    // Next, the KPCR
+    //
+    BaseAddress = (PVOID)PCR;
+    MmCreateMemoryArea(MmGetKernelAddressSpace(),
+                       MEMORY_AREA_SYSTEM | MEMORY_AREA_STATIC,
+                       &BaseAddress,
+                       PAGE_SIZE * KeNumberProcessors,
+                       PAGE_READWRITE,
+                       &MArea,
+                       TRUE,
+                       0,
+                       BoundaryAddressMultiple);
+
+    //
+    // Now the KUSER_SHARED_DATA
+    //
+    BaseAddress = (PVOID)KI_USER_SHARED_DATA;
+    MmCreateMemoryArea(MmGetKernelAddressSpace(),
+                       MEMORY_AREA_SYSTEM | MEMORY_AREA_STATIC,
+                       &BaseAddress,
+                       PAGE_SIZE,
+                       PAGE_READWRITE,
+                       &MArea,
+                       TRUE,
+                       0,
+                       BoundaryAddressMultiple);
 }
 
 VOID
@@ -432,6 +366,9 @@
     
     /* Dump kernel memory layout */
     MiDbgKernelLayout();
+    
+    /* Intialize system memory areas */
+    MiInitSystemMemoryAreas();
 
     /* Initialize hyperspace */
     MiInitHyperSpace();
@@ -441,12 +378,18 @@
 
     /* Unmap low memory */
     MmDeletePageTable(NULL, 0);
-
-    /* Intialize memory areas */
-    MmInitVirtualMemory();
+    
+    /* Initialize nonpaged pool */
+    MiInitializeNonPagedPool();
+    
+    /* Initialize paged pool */
+    MmInitializePagedPool();
 
     /* Initialize MDLs */
     MmInitializeMdlImplementation();
+    
+    /* Initialize working sets */
+    MmInitializeMemoryConsumer(MC_USER, MmTrimUserMemory);
 }
 
 BOOLEAN

Modified: trunk/reactos/ntoskrnl/mm/npool.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/npool.c?rev=41510&r1=41509&r2=41510&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/npool.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/npool.c [iso-8859-1] Sun Jun 21 10:36:45 2009
@@ -1699,6 +1699,22 @@
    PVOID Address;
    HDR_USED* used;
    HDR_FREE* free;
+   PVOID BaseAddress;
+   PHYSICAL_ADDRESS BoundaryAddressMultiple;
+   PMEMORY_AREA MArea;
+   BoundaryAddressMultiple.QuadPart = 0;
+    
+   BaseAddress = MiNonPagedPoolStart;
+   MmCreateMemoryArea(MmGetKernelAddressSpace(),
+                      MEMORY_AREA_SYSTEM | MEMORY_AREA_STATIC,
+                      &BaseAddress,
+                      MiNonPagedPoolLength,
+                      PAGE_READWRITE,
+                      &MArea,
+                      TRUE,
+                      0,
+                      BoundaryAddressMultiple);
+    
 #ifdef TAG_STATISTICS_TRACKING
 
    for (i = 0; i < TAG_HASH_TABLE_SIZE; i++)

Modified: trunk/reactos/ntoskrnl/mm/ppool.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ppool.c?rev=41510&r1=41509&r2=41510&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ppool.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ppool.c [iso-8859-1] Sun Jun 21 10:36:45 2009
@@ -52,6 +52,22 @@
 NTAPI
 MmInitializePagedPool(VOID)
 {
+    PVOID BaseAddress;
+    PHYSICAL_ADDRESS BoundaryAddressMultiple;
+    PMEMORY_AREA MArea;
+    BoundaryAddressMultiple.QuadPart = 0;
+    
+    BaseAddress = MmPagedPoolBase;
+    MmCreateMemoryArea(MmGetKernelAddressSpace(),
+                       MEMORY_AREA_PAGED_POOL,
+                       &BaseAddress,
+                       MmPagedPoolSize,
+                       PAGE_READWRITE,
+                       &MArea,
+                       TRUE,
+                       0,
+                       BoundaryAddressMultiple);
+    
 	/*
 	 * We are still at a high IRQL level at this point so explicitly commit
 	 * the first page of the paged pool before writing the first block header.



More information about the Ros-diffs mailing list