mirror of
https://github.com/reactos/reactos.git
synced 2025-01-13 01:22:03 +00:00
- Initialize the ARM pool (MiInitializeArmPool):
- Do some additional accounting to keep track of initial nonpaged pool range and size. - Create and initialize the free page lists, and free page entries. - Validate that the initial nonpaged pool address space was properly mapped. - Validate that the expansion nonpaged pool address space is unmapped, and prepare to map it. svn path=/trunk/; revision=41527
This commit is contained in:
parent
773786eb4c
commit
e980bd998f
4 changed files with 143 additions and 0 deletions
|
@ -362,6 +362,11 @@ MmArmInitSystem(IN ULONG Phase,
|
|||
0,
|
||||
BoundaryAddressMultiple);
|
||||
ASSERT(Status == STATUS_SUCCESS);
|
||||
|
||||
//
|
||||
// Now go ahead and initialize the ARM pool
|
||||
//
|
||||
MiInitializeArmPool();
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -9,7 +9,19 @@
|
|||
#define MI_MIN_PAGES_FOR_NONPAGED_POOL_TUNING ((255*1024*1024) >> PAGE_SHIFT)
|
||||
#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
|
||||
|
||||
extern MMPTE HyperTemplatePte;
|
||||
|
||||
extern ULONG MmSizeOfNonPagedPoolInBytes;
|
||||
extern ULONG MmMaximumNonPagedPoolInBytes;
|
||||
extern PVOID MmNonPagedPoolStart;
|
||||
extern PVOID MmNonPagedPoolExpansionStart;
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
MiInitializeArmPool(
|
||||
VOID
|
||||
);
|
||||
|
||||
/* EOF */
|
||||
|
|
125
reactos/ntoskrnl/mm/ARM3/pool.c
Normal file
125
reactos/ntoskrnl/mm/ARM3/pool.c
Normal file
|
@ -0,0 +1,125 @@
|
|||
/*
|
||||
* PROJECT: ReactOS Kernel
|
||||
* LICENSE: BSD - See COPYING.ARM in the top level directory
|
||||
* FILE: ntoskrnl/mm/ARM3/pool.c
|
||||
* PURPOSE: ARM Memory Manager Pool Allocator
|
||||
* PROGRAMMERS: ReactOS Portable Systems Group
|
||||
*/
|
||||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include <ntoskrnl.h>
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
#line 15 "ARM³::POOL"
|
||||
#define MODULE_INVOLVED_IN_ARM3
|
||||
#include "../ARM3/miarm.h"
|
||||
|
||||
/* GLOBALS ********************************************************************/
|
||||
|
||||
LIST_ENTRY MmNonPagedPoolFreeListHead[MI_MAX_FREE_PAGE_LISTS];
|
||||
PFN_NUMBER MmNumberOfFreeNonPagedPool, MiExpansionPoolPagesInitialCharge;
|
||||
PVOID MmNonPagedPoolEnd0;
|
||||
PFN_NUMBER MiStartOfInitialPoolFrame, MiEndOfInitialPoolFrame;
|
||||
|
||||
/* PRIVATE FUNCTIONS **********************************************************/
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
MiInitializeArmPool(VOID)
|
||||
{
|
||||
ULONG i;
|
||||
PFN_NUMBER PoolPages;
|
||||
PMMFREE_POOL_ENTRY FreeEntry, FirstEntry;
|
||||
PMMPTE PointerPte;
|
||||
PAGED_CODE();
|
||||
|
||||
//
|
||||
// We keep 4 lists of free pages (4 lists help avoid contention)
|
||||
//
|
||||
for (i = 0; i < MI_MAX_FREE_PAGE_LISTS; i++)
|
||||
{
|
||||
//
|
||||
// Initialize each of them
|
||||
//
|
||||
InitializeListHead(&MmNonPagedPoolFreeListHead[i]);
|
||||
}
|
||||
|
||||
//
|
||||
// Calculate how many pages the initial nonpaged pool has
|
||||
//
|
||||
PoolPages = BYTES_TO_PAGES(MmSizeOfNonPagedPoolInBytes);
|
||||
MmNumberOfFreeNonPagedPool = PoolPages;
|
||||
|
||||
//
|
||||
// Initialize the first free entry
|
||||
//
|
||||
FreeEntry = MmNonPagedPoolStart;
|
||||
FirstEntry = FreeEntry;
|
||||
FreeEntry->Size = PoolPages;
|
||||
FreeEntry->Owner = FirstEntry;
|
||||
|
||||
//
|
||||
// Insert it into the last list
|
||||
//
|
||||
InsertHeadList(&MmNonPagedPoolFreeListHead[MI_MAX_FREE_PAGE_LISTS - 1],
|
||||
&FreeEntry->List);
|
||||
|
||||
//
|
||||
// Now create free entries for every single other page
|
||||
//
|
||||
while (PoolPages-- > 1)
|
||||
{
|
||||
//
|
||||
// Link them all back to the original entry
|
||||
//
|
||||
FreeEntry = (PMMFREE_POOL_ENTRY)((ULONG_PTR)FreeEntry + PAGE_SIZE);
|
||||
FreeEntry->Owner = FirstEntry;
|
||||
}
|
||||
|
||||
//
|
||||
// Validate and remember first allocated pool page
|
||||
//
|
||||
PointerPte = MiAddressToPte(MmNonPagedPoolStart);
|
||||
ASSERT(PointerPte->u.Hard.Valid == 1);
|
||||
MiStartOfInitialPoolFrame = PFN_FROM_PTE(PointerPte);
|
||||
|
||||
//
|
||||
// Keep track of where initial nonpaged pool ends
|
||||
//
|
||||
MmNonPagedPoolEnd0 = (PVOID)((ULONG_PTR)MmNonPagedPoolStart +
|
||||
MmSizeOfNonPagedPoolInBytes);
|
||||
|
||||
//
|
||||
// Validate and remember last allocated pool page
|
||||
//
|
||||
PointerPte = MiAddressToPte((PVOID)((ULONG_PTR)MmNonPagedPoolEnd0 - 1));
|
||||
ASSERT(PointerPte->u.Hard.Valid == 1);
|
||||
MiEndOfInitialPoolFrame = PFN_FROM_PTE(PointerPte);
|
||||
|
||||
//
|
||||
// Validate the first nonpaged pool expansion page (which is a guard page)
|
||||
//
|
||||
PointerPte = MiAddressToPte(MmNonPagedPoolExpansionStart);
|
||||
ASSERT(PointerPte->u.Hard.Valid == 0);
|
||||
|
||||
//
|
||||
// Calculate the size of the expansion region alone
|
||||
//
|
||||
MiExpansionPoolPagesInitialCharge =
|
||||
BYTES_TO_PAGES(MmMaximumNonPagedPoolInBytes - MmSizeOfNonPagedPoolInBytes);
|
||||
|
||||
//
|
||||
// Remove 2 pages, since there's a guard page on top and on the bottom
|
||||
//
|
||||
MiExpansionPoolPagesInitialCharge -= 2;
|
||||
|
||||
//
|
||||
// Now initialize the nonpaged pool expansion PTE space. Remember there's a
|
||||
// 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.
|
||||
//
|
||||
}
|
||||
|
||||
/* EOF */
|
|
@ -361,6 +361,7 @@
|
|||
</if>
|
||||
<directory name="ARM3">
|
||||
<file>init.c</file>
|
||||
<file>pool.c</file>
|
||||
</directory>
|
||||
<file>anonmem.c</file>
|
||||
<file>balance.c</file>
|
||||
|
|
Loading…
Reference in a new issue