- 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.


svn path=/trunk/; revision=41824
This commit is contained in:
ReactOS Portable Systems Group 2009-07-09 09:33:49 +00:00
parent 62951bd925
commit 16e52e7c46
4 changed files with 150 additions and 2 deletions

View file

@ -0,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 */

View file

@ -132,7 +132,7 @@ MiSyncARM3WithROS(IN PVOID AddressStart,
// Puerile piece of junk-grade carbonized horseshit puss sold to the lowest bidder // Puerile piece of junk-grade carbonized horseshit puss sold to the lowest bidder
// //
ULONG Pde = ADDR_TO_PDE_OFFSET(AddressStart); 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 // This both odious and heinous
@ -707,8 +707,13 @@ MmArmInitSystem(IN ULONG Phase,
// Sync us up with ReactOS Mm // Sync us up with ReactOS Mm
// //
MiSyncARM3WithROS(MmNonPagedSystemStart, (PVOID)((ULONG_PTR)MmNonPagedPoolEnd - 1)); 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)); MiSyncARM3WithROS((PVOID)HYPER_SPACE, (PVOID)(HYPER_SPACE + PAGE_SIZE - 1));
//
// Initialize the nonpaged pool
//
InitializePool(NonPagedPool, 0);
} }
else else
{ {

View file

@ -13,6 +13,56 @@
#define MI_MAX_NONPAGED_POOL_SIZE (128 * 1024 * 1024) #define MI_MAX_NONPAGED_POOL_SIZE (128 * 1024 * 1024)
#define MI_MAX_FREE_PAGE_LISTS 4 #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 typedef enum _MMSYSTEM_PTE_POOL_TYPE
{ {
SystemPteSpace, SystemPteSpace,
@ -62,6 +112,13 @@ MiInitializeArmPool(
VOID VOID
); );
VOID
NTAPI
InitializePool( //
IN POOL_TYPE PoolType,
IN ULONG Threshold
);
VOID VOID
NTAPI NTAPI
MiInitializeSystemPtes( MiInitializeSystemPtes(

View file

@ -363,6 +363,7 @@
<file>contmem.c</file> <file>contmem.c</file>
<file>drvmgmt.c</file> <file>drvmgmt.c</file>
<file>dynamic.c</file> <file>dynamic.c</file>
<file>expool.c</file>
<file>hypermap.c</file> <file>hypermap.c</file>
<file>init.c</file> <file>init.c</file>
<file>iosup.c</file> <file>iosup.c</file>