[NTOS]: Actually use calculated kernel stack size value.
authorSir Richard <sir_richard@svn.reactos.org>
Wed, 10 Feb 2010 04:12:23 +0000 (04:12 +0000)
committerSir Richard <sir_richard@svn.reactos.org>
Wed, 10 Feb 2010 04:12:23 +0000 (04:12 +0000)
[NTOS]: Define the template PTE/PDE statically, instead of doing it in code. It's faster, and saves us the trouble of not being able to use the template from point 0. Move the template setup into ARM3 instead of page.c.

svn path=/trunk/; revision=45549

reactos/ntoskrnl/mm/ARM3/i386/init.c
reactos/ntoskrnl/mm/i386/page.c

index 41b1573..47321ea 100644 (file)
@@ -29,6 +29,9 @@
 PMEMORY_ALLOCATION_DESCRIPTOR MxFreeDescriptor;
 MEMORY_ALLOCATION_DESCRIPTOR MxOldFreeDescriptor;
 
+MMPTE ValidKernelPde = {.u.Hard.Valid = 1, .u.Hard.Write = 1, .u.Hard.Dirty = 1, .u.Hard.Accessed = 1};
+MMPTE ValidKernelPte = {.u.Hard.Valid = 1, .u.Hard.Write = 1, .u.Hard.Dirty = 1, .u.Hard.Accessed = 1};
+
 /* PRIVATE FUNCTIONS **********************************************************/
 
 PFN_NUMBER
@@ -70,7 +73,7 @@ MiInitMachineDependent(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
     ULONG FreePages = 0;
     PFN_NUMBER PageFrameIndex, PoolPages;
     PMMPTE StartPde, EndPde, PointerPte, LastPte;
-    MMPTE TempPde = HyperTemplatePte, TempPte = HyperTemplatePte;
+    MMPTE TempPde, TempPte;
     PVOID NonPagedPoolExpansionVa;
     ULONG OldCount, L2Associativity;
     PFN_NUMBER FreePage, FreePageCount, PagesLeft, BasePage, PageCount;
@@ -97,11 +100,18 @@ MiInitMachineDependent(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
         if (MmLargeStackSize < KERNEL_STACK_SIZE) MmLargeStackSize = KERNEL_STACK_SIZE;
     }
     
-    //
-    // The large kernel stack is cutomizable, but use default value for now
-    //
-    MmLargeStackSize = KERNEL_LARGE_STACK_SIZE;
-
+    /* Check for global bit */
+    if (KeFeatureBits & KF_GLOBAL_PAGE)
+    {
+        /* Set it on the template PTE and PDE */
+        ValidKernelPte.u.Hard.Global = TRUE;
+        ValidKernelPde.u.Hard.Global = TRUE;
+    }
+    
+    /* Now templates are ready */
+    TempPte = ValidKernelPte;
+    TempPde = ValidKernelPde;
+     
     //
     // Set CR3 for the system process
     //
index 5d5966f..cb075b0 100644 (file)
@@ -1012,12 +1012,6 @@ MmInitGlobalKernelPageDirectory(VOID)
     
     DPRINT("MmInitGlobalKernelPageDirectory()\n");
     
-    //
-    // Setup template
-    //
-    HyperTemplatePte.u.Long = (PA_PRESENT | PA_READWRITE | PA_DIRTY | PA_ACCESSED);
-    if (Ke386GlobalPagesEnabled) HyperTemplatePte.u.Long |= PA_GLOBAL;
-    
     for (i = ADDR_TO_PDE_OFFSET(MmSystemRangeStart); i < 1024; i++)
     {
         if (i != ADDR_TO_PDE_OFFSET(PAGETABLE_MAP) &&