Author: ros-arm-bringup
Date: Thu Jul 9 13:33:49 2009
New Revision: 41824
URL:
http://svn.reactos.org/svn/reactos?rev=41824&view=rev
Log:
- Fix a critical bug in the German hack which was causing the last PDE not to be synched
with the ReactOS Memory Manager (or worse, the first, if there was only one PDE).
- Add a new file which will hold the executive layer above the pool allocator (the Ex*
routines).
- This should eventually be moved to \ex.
- Note that the current ReactOS pool Ex* routines are in \mm, which is dead wrong.
- Define the POOL_DESCRIPTOR and POOL_HEADER structures for the NT 5.2 pool.
- Define, create, and implement the routine to initialize a pool vector.
- For now, we assume you want the nonpaged pool vector/descriptor.
- Call this routine from the ARM3 initialization routine.
- No changes to system behavior other than the bugfix above.
Added:
trunk/reactos/ntoskrnl/mm/ARM3/expool.c (with props)
Modified:
trunk/reactos/ntoskrnl/mm/ARM3/init.c
trunk/reactos/ntoskrnl/mm/ARM3/miarm.h
trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild
Added: trunk/reactos/ntoskrnl/mm/ARM3/expool.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/expool.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/expool.c (added)
+++ trunk/reactos/ntoskrnl/mm/ARM3/expool.c [iso-8859-1] Thu Jul 9 13:33:49 2009
@@ -1,0 +1,85 @@
+/*
+ * PROJECT: ReactOS Kernel
+ * LICENSE: BSD - See COPYING.ARM in the top level directory
+ * FILE: ntoskrnl/mm/ARM3/expool.c
+ * PURPOSE: ARM Memory Manager Executive Pool Manager
+ * PROGRAMMERS: ReactOS Portable Systems Group
+ */
+
+/* INCLUDES *******************************************************************/
+
+#include <ntoskrnl.h>
+#define NDEBUG
+#include <debug.h>
+
+#line 15 "ARM³::EXPOOL"
+#define MODULE_INVOLVED_IN_ARM3
+#include "../ARM3/miarm.h"
+
+/* GLOBALS ********************************************************************/
+
+POOL_DESCRIPTOR NonPagedPoolDescriptor;
+PPOOL_DESCRIPTOR PoolVector[2];
+
+/* PRIVATE FUNCTIONS **********************************************************/
+
+VOID
+NTAPI
+ExInitializePoolDescriptor(IN PPOOL_DESCRIPTOR PoolDescriptor,
+ IN POOL_TYPE PoolType,
+ IN ULONG PoolIndex,
+ IN ULONG Threshold,
+ IN PVOID PoolLock)
+{
+ PLIST_ENTRY NextEntry, LastEntry;
+
+ //
+ // Setup the descriptor based on the caller's request
+ //
+ PoolDescriptor->PoolType = PoolType;
+ PoolDescriptor->PoolIndex = PoolIndex;
+ PoolDescriptor->Threshold = Threshold;
+ PoolDescriptor->LockAddress = PoolLock;
+
+ //
+ // Initialize accounting data
+ //
+ PoolDescriptor->RunningAllocs = 0;
+ PoolDescriptor->RunningDeAllocs = 0;
+ PoolDescriptor->TotalPages = 0;
+ PoolDescriptor->TotalBytes = 0;
+ PoolDescriptor->TotalBigPages = 0;
+
+ //
+ // Nothing pending for now
+ //
+ PoolDescriptor->PendingFrees = NULL;
+ PoolDescriptor->PendingFreeDepth = 0;
+
+ //
+ // Loop all the descriptor's allocation lists and initialize them
+ //
+ NextEntry = PoolDescriptor->ListHeads;
+ LastEntry = NextEntry + POOL_LISTS_PER_PAGE;
+ while (NextEntry < LastEntry) InitializeListHead(NextEntry++);
+}
+
+VOID
+NTAPI
+InitializePool(IN POOL_TYPE PoolType,
+ IN ULONG Threshold)
+{
+ ASSERT(PoolType == NonPagedPool);
+
+ //
+ // Initialize the nonpaged pool descirptor
+ //
+ PoolVector[PoolType] = &NonPagedPoolDescriptor;
+ ExInitializePoolDescriptor(PoolVector[PoolType],
+ PoolType,
+ 0,
+ Threshold,
+ NULL);
+}
+
+/* EOF */
Propchange: trunk/reactos/ntoskrnl/mm/ARM3/expool.c
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/reactos/ntoskrnl/mm/ARM3/expool.c
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: trunk/reactos/ntoskrnl/mm/ARM3/init.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/init.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/init.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/init.c [iso-8859-1] Thu Jul 9 13:33:49 2009
@@ -132,7 +132,7 @@
// Puerile piece of junk-grade carbonized horseshit puss sold to the lowest bidder
//
ULONG Pde = ADDR_TO_PDE_OFFSET(AddressStart);
- while (Pde < ADDR_TO_PDE_OFFSET(AddressEnd))
+ while (Pde <= ADDR_TO_PDE_OFFSET(AddressEnd))
{
//
// This both odious and heinous
@@ -707,8 +707,13 @@
// Sync us up with ReactOS Mm
//
MiSyncARM3WithROS(MmNonPagedSystemStart, (PVOID)((ULONG_PTR)MmNonPagedPoolEnd -
1));
- MiSyncARM3WithROS(MmNonPagedPoolStart, (PVOID)((ULONG_PTR)MmNonPagedPoolStart +
MmSizeOfNonPagedPoolInBytes - 1));
+ MiSyncARM3WithROS(MmArmPfnDatabase, (PVOID)((ULONG_PTR)MmNonPagedPoolStart +
MmSizeOfNonPagedPoolInBytes - 1));
MiSyncARM3WithROS((PVOID)HYPER_SPACE, (PVOID)(HYPER_SPACE + PAGE_SIZE - 1));
+
+ //
+ // Initialize the nonpaged pool
+ //
+ InitializePool(NonPagedPool, 0);
}
else
{
Modified: trunk/reactos/ntoskrnl/mm/ARM3/miarm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/miarm.h?r…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] Thu Jul 9 13:33:49 2009
@@ -12,6 +12,56 @@
#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
+
+//
+// FIXFIX: These should go in ex.h after the pool merge
+//
+#define POOL_BLOCK_SIZE 8
+#define POOL_LISTS_PER_PAGE (PAGE_SIZE / POOL_BLOCK_SIZE)
+
+typedef struct _POOL_DESCRIPTOR
+{
+ POOL_TYPE PoolType;
+ ULONG PoolIndex;
+ ULONG RunningAllocs;
+ ULONG RunningDeAllocs;
+ ULONG TotalPages;
+ ULONG TotalBigPages;
+ ULONG Threshold;
+ PVOID LockAddress;
+ PVOID PendingFrees;
+ LONG PendingFreeDepth;
+ SIZE_T TotalBytes;
+ SIZE_T Spare0;
+ LIST_ENTRY ListHeads[POOL_LISTS_PER_PAGE];
+} POOL_DESCRIPTOR, *PPOOL_DESCRIPTOR;
+
+typedef struct _POOL_HEADER
+{
+ union
+ {
+ struct
+ {
+ USHORT PreviousSize:9;
+ USHORT PoolIndex:7;
+ USHORT BlockSize:9;
+ USHORT PoolType:7;
+ };
+ ULONG Ulong1;
+ };
+ union
+ {
+ ULONG PoolTag;
+ struct
+ {
+ USHORT AllocatorBackTraceIndex;
+ USHORT PoolTagHash;
+ };
+ };
+} POOL_HEADER, *PPOOL_HEADER;
+//
+// END FIXFIX
+//
typedef enum _MMSYSTEM_PTE_POOL_TYPE
{
@@ -60,6 +110,13 @@
NTAPI
MiInitializeArmPool(
VOID
+);
+
+VOID
+NTAPI
+InitializePool( //
+ IN POOL_TYPE PoolType,
+ IN ULONG Threshold
);
VOID
Modified: trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl-generic.…
==============================================================================
--- trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] Thu Jul 9 13:33:49 2009
@@ -363,6 +363,7 @@
<file>contmem.c</file>
<file>drvmgmt.c</file>
<file>dynamic.c</file>
+ <file>expool.c</file>
<file>hypermap.c</file>
<file>init.c</file>
<file>iosup.c</file>