mirror of
https://github.com/reactos/reactos.git
synced 2025-06-10 04:14:53 +00:00
- Fix a bug in memory area creation: Static memory areas had the static flag embedded in their type, so code that was switch()ing on the type would fail to recognize the actual type, because MEMORY_AREA_STATIC was ORed in.
- Add a new memory area type: MEMORY_AREA_OWNED_BY_ARM3. This will allow us to instruct the ReactOS Memory MAnager to "Back. The Fuck. Off." during page faults and such, so we can handle page faults inside ARM3-owned PTEs ourselves. - Right now, all ARM3 PTEs and data is nonpaged, so no page faults should happen, but this may change in the future. - Also will allow us to manage our own PDEs so we can do on-demand inpage instead of syncing with the ReactOS Mm hack cache. - Create all memory areas in one shot in MmCreateSystemMemoryAreas (get rid of MiInitPageDirectoryMap and MiInitPagedPool memory area creation). - Mark all of ours as owned by ARM3. - Make them all static. - The only non-ARM3 one right now is paged pool, we own all the other static areas. - Move this code into mm, instead of mm/ARM3, since memory areas are not an ARM3 concept. - Also create memory areas for session space, session view, and other ARM3 memory ranges, so nobody touches those ranges. - Dump the kernel address space after all this is done, in a MmDbg function in mm. - This cleans up ARM3 of some ROS-specific code, and also collapses Phase 1 and 2 into a single phase. svn path=/trunk/; revision=43486
This commit is contained in:
parent
8774094ea9
commit
071a297838
7 changed files with 213 additions and 161 deletions
|
@ -46,7 +46,7 @@ typedef ULONG PFN_TYPE, *PPFN_TYPE;
|
||||||
#define MMDBG_COPY_MAX_SIZE 0x8
|
#define MMDBG_COPY_MAX_SIZE 0x8
|
||||||
|
|
||||||
|
|
||||||
#define MI_STATIC_MEMORY_AREAS (8)
|
#define MI_STATIC_MEMORY_AREAS (12)
|
||||||
|
|
||||||
#define MEMORY_AREA_INVALID (0)
|
#define MEMORY_AREA_INVALID (0)
|
||||||
#define MEMORY_AREA_SECTION_VIEW (1)
|
#define MEMORY_AREA_SECTION_VIEW (1)
|
||||||
|
@ -62,6 +62,7 @@ typedef ULONG PFN_TYPE, *PPFN_TYPE;
|
||||||
#define MEMORY_AREA_PAGED_POOL (12)
|
#define MEMORY_AREA_PAGED_POOL (12)
|
||||||
#define MEMORY_AREA_NO_ACCESS (13)
|
#define MEMORY_AREA_NO_ACCESS (13)
|
||||||
#define MEMORY_AREA_PEB_OR_TEB (14)
|
#define MEMORY_AREA_PEB_OR_TEB (14)
|
||||||
|
#define MEMORY_AREA_OWNED_BY_ARM3 (15)
|
||||||
#define MEMORY_AREA_STATIC (0x80000000)
|
#define MEMORY_AREA_STATIC (0x80000000)
|
||||||
|
|
||||||
#define MM_PHYSICAL_PAGE_MPW_PENDING (0x8)
|
#define MM_PHYSICAL_PAGE_MPW_PENDING (0x8)
|
||||||
|
|
|
@ -600,20 +600,16 @@ MmArmInitSystem(IN ULONG Phase,
|
||||||
PLIST_ENTRY NextEntry;
|
PLIST_ENTRY NextEntry;
|
||||||
PMEMORY_ALLOCATION_DESCRIPTOR MdBlock;
|
PMEMORY_ALLOCATION_DESCRIPTOR MdBlock;
|
||||||
ULONG FreePages = 0;
|
ULONG FreePages = 0;
|
||||||
PMEMORY_AREA MArea;
|
|
||||||
PHYSICAL_ADDRESS BoundaryAddressMultiple;
|
|
||||||
PFN_NUMBER PageFrameIndex;
|
PFN_NUMBER PageFrameIndex;
|
||||||
PMMPTE StartPde, EndPde, PointerPte, LastPte;
|
PMMPTE StartPde, EndPde, PointerPte, LastPte;
|
||||||
MMPTE TempPde = HyperTemplatePte, TempPte = HyperTemplatePte;
|
MMPTE TempPde = HyperTemplatePte, TempPte = HyperTemplatePte;
|
||||||
PVOID NonPagedPoolExpansionVa, BaseAddress;
|
PVOID NonPagedPoolExpansionVa;
|
||||||
NTSTATUS Status;
|
|
||||||
ULONG OldCount;
|
ULONG OldCount;
|
||||||
BOOLEAN IncludeType[LoaderMaximum];
|
BOOLEAN IncludeType[LoaderMaximum];
|
||||||
ULONG i;
|
ULONG i;
|
||||||
PVOID Bitmap;
|
PVOID Bitmap;
|
||||||
PPHYSICAL_MEMORY_RUN Run;
|
PPHYSICAL_MEMORY_RUN Run;
|
||||||
PFN_NUMBER FreePage, FreePageCount, PagesLeft, BasePage, PageCount;
|
PFN_NUMBER FreePage, FreePageCount, PagesLeft, BasePage, PageCount;
|
||||||
BoundaryAddressMultiple.QuadPart = 0;
|
|
||||||
|
|
||||||
if (Phase == 0)
|
if (Phase == 0)
|
||||||
{
|
{
|
||||||
|
@ -1084,37 +1080,6 @@ MmArmInitSystem(IN ULONG Phase,
|
||||||
*PointerPte++ = TempPte;
|
*PointerPte++ = TempPte;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// ReactOS requires a memory area to keep the initial NP area off-bounds
|
|
||||||
//
|
|
||||||
BaseAddress = MmNonPagedPoolStart;
|
|
||||||
Status = MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
|
||||||
MEMORY_AREA_SYSTEM | MEMORY_AREA_STATIC,
|
|
||||||
&BaseAddress,
|
|
||||||
MmSizeOfNonPagedPoolInBytes,
|
|
||||||
PAGE_READWRITE,
|
|
||||||
&MArea,
|
|
||||||
TRUE,
|
|
||||||
0,
|
|
||||||
BoundaryAddressMultiple);
|
|
||||||
ASSERT(Status == STATUS_SUCCESS);
|
|
||||||
|
|
||||||
//
|
|
||||||
// And we need one more for the system NP
|
|
||||||
//
|
|
||||||
BaseAddress = MmNonPagedSystemStart;
|
|
||||||
Status = MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
|
||||||
MEMORY_AREA_SYSTEM | MEMORY_AREA_STATIC,
|
|
||||||
&BaseAddress,
|
|
||||||
(ULONG_PTR)MmNonPagedPoolEnd -
|
|
||||||
(ULONG_PTR)MmNonPagedSystemStart,
|
|
||||||
PAGE_READWRITE,
|
|
||||||
&MArea,
|
|
||||||
TRUE,
|
|
||||||
0,
|
|
||||||
BoundaryAddressMultiple);
|
|
||||||
ASSERT(Status == STATUS_SUCCESS);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Sanity check: make sure we have properly defined the system PTE space
|
// Sanity check: make sure we have properly defined the system PTE space
|
||||||
//
|
//
|
||||||
|
@ -1324,9 +1289,7 @@ MmArmInitSystem(IN ULONG Phase,
|
||||||
MiSyncARM3WithROS(MmNonPagedSystemStart, (PVOID)((ULONG_PTR)MmNonPagedPoolEnd - 1));
|
MiSyncARM3WithROS(MmNonPagedSystemStart, (PVOID)((ULONG_PTR)MmNonPagedPoolEnd - 1));
|
||||||
MiSyncARM3WithROS(MmPfnDatabase, (PVOID)((ULONG_PTR)MmNonPagedPoolStart + MmSizeOfNonPagedPoolInBytes - 1));
|
MiSyncARM3WithROS(MmPfnDatabase, (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));
|
||||||
}
|
|
||||||
else // NOW WE HAVE NONPAGED POOL
|
|
||||||
{
|
|
||||||
//
|
//
|
||||||
// Instantiate memory that we don't consider RAM/usable
|
// Instantiate memory that we don't consider RAM/usable
|
||||||
// We use the same exclusions that Windows does, in order to try to be
|
// We use the same exclusions that Windows does, in order to try to be
|
||||||
|
@ -1400,53 +1363,6 @@ MmArmInitSystem(IN ULONG Phase,
|
||||||
// Size up paged pool and build the shadow system page directory
|
// Size up paged pool and build the shadow system page directory
|
||||||
//
|
//
|
||||||
MiBuildPagedPool();
|
MiBuildPagedPool();
|
||||||
|
|
||||||
//
|
|
||||||
// Print the memory layout
|
|
||||||
//
|
|
||||||
DPRINT1(" 0x%p - 0x%p\t%s\n",
|
|
||||||
MmSystemRangeStart,
|
|
||||||
(ULONG_PTR)MmSystemRangeStart + MmBootImageSize,
|
|
||||||
"Boot Loaded Image");
|
|
||||||
DPRINT1(" 0x%p - 0x%p\t%s\n",
|
|
||||||
MmPagedPoolBase,
|
|
||||||
(ULONG_PTR)MmPagedPoolBase + MmPagedPoolSize,
|
|
||||||
"Paged Pool");
|
|
||||||
DPRINT1(" 0x%p - 0x%p\t%s\n",
|
|
||||||
MmPfnDatabase,
|
|
||||||
(ULONG_PTR)MmPfnDatabase + (MxPfnAllocation << PAGE_SHIFT),
|
|
||||||
"PFN Database");
|
|
||||||
DPRINT1(" 0x%p - 0x%p\t%s\n",
|
|
||||||
MmNonPagedPoolStart,
|
|
||||||
(ULONG_PTR)MmNonPagedPoolStart + MmSizeOfNonPagedPoolInBytes,
|
|
||||||
"ARM³ Non Paged Pool");
|
|
||||||
DPRINT1(" 0x%p - 0x%p\t%s\n",
|
|
||||||
MiSystemViewStart,
|
|
||||||
(ULONG_PTR)MiSystemViewStart + MmSystemViewSize,
|
|
||||||
"System View Space");
|
|
||||||
DPRINT1(" 0x%p - 0x%p\t%s\n",
|
|
||||||
MmSessionBase,
|
|
||||||
MiSessionSpaceEnd,
|
|
||||||
"Session Space");
|
|
||||||
DPRINT1(" 0x%p - 0x%p\t%s\n",
|
|
||||||
PTE_BASE, PDE_BASE,
|
|
||||||
"Page Tables");
|
|
||||||
DPRINT1(" 0x%p - 0x%p\t%s\n",
|
|
||||||
PDE_BASE, HYPER_SPACE,
|
|
||||||
"Page Directories");
|
|
||||||
DPRINT1(" 0x%p - 0x%p\t%s\n",
|
|
||||||
HYPER_SPACE, HYPER_SPACE + (4 * 1024 * 1024),
|
|
||||||
"Hyperspace");
|
|
||||||
DPRINT1(" 0x%p - 0x%p\t%s\n",
|
|
||||||
MmPagedPoolStart,
|
|
||||||
(ULONG_PTR)MmPagedPoolStart + MmSizeOfPagedPoolInBytes,
|
|
||||||
"ARM³ Paged Pool");
|
|
||||||
DPRINT1(" 0x%p - 0x%p\t%s\n",
|
|
||||||
MmNonPagedSystemStart, MmNonPagedPoolExpansionStart,
|
|
||||||
"System PTE Space");
|
|
||||||
DPRINT1(" 0x%p - 0x%p\t%s\n",
|
|
||||||
MmNonPagedPoolExpansionStart, MmNonPagedPoolEnd,
|
|
||||||
"Non Paged Pool Expansion PTE Space");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -147,6 +147,15 @@ extern ULONG MxPfnAllocation;
|
||||||
extern MM_PAGED_POOL_INFO MmPagedPoolInfo;
|
extern MM_PAGED_POOL_INFO MmPagedPoolInfo;
|
||||||
extern RTL_BITMAP MiPfnBitMap;
|
extern RTL_BITMAP MiPfnBitMap;
|
||||||
extern KGUARDED_MUTEX MmPagedPoolMutex;
|
extern KGUARDED_MUTEX MmPagedPoolMutex;
|
||||||
|
extern PVOID MmPagedPoolStart;
|
||||||
|
extern PVOID MmPagedPoolEnd;
|
||||||
|
extern PVOID MmNonPagedSystemStart;
|
||||||
|
extern PVOID MiSystemViewStart;
|
||||||
|
extern ULONG MmSystemViewSize;
|
||||||
|
extern PVOID MmSessionBase;
|
||||||
|
extern PVOID MiSessionSpaceEnd;
|
||||||
|
extern ULONG MmSizeOfPagedPoolInBytes;
|
||||||
|
extern PMMPTE MmSystemPagePtes;
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
|
|
|
@ -1034,48 +1034,4 @@ MmInitGlobalKernelPageDirectory(VOID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
|
||||||
INIT_FUNCTION
|
|
||||||
NTAPI
|
|
||||||
MiInitPageDirectoryMap(VOID)
|
|
||||||
{
|
|
||||||
MEMORY_AREA* kernel_map_desc = NULL;
|
|
||||||
MEMORY_AREA* hyperspace_desc = NULL;
|
|
||||||
PHYSICAL_ADDRESS BoundaryAddressMultiple;
|
|
||||||
PVOID BaseAddress;
|
|
||||||
NTSTATUS Status;
|
|
||||||
|
|
||||||
DPRINT("MiInitPageDirectoryMap()\n");
|
|
||||||
|
|
||||||
BoundaryAddressMultiple.QuadPart = 0;
|
|
||||||
BaseAddress = (PVOID)PAGETABLE_MAP;
|
|
||||||
Status = MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
|
||||||
MEMORY_AREA_SYSTEM | MEMORY_AREA_STATIC,
|
|
||||||
&BaseAddress,
|
|
||||||
0x400000,
|
|
||||||
PAGE_READWRITE,
|
|
||||||
&kernel_map_desc,
|
|
||||||
TRUE,
|
|
||||||
0,
|
|
||||||
BoundaryAddressMultiple);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
KeBugCheck(MEMORY_MANAGEMENT);
|
|
||||||
}
|
|
||||||
BaseAddress = (PVOID)HYPERSPACE;
|
|
||||||
Status = MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
|
||||||
MEMORY_AREA_SYSTEM | MEMORY_AREA_STATIC,
|
|
||||||
&BaseAddress,
|
|
||||||
0x400000,
|
|
||||||
PAGE_READWRITE,
|
|
||||||
&hyperspace_desc,
|
|
||||||
TRUE,
|
|
||||||
0,
|
|
||||||
BoundaryAddressMultiple);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
KeBugCheck(MEMORY_MANAGEMENT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -996,6 +996,7 @@ MmCreateMemoryArea(PMMSUPPORT AddressSpace,
|
||||||
//
|
//
|
||||||
ASSERT(MiStaticMemoryAreaCount < MI_STATIC_MEMORY_AREAS);
|
ASSERT(MiStaticMemoryAreaCount < MI_STATIC_MEMORY_AREAS);
|
||||||
MemoryArea = &MiStaticMemoryAreas[MiStaticMemoryAreaCount++];
|
MemoryArea = &MiStaticMemoryAreas[MiStaticMemoryAreaCount++];
|
||||||
|
Type &= ~MEMORY_AREA_STATIC;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,6 +12,9 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
#define MODULE_INVOLVED_IN_ARM3
|
||||||
|
#include "ARM3/miarm.h"
|
||||||
|
|
||||||
/* GLOBALS *******************************************************************/
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
||||||
PCHAR
|
PCHAR
|
||||||
|
@ -69,19 +72,151 @@ MiInitSystemMemoryAreas()
|
||||||
PVOID BaseAddress;
|
PVOID BaseAddress;
|
||||||
PHYSICAL_ADDRESS BoundaryAddressMultiple;
|
PHYSICAL_ADDRESS BoundaryAddressMultiple;
|
||||||
PMEMORY_AREA MArea;
|
PMEMORY_AREA MArea;
|
||||||
|
NTSTATUS Status;
|
||||||
BoundaryAddressMultiple.QuadPart = 0;
|
BoundaryAddressMultiple.QuadPart = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
// First initialize the page table and hyperspace memory areas
|
// Create the memory area to define the PTE base
|
||||||
//
|
//
|
||||||
MiInitPageDirectoryMap();
|
BaseAddress = (PVOID)PTE_BASE;
|
||||||
|
Status = MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
||||||
|
MEMORY_AREA_OWNED_BY_ARM3 | MEMORY_AREA_STATIC,
|
||||||
|
&BaseAddress,
|
||||||
|
4 * 1024 * 1024,
|
||||||
|
PAGE_READWRITE,
|
||||||
|
&MArea,
|
||||||
|
TRUE,
|
||||||
|
0,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
|
ASSERT(Status == STATUS_SUCCESS);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create the memory area to define Hyperspace
|
||||||
|
//
|
||||||
|
BaseAddress = (PVOID)HYPER_SPACE;
|
||||||
|
Status = MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
||||||
|
MEMORY_AREA_OWNED_BY_ARM3 | MEMORY_AREA_STATIC,
|
||||||
|
&BaseAddress,
|
||||||
|
4 * 1024 * 1024,
|
||||||
|
PAGE_READWRITE,
|
||||||
|
&MArea,
|
||||||
|
TRUE,
|
||||||
|
0,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
|
ASSERT(Status == STATUS_SUCCESS);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Protect the PFN database
|
||||||
|
//
|
||||||
|
BaseAddress = MmPfnDatabase;
|
||||||
|
Status = MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
||||||
|
MEMORY_AREA_OWNED_BY_ARM3 | MEMORY_AREA_STATIC,
|
||||||
|
&BaseAddress,
|
||||||
|
(MxPfnAllocation << PAGE_SHIFT),
|
||||||
|
PAGE_READWRITE,
|
||||||
|
&MArea,
|
||||||
|
TRUE,
|
||||||
|
0,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
|
ASSERT(Status == STATUS_SUCCESS);
|
||||||
|
|
||||||
|
//
|
||||||
|
// ReactOS requires a memory area to keep the initial NP area off-bounds
|
||||||
|
//
|
||||||
|
BaseAddress = MmNonPagedPoolStart;
|
||||||
|
Status = MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
||||||
|
MEMORY_AREA_OWNED_BY_ARM3 | MEMORY_AREA_STATIC,
|
||||||
|
&BaseAddress,
|
||||||
|
MmSizeOfNonPagedPoolInBytes,
|
||||||
|
PAGE_READWRITE,
|
||||||
|
&MArea,
|
||||||
|
TRUE,
|
||||||
|
0,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
|
ASSERT(Status == STATUS_SUCCESS);
|
||||||
|
|
||||||
|
//
|
||||||
|
// And we need one more for the system NP
|
||||||
|
//
|
||||||
|
BaseAddress = MmNonPagedSystemStart;
|
||||||
|
Status = MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
||||||
|
MEMORY_AREA_OWNED_BY_ARM3 | MEMORY_AREA_STATIC,
|
||||||
|
&BaseAddress,
|
||||||
|
(ULONG_PTR)MmNonPagedPoolEnd -
|
||||||
|
(ULONG_PTR)MmNonPagedSystemStart,
|
||||||
|
PAGE_READWRITE,
|
||||||
|
&MArea,
|
||||||
|
TRUE,
|
||||||
|
0,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
|
ASSERT(Status == STATUS_SUCCESS);
|
||||||
|
|
||||||
|
//
|
||||||
|
// We also need one for system view space
|
||||||
|
//
|
||||||
|
BaseAddress = MiSystemViewStart;
|
||||||
|
Status = MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
||||||
|
MEMORY_AREA_OWNED_BY_ARM3 | MEMORY_AREA_STATIC,
|
||||||
|
&BaseAddress,
|
||||||
|
MmSystemViewSize,
|
||||||
|
PAGE_READWRITE,
|
||||||
|
&MArea,
|
||||||
|
TRUE,
|
||||||
|
0,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
|
ASSERT(Status == STATUS_SUCCESS);
|
||||||
|
|
||||||
|
//
|
||||||
|
// And another for session space
|
||||||
|
//
|
||||||
|
BaseAddress = MmSessionBase;
|
||||||
|
Status = MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
||||||
|
MEMORY_AREA_OWNED_BY_ARM3 | MEMORY_AREA_STATIC,
|
||||||
|
&BaseAddress,
|
||||||
|
(ULONG_PTR)MiSessionSpaceEnd -
|
||||||
|
(ULONG_PTR)MmSessionBase,
|
||||||
|
PAGE_READWRITE,
|
||||||
|
&MArea,
|
||||||
|
TRUE,
|
||||||
|
0,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
|
ASSERT(Status == STATUS_SUCCESS);
|
||||||
|
|
||||||
|
//
|
||||||
|
// One more for ARM paged pool
|
||||||
|
//
|
||||||
|
BaseAddress = MmPagedPoolStart;
|
||||||
|
Status = MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
||||||
|
MEMORY_AREA_OWNED_BY_ARM3 | MEMORY_AREA_STATIC,
|
||||||
|
&BaseAddress,
|
||||||
|
MmSizeOfPagedPoolInBytes,
|
||||||
|
PAGE_READWRITE,
|
||||||
|
&MArea,
|
||||||
|
TRUE,
|
||||||
|
0,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
|
ASSERT(Status == STATUS_SUCCESS);
|
||||||
|
|
||||||
|
//
|
||||||
|
// And now, ReactOS paged pool
|
||||||
|
//
|
||||||
|
BaseAddress = MmPagedPoolBase;
|
||||||
|
MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
||||||
|
MEMORY_AREA_PAGED_POOL | MEMORY_AREA_STATIC,
|
||||||
|
&BaseAddress,
|
||||||
|
MmPagedPoolSize,
|
||||||
|
PAGE_READWRITE,
|
||||||
|
&MArea,
|
||||||
|
TRUE,
|
||||||
|
0,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Next, the KPCR
|
// Next, the KPCR
|
||||||
//
|
//
|
||||||
BaseAddress = (PVOID)PCR;
|
BaseAddress = (PVOID)PCR;
|
||||||
MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
||||||
MEMORY_AREA_SYSTEM | MEMORY_AREA_STATIC,
|
MEMORY_AREA_OWNED_BY_ARM3 | MEMORY_AREA_STATIC,
|
||||||
&BaseAddress,
|
&BaseAddress,
|
||||||
PAGE_SIZE * KeNumberProcessors,
|
PAGE_SIZE * KeNumberProcessors,
|
||||||
PAGE_READWRITE,
|
PAGE_READWRITE,
|
||||||
|
@ -95,7 +230,7 @@ MiInitSystemMemoryAreas()
|
||||||
//
|
//
|
||||||
BaseAddress = (PVOID)KI_USER_SHARED_DATA;
|
BaseAddress = (PVOID)KI_USER_SHARED_DATA;
|
||||||
MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
||||||
MEMORY_AREA_SYSTEM | MEMORY_AREA_STATIC,
|
MEMORY_AREA_OWNED_BY_ARM3 | MEMORY_AREA_STATIC,
|
||||||
&BaseAddress,
|
&BaseAddress,
|
||||||
PAGE_SIZE,
|
PAGE_SIZE,
|
||||||
PAGE_READWRITE,
|
PAGE_READWRITE,
|
||||||
|
@ -105,6 +240,58 @@ MiInitSystemMemoryAreas()
|
||||||
BoundaryAddressMultiple);
|
BoundaryAddressMultiple);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
MiDbgDumpAddressSpace(VOID)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Print the memory layout
|
||||||
|
//
|
||||||
|
DPRINT1(" 0x%p - 0x%p\t%s\n",
|
||||||
|
MmSystemRangeStart,
|
||||||
|
(ULONG_PTR)MmSystemRangeStart + MmBootImageSize,
|
||||||
|
"Boot Loaded Image");
|
||||||
|
DPRINT1(" 0x%p - 0x%p\t%s\n",
|
||||||
|
MmPagedPoolBase,
|
||||||
|
(ULONG_PTR)MmPagedPoolBase + MmPagedPoolSize,
|
||||||
|
"Paged Pool");
|
||||||
|
DPRINT1(" 0x%p - 0x%p\t%s\n",
|
||||||
|
MmPfnDatabase,
|
||||||
|
(ULONG_PTR)MmPfnDatabase + (MxPfnAllocation << PAGE_SHIFT),
|
||||||
|
"PFN Database");
|
||||||
|
DPRINT1(" 0x%p - 0x%p\t%s\n",
|
||||||
|
MmNonPagedPoolStart,
|
||||||
|
(ULONG_PTR)MmNonPagedPoolStart + MmSizeOfNonPagedPoolInBytes,
|
||||||
|
"ARM³ Non Paged Pool");
|
||||||
|
DPRINT1(" 0x%p - 0x%p\t%s\n",
|
||||||
|
MiSystemViewStart,
|
||||||
|
(ULONG_PTR)MiSystemViewStart + MmSystemViewSize,
|
||||||
|
"System View Space");
|
||||||
|
DPRINT1(" 0x%p - 0x%p\t%s\n",
|
||||||
|
MmSessionBase,
|
||||||
|
MiSessionSpaceEnd,
|
||||||
|
"Session Space");
|
||||||
|
DPRINT1(" 0x%p - 0x%p\t%s\n",
|
||||||
|
PTE_BASE, PDE_BASE,
|
||||||
|
"Page Tables");
|
||||||
|
DPRINT1(" 0x%p - 0x%p\t%s\n",
|
||||||
|
PDE_BASE, HYPER_SPACE,
|
||||||
|
"Page Directories");
|
||||||
|
DPRINT1(" 0x%p - 0x%p\t%s\n",
|
||||||
|
HYPER_SPACE, HYPER_SPACE + (4 * 1024 * 1024),
|
||||||
|
"Hyperspace");
|
||||||
|
DPRINT1(" 0x%p - 0x%p\t%s\n",
|
||||||
|
MmPagedPoolStart,
|
||||||
|
(ULONG_PTR)MmPagedPoolStart + MmSizeOfPagedPoolInBytes,
|
||||||
|
"ARM³ Paged Pool");
|
||||||
|
DPRINT1(" 0x%p - 0x%p\t%s\n",
|
||||||
|
MmNonPagedSystemStart, MmNonPagedPoolExpansionStart,
|
||||||
|
"System PTE Space");
|
||||||
|
DPRINT1(" 0x%p - 0x%p\t%s\n",
|
||||||
|
MmNonPagedPoolExpansionStart, MmNonPagedPoolEnd,
|
||||||
|
"Non Paged Pool Expansion PTE Space");
|
||||||
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
MiDbgDumpMemoryDescriptors(VOID)
|
MiDbgDumpMemoryDescriptors(VOID)
|
||||||
|
@ -149,9 +336,6 @@ MmInit1(VOID)
|
||||||
//
|
//
|
||||||
MmArmInitSystem(0, KeLoaderBlock);
|
MmArmInitSystem(0, KeLoaderBlock);
|
||||||
|
|
||||||
/* Intialize system memory areas */
|
|
||||||
MiInitSystemMemoryAreas();
|
|
||||||
|
|
||||||
/* Initialize the page list */
|
/* Initialize the page list */
|
||||||
MmInitializePageList();
|
MmInitializePageList();
|
||||||
|
|
||||||
|
@ -165,10 +349,11 @@ MmInit1(VOID)
|
||||||
MmBootImageSize);
|
MmBootImageSize);
|
||||||
MmPagedPoolSize = MM_PAGED_POOL_SIZE;
|
MmPagedPoolSize = MM_PAGED_POOL_SIZE;
|
||||||
|
|
||||||
//
|
/* Intialize system memory areas */
|
||||||
// Initialize ARM³ in phase 2
|
MiInitSystemMemoryAreas();
|
||||||
//
|
|
||||||
MmArmInitSystem(2, KeLoaderBlock);
|
/* Dump the address space */
|
||||||
|
MiDbgDumpAddressSpace();
|
||||||
|
|
||||||
/* Initialize paged pool */
|
/* Initialize paged pool */
|
||||||
MmInitializePagedPool();
|
MmInitializePagedPool();
|
||||||
|
|
|
@ -52,22 +52,6 @@ INIT_FUNCTION
|
||||||
NTAPI
|
NTAPI
|
||||||
MmInitializePagedPool(VOID)
|
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
|
* 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.
|
* the first page of the paged pool before writing the first block header.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue