Author: tkreuzer Date: Sun Feb 5 18:41:37 2012 New Revision: 55438 URL: http://svn.reactos.org/svn/reactos?rev=55438&view=rev Log: [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
Modified: trunk/reactos/ntoskrnl/mm/ARM3/procsup.c trunk/reactos/ntoskrnl/mm/amd64/page.c Modified: trunk/reactos/ntoskrnl/mm/ARM3/procsup.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/procsup.c?rev=55438&r1=55437&r2=55438&view=diff ============================================================================== --- trunk/reactos/ntoskrnl/mm/ARM3/procsup.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/ARM3/procsup.c [iso-8859-1] Sun Feb 5 18:41:37 2012 @@ -24,7 +24,7 @@ VOID NTAPI -MiRosTakeOverPebTebRanges(IN PEPROCESS Process) +MiRosTakeOverSharedUserPage(IN PEPROCESS Process) { NTSTATUS Status; PMEMORY_AREA MemoryArea; @@ -35,8 +35,7 @@ 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 @@ 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 @@ MmInitializeHandBuiltProcess2(IN PEPROCESS Process) { /* Lock the VAD, ARM3-owned ranges away */ - MiRosTakeOverPebTebRanges(Process); + MiRosTakeOverSharedUserPage(Process); return STATUS_SUCCESS; } Modified: trunk/reactos/ntoskrnl/mm/amd64/page.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/amd64/page.c?rev=55438&r1=55437&r2=55438&view=diff ============================================================================== --- trunk/reactos/ntoskrnl/mm/amd64/page.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/amd64/page.c [iso-8859-1] Sun Feb 5 18:41:37 2012 @@ -336,6 +336,44 @@ 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)