[ros-diffs] [ros-arm-bringup] 41528: - Initialize nonpaged pool expansion system PTEs (MiInitializeSystemPtes): - Just supports expansion space for now, not system space. - Very basic initialization of the accounting structures required. - Sets up the first two system PTE clusters for the space (the first contains the linkage, the second contains the sizage). - Called from MiInitializeArmPool.

ros-arm-bringup at svn.reactos.org ros-arm-bringup at svn.reactos.org
Mon Jun 22 10:51:30 CEST 2009


Author: ros-arm-bringup
Date: Mon Jun 22 12:51:28 2009
New Revision: 41528

URL: http://svn.reactos.org/svn/reactos?rev=41528&view=rev
Log:
- Initialize nonpaged pool expansion system PTEs (MiInitializeSystemPtes):
  - Just supports expansion space for now, not system space.
  - Very basic initialization of the accounting structures required.
  - Sets up the first two system PTE clusters for the space (the first contains the linkage, the second contains the sizage).
  - Called from MiInitializeArmPool.


Added:
    trunk/reactos/ntoskrnl/mm/ARM3/syspte.c   (with props)
Modified:
    trunk/reactos/ntoskrnl/mm/ARM3/miarm.h
    trunk/reactos/ntoskrnl/mm/ARM3/pool.c
    trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild

Modified: trunk/reactos/ntoskrnl/mm/ARM3/miarm.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/miarm.h?rev=41528&r1=41527&r2=41528&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] Mon Jun 22 12:51:28 2009
@@ -10,6 +10,13 @@
 #define MI_MAX_INIT_NONPAGED_POOL_SIZE         (128 * 1024 * 1024)
 #define MI_MAX_NONPAGED_POOL_SIZE              (128 * 1024 * 1024)
 #define MI_MAX_FREE_PAGE_LISTS                 4
+
+typedef enum _MMSYSTEM_PTE_POOL_TYPE
+{
+    SystemPteSpace,
+    NonPagedPoolExpansion,
+    MaximumPtePoolTypes
+} MMSYSTEM_PTE_POOL_TYPE;
 
 extern MMPTE HyperTemplatePte;
 
@@ -24,4 +31,12 @@
     VOID
 );
 
+VOID
+NTAPI
+MiInitializeSystemPtes(
+    IN PMMPTE StartingPte,
+    IN ULONG NumberOfPtes,
+    IN MMSYSTEM_PTE_POOL_TYPE PoolType
+);
+
 /* EOF */

Modified: trunk/reactos/ntoskrnl/mm/ARM3/pool.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/pool.c?rev=41528&r1=41527&r2=41528&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/pool.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/pool.c [iso-8859-1] Mon Jun 22 12:51:28 2009
@@ -120,6 +120,9 @@
     // guard page on top so make sure to skip it. The bottom guard page will be
     // guaranteed by the fact our size is off by one.
     //
+    MiInitializeSystemPtes(PointerPte + 1,
+                           MiExpansionPoolPagesInitialCharge,
+                           NonPagedPoolExpansion);
 }
 
 /* EOF */

Added: trunk/reactos/ntoskrnl/mm/ARM3/syspte.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/syspte.c?rev=41528&view=auto
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/syspte.c (added)
+++ trunk/reactos/ntoskrnl/mm/ARM3/syspte.c [iso-8859-1] Mon Jun 22 12:51:28 2009
@@ -1,0 +1,76 @@
+/*
+ * PROJECT:         ReactOS Kernel
+ * LICENSE:         BSD - See COPYING.ARM in the top level directory
+ * FILE:            ntoskrnl/mm/ARM3/syspte.c
+ * PURPOSE:         ARM Memory Manager System PTE Allocator
+ * PROGRAMMERS:     ReactOS Portable Systems Group
+ */
+
+/* INCLUDES *******************************************************************/
+
+#include <ntoskrnl.h>
+#define NDEBUG
+#include <debug.h>
+
+#line 15 "ARM³::SYSPTE"
+#define MODULE_INVOLVED_IN_ARM3
+#include "../ARM3/miarm.h"
+
+/* GLOBALS ********************************************************************/
+
+PMMPTE MmSystemPteBase;
+PMMPTE MmSystemPtesStart[MaximumPtePoolTypes];
+PMMPTE MmSystemPtesEnd[MaximumPtePoolTypes];
+MMPTE MmFirstFreeSystemPte[MaximumPtePoolTypes];
+ULONG MmTotalFreeSystemPtes[MaximumPtePoolTypes];
+
+/* PRIVATE FUNCTIONS **********************************************************/
+
+VOID
+NTAPI
+MiInitializeSystemPtes(IN PMMPTE StartingPte,
+                       IN ULONG NumberOfPtes,
+                       IN MMSYSTEM_PTE_POOL_TYPE PoolType)
+{
+    //
+    // Sanity checks
+    //
+    ASSERT(NumberOfPtes >= 1);
+    ASSERT(PoolType == NonPagedPoolExpansion);
+    
+    //
+    // Set the starting and ending PTE addresses for this space
+    //
+    MmSystemPteBase = (PVOID)PAGETABLE_MAP;
+    MmSystemPtesStart[PoolType] = StartingPte;
+    MmSystemPtesEnd[PoolType] = StartingPte + NumberOfPtes - 1;
+    DPRINT1("System PTE space for %d starting at: %p and ending at: %p\n",
+            PoolType, MmSystemPtesStart[PoolType], MmSystemPtesEnd[PoolType]);
+    
+    //
+    // Clear all the PTEs to start with
+    //
+    RtlZeroMemory(StartingPte, NumberOfPtes * sizeof(MMPTE));
+    
+    //
+    // Make the first entry free and link it
+    //
+    StartingPte->u.List.NextEntry = -1;
+    MmFirstFreeSystemPte[PoolType].u.Long = 0;
+    MmFirstFreeSystemPte[PoolType].u.List.NextEntry = StartingPte -
+                                                      MmSystemPteBase;
+    
+    //
+    // The second entry stores the size of this PTE space
+    //
+    StartingPte++;
+    StartingPte->u.Long = 0;
+    StartingPte->u.List.NextEntry = NumberOfPtes;
+    
+    //
+    // We also keep a global for it
+    //
+    MmTotalFreeSystemPtes[PoolType] = NumberOfPtes;
+}
+
+/* EOF */

Propchange: trunk/reactos/ntoskrnl/mm/ARM3/syspte.c
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: trunk/reactos/ntoskrnl/mm/ARM3/syspte.c
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild?rev=41528&r1=41527&r2=41528&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] Mon Jun 22 12:51:28 2009
@@ -362,6 +362,7 @@
 		<directory name="ARM3">
 			<file>init.c</file>
 			<file>pool.c</file>
+			<file>syspte.c</file>
 		</directory>
 		<file>anonmem.c</file>
 		<file>balance.c</file>



More information about the Ros-diffs mailing list