[NTOSKRNL]

- Modify MiRosTakeOverPebTebRanges to only create a memory area for the shared user page and rename it to MiRosTakeOverSharedUserPage. Previously it was creating a memory area for the whole region from USER_SHARED_DATA up to MM_HIGHEST_USER_ADDRESS, which is the majority of the x64 user mode address space and doesn't even contain the PEB/TEB. Those are allocated below the shared user page and get their memory areas created in MiInsertNode.
- Add amd64 versions of MmGetPageTableForProcess, MmUnmapPageTable, MmGetPageFileMapping

svn path=/trunk/; revision=55438
This commit is contained in:
Timo Kreuzer 2012-02-05 18:41:37 +00:00
parent 78b0ef2aa4
commit 440561287c
2 changed files with 42 additions and 5 deletions

View file

@ -24,7 +24,7 @@ PMMWSL MmWorkingSetList;
VOID
NTAPI
MiRosTakeOverPebTebRanges(IN PEPROCESS Process)
MiRosTakeOverSharedUserPage(IN PEPROCESS Process)
{
NTSTATUS Status;
PMEMORY_AREA MemoryArea;
@ -35,8 +35,7 @@ MiRosTakeOverPebTebRanges(IN PEPROCESS Process)
Status = MmCreateMemoryArea(&Process->Vm,
MEMORY_AREA_OWNED_BY_ARM3,
&AllocatedBase,
((ULONG_PTR)MM_HIGHEST_USER_ADDRESS - 1) -
(ULONG_PTR)USER_SHARED_DATA,
PAGE_SIZE,
PAGE_READWRITE,
&MemoryArea,
TRUE,
@ -1002,7 +1001,7 @@ MmInitializeProcessAddressSpace(IN PEPROCESS Process,
KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
/* Lock the VAD, ARM3-owned ranges away */
MiRosTakeOverPebTebRanges(Process);
MiRosTakeOverSharedUserPage(Process);
/* Check if there's a Section Object */
if (SectionObject)
@ -1102,7 +1101,7 @@ INIT_FUNCTION
MmInitializeHandBuiltProcess2(IN PEPROCESS Process)
{
/* Lock the VAD, ARM3-owned ranges away */
MiRosTakeOverPebTebRanges(Process);
MiRosTakeOverSharedUserPage(Process);
return STATUS_SUCCESS;
}

View file

@ -336,6 +336,44 @@ MmIsPageSwapEntry(PEPROCESS Process, PVOID Address)
return Pte.u.Hard.Valid && Pte.u.Soft.Transition;
}
static PMMPTE
MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create)
{
__debugbreak();
return 0;
}
BOOLEAN MmUnmapPageTable(PMMPTE Pt)
{
ASSERT(FALSE);
return 0;
}
static ULONG64 MmGetPageEntryForProcess(PEPROCESS Process, PVOID Address)
{
MMPTE Pte, *PointerPte;
PointerPte = MmGetPageTableForProcess(Process, Address, FALSE);
if (PointerPte)
{
Pte = *PointerPte;
MmUnmapPageTable(PointerPte);
return Pte.u.Long;
}
return 0;
}
VOID
NTAPI
MmGetPageFileMapping(
PEPROCESS Process,
PVOID Address,
SWAPENTRY* SwapEntry)
{
ULONG64 Entry = MmGetPageEntryForProcess(Process, Address);
*SwapEntry = Entry >> 1;
}
BOOLEAN
NTAPI
MmIsDirtyPage(PEPROCESS Process, PVOID Address)