- Now that we actually take the trouble to set up MmLargeStackSize properly, use...
[reactos.git] / reactos / ntoskrnl / mm / ARM3 / procsup.c
index 26b9f18..6774c51 100644 (file)
@@ -24,26 +24,6 @@ SLIST_HEADER MmDeadStackSListHead;
 
 /* PRIVATE FUNCTIONS **********************************************************/
 
-VOID
-NTAPI
-MiRosTakeOverSharedUserPage(IN PEPROCESS Process)
-{
-    NTSTATUS Status;
-    PMEMORY_AREA MemoryArea;
-    PVOID AllocatedBase = (PVOID)MM_SHARED_USER_DATA_VA;
-
-    Status = MmCreateMemoryArea(&Process->Vm,
-                                MEMORY_AREA_OWNED_BY_ARM3,
-                                &AllocatedBase,
-                                PAGE_SIZE,
-                                PAGE_READWRITE,
-                                &MemoryArea,
-                                TRUE,
-                                0,
-                                PAGE_SIZE);
-    ASSERT(NT_SUCCESS(Status));
-}
-
 NTSTATUS
 NTAPI
 MiCreatePebOrTeb(IN PEPROCESS Process,
@@ -220,7 +200,7 @@ MmDeleteKernelStack(IN PVOID StackBase,
     // Calculate pages used
     //
     StackPages = BYTES_TO_PAGES(GuiStack ?
-                                KERNEL_LARGE_STACK_SIZE : KERNEL_STACK_SIZE);
+                                MmLargeStackSize : KERNEL_STACK_SIZE);
 
     /* Acquire the PFN lock */
     OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
@@ -295,7 +275,7 @@ MmCreateKernelStack(IN BOOLEAN GuiStack,
         //
         // We'll allocate 64KB stack, but only commit 12K
         //
-        StackPtes = BYTES_TO_PAGES(KERNEL_LARGE_STACK_SIZE);
+        StackPtes = BYTES_TO_PAGES(MmLargeStackSize);
         StackPages = BYTES_TO_PAGES(KERNEL_LARGE_STACK_COMMIT);
     }
     else
@@ -337,7 +317,7 @@ MmCreateKernelStack(IN BOOLEAN GuiStack,
     // Select the right PTE address where we actually start committing pages
     //
     PointerPte = StackPte;
-    if (GuiStack) PointerPte += BYTES_TO_PAGES(KERNEL_LARGE_STACK_SIZE -
+    if (GuiStack) PointerPte += BYTES_TO_PAGES(MmLargeStackSize -
                                                KERNEL_LARGE_STACK_COMMIT);
 
 
@@ -402,7 +382,7 @@ MmGrowKernelStackEx(IN PVOID StackPointer,
     // Make sure the stack did not overflow
     //
     ASSERT(((ULONG_PTR)Thread->StackBase - (ULONG_PTR)Thread->StackLimit) <=
-           (KERNEL_LARGE_STACK_SIZE + PAGE_SIZE));
+           (MmLargeStackSize + PAGE_SIZE));
 
     //
     // Get the current stack limit
@@ -420,7 +400,7 @@ MmGrowKernelStackEx(IN PVOID StackPointer,
     // Now make sure you're not going past the reserved space
     //
     LastPte = MiAddressToPte((PVOID)((ULONG_PTR)Thread->StackBase -
-                                     KERNEL_LARGE_STACK_SIZE));
+                                     MmLargeStackSize));
     if (NewLimitPte < LastPte)
     {
         //
@@ -974,9 +954,6 @@ MmInitializeProcessAddressSpace(IN PEPROCESS Process,
     /* Release PFN lock */
     KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
 
-    /* Lock the VAD, ARM3-owned ranges away */
-    MiRosTakeOverSharedUserPage(Process);
-
     /* Check if there's a Section Object */
     if (SectionObject)
     {
@@ -1078,7 +1055,6 @@ INIT_FUNCTION
 MmInitializeHandBuiltProcess2(IN PEPROCESS Process)
 {
     /* Lock the VAD, ARM3-owned ranges away */
-    MiRosTakeOverSharedUserPage(Process);
     return STATUS_SUCCESS;
 }
 
@@ -1280,6 +1256,14 @@ MmCleanProcessAddressSpace(IN PEPROCESS Process)
         /* Grab the current VAD */
         Vad = (PMMVAD)VadTree->BalancedRoot.RightChild;
 
+        /* Check for old-style memory areas */
+        if (Vad->u.VadFlags.Spare == 1)
+        {
+            /* Let RosMm handle this */
+            MiRosCleanupMemoryArea(Process, Vad);
+            continue;
+        }
+
         /* Lock the working set */
         MiLockProcessWorkingSetUnsafe(Process, Thread);
 
@@ -1307,7 +1291,7 @@ MmCleanProcessAddressSpace(IN PEPROCESS Process)
             MiUnlockProcessWorkingSetUnsafe(Process, Thread);
         }
 
-        /* Skip ARM3 fake VADs, they'll be freed by MmDeleteProcessAddresSpace */
+         /* Skip ARM3 fake VADs, they'll be freed by MmDeleteProcessAddresSpace */
         if (Vad->u.VadFlags.Spare == 1)
         {
             /* Set a flag so MmDeleteMemoryArea knows to free, but not to remove */