mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 17:05:46 +00:00
- Nonpaged pool MEMORY_AREA is now initialized during nonpaged pool initialization (and it is now a static MEMORY_AREA).
- Paged pool MEMORY_AREA is now initialized during paged pool initialization. - Remaining MEMORY_AREAs (KPCR and KUSER_SHARED_DATA) are now created in MiInitSystemMemoryAreas (and they are also static) instead of MmInitVirtualMemory, since this is really what the function was doing. - The page table and hyperspace MEMORY_AREAs are still initialized the same, but are also now static. - The creation of these core/system memory areas is now done much earlier. For example, hyperspace memory area is now created before hyperspace is mapped. - Nonpaged pool, paged pool, and working set initialization is now done outside MiInitSystemMemoryAreas and roughly at the same time as before. - Removed MmInitVirtualMemory as it had become a kitchen sink of random Memory Manager initialization code. - I/O and Local APIC MEMORY_AREAs are not created anymore, since that should be done by the HAL, not the kernel. svn path=/trunk/; revision=41510
This commit is contained in:
parent
f29743948c
commit
e7b3dac46f
6 changed files with 86 additions and 110 deletions
|
@ -29,7 +29,7 @@ struct _MM_PAGEOP;
|
|||
typedef ULONG SWAPENTRY;
|
||||
typedef ULONG PFN_TYPE, *PPFN_TYPE;
|
||||
|
||||
#define MI_STATIC_MEMORY_AREAS (1)
|
||||
#define MI_STATIC_MEMORY_AREAS (6)
|
||||
|
||||
#define MEMORY_AREA_INVALID (0)
|
||||
#define MEMORY_AREA_SECTION_VIEW (1)
|
||||
|
|
|
@ -1161,7 +1161,7 @@ MiInitPageDirectoryMap(VOID)
|
|||
BoundaryAddressMultiple.QuadPart = 0;
|
||||
BaseAddress = (PVOID)PAGETABLE_MAP;
|
||||
Status = MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
||||
MEMORY_AREA_SYSTEM,
|
||||
MEMORY_AREA_SYSTEM | MEMORY_AREA_STATIC,
|
||||
&BaseAddress,
|
||||
0x400000,
|
||||
PAGE_READWRITE,
|
||||
|
@ -1175,7 +1175,7 @@ MiInitPageDirectoryMap(VOID)
|
|||
}
|
||||
BaseAddress = (PVOID)HYPERSPACE;
|
||||
Status = MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
||||
MEMORY_AREA_SYSTEM,
|
||||
MEMORY_AREA_SYSTEM | MEMORY_AREA_STATIC,
|
||||
&BaseAddress,
|
||||
0x400000,
|
||||
PAGE_READWRITE,
|
||||
|
|
|
@ -293,7 +293,8 @@ MmNotPresentFault(KPROCESSOR_MODE Mode,
|
|||
break;
|
||||
|
||||
case MEMORY_AREA_SHARED_DATA:
|
||||
Pfn = MmSharedDataPagePhysicalAddress.LowPart >> PAGE_SHIFT;
|
||||
Pfn = MmGetPhysicalAddress((PVOID)PCR).LowPart >> PAGE_SHIFT;
|
||||
Pfn++;
|
||||
Status =
|
||||
MmCreateVirtualMapping(PsGetCurrentProcess(),
|
||||
(PVOID)PAGE_ROUND_DOWN(Address),
|
||||
|
|
|
@ -47,7 +47,6 @@ MemType[] =
|
|||
|
||||
BOOLEAN IsThisAnNtAsSystem = FALSE;
|
||||
MM_SYSTEMSIZE MmSystemSize = MmSmallSystem;
|
||||
PHYSICAL_ADDRESS MmSharedDataPagePhysicalAddress;
|
||||
PVOID MiNonPagedPoolStart;
|
||||
ULONG MiNonPagedPoolLength;
|
||||
ULONG MmBootImageSize;
|
||||
|
@ -107,110 +106,45 @@ MiShutdownMemoryManager(VOID)
|
|||
VOID
|
||||
INIT_FUNCTION
|
||||
NTAPI
|
||||
MmInitVirtualMemory()
|
||||
MiInitSystemMemoryAreas()
|
||||
{
|
||||
PVOID BaseAddress;
|
||||
ULONG Length;
|
||||
NTSTATUS Status;
|
||||
PHYSICAL_ADDRESS BoundaryAddressMultiple;
|
||||
PMEMORY_AREA MArea;
|
||||
PVOID BaseAddress;
|
||||
PHYSICAL_ADDRESS BoundaryAddressMultiple;
|
||||
PMEMORY_AREA MArea;
|
||||
BoundaryAddressMultiple.QuadPart = 0;
|
||||
|
||||
//
|
||||
// First initialize the page table and hyperspace memory areas
|
||||
//
|
||||
MiInitPageDirectoryMap();
|
||||
|
||||
//
|
||||
// Next, the KPCR
|
||||
//
|
||||
BaseAddress = (PVOID)PCR;
|
||||
MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
||||
MEMORY_AREA_SYSTEM | MEMORY_AREA_STATIC,
|
||||
&BaseAddress,
|
||||
PAGE_SIZE * KeNumberProcessors,
|
||||
PAGE_READWRITE,
|
||||
&MArea,
|
||||
TRUE,
|
||||
0,
|
||||
BoundaryAddressMultiple);
|
||||
|
||||
BoundaryAddressMultiple.QuadPart = 0;
|
||||
|
||||
DPRINT("NonPagedPool %x - %x, PagedPool %x - %x\n", MiNonPagedPoolStart, (ULONG_PTR)MiNonPagedPoolStart + MiNonPagedPoolLength - 1,
|
||||
MmPagedPoolBase, (ULONG_PTR)MmPagedPoolBase + MmPagedPoolSize - 1);
|
||||
|
||||
MiInitializeNonPagedPool();
|
||||
|
||||
/*
|
||||
* Setup the system area descriptor list
|
||||
*/
|
||||
MiInitPageDirectoryMap();
|
||||
|
||||
BaseAddress = (PVOID)PCR;
|
||||
MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
||||
MEMORY_AREA_SYSTEM,
|
||||
&BaseAddress,
|
||||
PAGE_SIZE * KeNumberProcessors,
|
||||
PAGE_READWRITE,
|
||||
&MArea,
|
||||
TRUE,
|
||||
0,
|
||||
BoundaryAddressMultiple);
|
||||
|
||||
#if defined(_M_IX86)
|
||||
/* Local APIC base */
|
||||
BaseAddress = (PVOID)0xFEE00000;
|
||||
MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
||||
MEMORY_AREA_SYSTEM,
|
||||
&BaseAddress,
|
||||
PAGE_SIZE,
|
||||
PAGE_READWRITE,
|
||||
&MArea,
|
||||
TRUE,
|
||||
0,
|
||||
BoundaryAddressMultiple);
|
||||
|
||||
/* i/o APIC base */
|
||||
BaseAddress = (PVOID)0xFEC00000;
|
||||
MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
||||
MEMORY_AREA_SYSTEM,
|
||||
&BaseAddress,
|
||||
PAGE_SIZE,
|
||||
PAGE_READWRITE,
|
||||
&MArea,
|
||||
TRUE,
|
||||
0,
|
||||
BoundaryAddressMultiple);
|
||||
#endif
|
||||
|
||||
BaseAddress = MiNonPagedPoolStart;
|
||||
MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
||||
MEMORY_AREA_SYSTEM,
|
||||
&BaseAddress,
|
||||
MiNonPagedPoolLength,
|
||||
PAGE_READWRITE,
|
||||
&MArea,
|
||||
TRUE,
|
||||
0,
|
||||
BoundaryAddressMultiple);
|
||||
|
||||
BaseAddress = MmPagedPoolBase;
|
||||
Status = MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
||||
MEMORY_AREA_PAGED_POOL,
|
||||
&BaseAddress,
|
||||
MmPagedPoolSize,
|
||||
PAGE_READWRITE,
|
||||
&MArea,
|
||||
TRUE,
|
||||
0,
|
||||
BoundaryAddressMultiple);
|
||||
|
||||
MmInitializePagedPool();
|
||||
|
||||
/*
|
||||
* Create the kernel mapping of the user/kernel shared memory.
|
||||
*/
|
||||
BaseAddress = (PVOID)KI_USER_SHARED_DATA;
|
||||
Length = PAGE_SIZE;
|
||||
MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
||||
MEMORY_AREA_SYSTEM,
|
||||
&BaseAddress,
|
||||
Length,
|
||||
PAGE_READWRITE,
|
||||
&MArea,
|
||||
TRUE,
|
||||
0,
|
||||
BoundaryAddressMultiple);
|
||||
|
||||
/* Shared data are always located the next page after PCR */
|
||||
MmSharedDataPagePhysicalAddress = MmGetPhysicalAddress((PVOID)PCR);
|
||||
MmSharedDataPagePhysicalAddress.QuadPart += PAGE_SIZE;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
MmInitializeMemoryConsumer(MC_USER, MmTrimUserMemory);
|
||||
//
|
||||
// Now the KUSER_SHARED_DATA
|
||||
//
|
||||
BaseAddress = (PVOID)KI_USER_SHARED_DATA;
|
||||
MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
||||
MEMORY_AREA_SYSTEM | MEMORY_AREA_STATIC,
|
||||
&BaseAddress,
|
||||
PAGE_SIZE,
|
||||
PAGE_READWRITE,
|
||||
&MArea,
|
||||
TRUE,
|
||||
0,
|
||||
BoundaryAddressMultiple);
|
||||
}
|
||||
|
||||
VOID
|
||||
|
@ -432,6 +366,9 @@ MmInit1(VOID)
|
|||
|
||||
/* Dump kernel memory layout */
|
||||
MiDbgKernelLayout();
|
||||
|
||||
/* Intialize system memory areas */
|
||||
MiInitSystemMemoryAreas();
|
||||
|
||||
/* Initialize hyperspace */
|
||||
MiInitHyperSpace();
|
||||
|
@ -441,12 +378,18 @@ MmInit1(VOID)
|
|||
|
||||
/* Unmap low memory */
|
||||
MmDeletePageTable(NULL, 0);
|
||||
|
||||
/* Intialize memory areas */
|
||||
MmInitVirtualMemory();
|
||||
|
||||
/* Initialize nonpaged pool */
|
||||
MiInitializeNonPagedPool();
|
||||
|
||||
/* Initialize paged pool */
|
||||
MmInitializePagedPool();
|
||||
|
||||
/* Initialize MDLs */
|
||||
MmInitializeMdlImplementation();
|
||||
|
||||
/* Initialize working sets */
|
||||
MmInitializeMemoryConsumer(MC_USER, MmTrimUserMemory);
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
|
|
|
@ -1699,6 +1699,22 @@ MiInitializeNonPagedPool(VOID)
|
|||
PVOID Address;
|
||||
HDR_USED* used;
|
||||
HDR_FREE* free;
|
||||
PVOID BaseAddress;
|
||||
PHYSICAL_ADDRESS BoundaryAddressMultiple;
|
||||
PMEMORY_AREA MArea;
|
||||
BoundaryAddressMultiple.QuadPart = 0;
|
||||
|
||||
BaseAddress = MiNonPagedPoolStart;
|
||||
MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
||||
MEMORY_AREA_SYSTEM | MEMORY_AREA_STATIC,
|
||||
&BaseAddress,
|
||||
MiNonPagedPoolLength,
|
||||
PAGE_READWRITE,
|
||||
&MArea,
|
||||
TRUE,
|
||||
0,
|
||||
BoundaryAddressMultiple);
|
||||
|
||||
#ifdef TAG_STATISTICS_TRACKING
|
||||
|
||||
for (i = 0; i < TAG_HASH_TABLE_SIZE; i++)
|
||||
|
|
|
@ -52,6 +52,22 @@ INIT_FUNCTION
|
|||
NTAPI
|
||||
MmInitializePagedPool(VOID)
|
||||
{
|
||||
PVOID BaseAddress;
|
||||
PHYSICAL_ADDRESS BoundaryAddressMultiple;
|
||||
PMEMORY_AREA MArea;
|
||||
BoundaryAddressMultiple.QuadPart = 0;
|
||||
|
||||
BaseAddress = MmPagedPoolBase;
|
||||
MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
||||
MEMORY_AREA_PAGED_POOL,
|
||||
&BaseAddress,
|
||||
MmPagedPoolSize,
|
||||
PAGE_READWRITE,
|
||||
&MArea,
|
||||
TRUE,
|
||||
0,
|
||||
BoundaryAddressMultiple);
|
||||
|
||||
/*
|
||||
* We are still at a high IRQL level at this point so explicitly commit
|
||||
* the first page of the paged pool before writing the first block header.
|
||||
|
|
Loading…
Reference in a new issue