mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-01 19:26:16 +00:00
[NTOSKRNL]
- Implement amd64 version of MmDeleteProcessPageDirectory - Fix amd64 build svn path=/trunk/; revision=55505
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
#include "../mm/ARM3/miarm.h"
|
||||
#undef MmSystemRangeStart
|
||||
|
||||
VOID NTAPI RtlpBreakWithStatusInstruction(VOID);
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#define MODULE_INVOLVED_IN_ARM3
|
||||
#include "miarm.h"
|
||||
#undef MmSystemRangeStart
|
||||
|
||||
/* GLOBALS ********************************************************************/
|
||||
|
||||
@@ -170,7 +171,7 @@ PMMPDE MmSystemPagePtes;
|
||||
//
|
||||
// This should be 0xC0C00000 -- the cache itself starts at 0xC1000000
|
||||
//
|
||||
PMMWSL MmSystemCacheWorkingSetList = MI_SYSTEM_CACHE_WS_START;
|
||||
PMMWSL MmSystemCacheWorkingSetList = (PVOID)MI_SYSTEM_CACHE_WS_START;
|
||||
|
||||
//
|
||||
// Windows NT seems to choose between 7000, 11000 and 50000
|
||||
|
||||
@@ -137,6 +137,80 @@ MiFlushTlb(PMMPTE Pte, PVOID Address)
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
VOID
|
||||
MmDeletePageTablePfn(PFN_NUMBER PageFrameNumber, ULONG Level)
|
||||
{
|
||||
PMMPTE PageTable;
|
||||
KIRQL OldIrql;
|
||||
PMMPFN PfnEntry;
|
||||
ULONG i, NumberEntries;
|
||||
|
||||
/* Check if this is a page table */
|
||||
if (Level > 0)
|
||||
{
|
||||
NumberEntries = (Level == 4) ? MiAddressToPxi(MmHighestUserAddress)+1 : 512;
|
||||
|
||||
/* Map the page table in hyperspace */
|
||||
PageTable = (PMMPTE)MmCreateHyperspaceMapping(PageFrameNumber);
|
||||
|
||||
/* Loop all page table entries */
|
||||
for (i = 0; i < NumberEntries; i++)
|
||||
{
|
||||
/* Check if the entry is valid */
|
||||
if (PageTable[i].u.Hard.Valid)
|
||||
{
|
||||
/* Recursively free the page that backs it */
|
||||
MmDeletePageTablePfn(PageTable[i].u.Hard.PageFrameNumber, Level - 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Delete the hyperspace mapping */
|
||||
MmDeleteHyperspaceMapping(PageTable);
|
||||
}
|
||||
|
||||
/* Check if this is a legacy allocation */
|
||||
PfnEntry = MiGetPfnEntry(PageFrameNumber);
|
||||
if (MI_IS_ROS_PFN(PfnEntry))
|
||||
{
|
||||
/* Free it using the legacy API */
|
||||
MmReleasePageMemoryConsumer(MC_SYSTEM, PageFrameNumber);
|
||||
}
|
||||
else
|
||||
{
|
||||
OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
|
||||
|
||||
/* Free it using the ARM3 API */
|
||||
MI_SET_PFN_DELETED(PfnEntry);
|
||||
MiDecrementShareCount(PfnEntry, PageFrameNumber);
|
||||
|
||||
KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
|
||||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
MmDeleteProcessPageDirectory(PEPROCESS Process)
|
||||
{
|
||||
PFN_NUMBER TableBasePfn;
|
||||
PMMPTE PageDir;
|
||||
|
||||
/* Get the page directory PFN */
|
||||
TableBasePfn = Process->Pcb.DirectoryTableBase[0] >> PAGE_SHIFT;
|
||||
|
||||
/* Map the page directory in hyperspace */
|
||||
PageDir = (PMMPTE)MmCreateHyperspaceMapping(TableBasePfn);
|
||||
|
||||
/* Free the hyperspace mapping page (ARM3) */
|
||||
//MmDeletePageTablePfn(PageDir[ADDR_TO_PDE_OFFSET(HYPERSPACE)].u.Hard.PageFrameNumber, 3);
|
||||
|
||||
/* Delete the hyperspace mapping */
|
||||
MmDeleteHyperspaceMapping(PageDir);
|
||||
|
||||
/* Recursively free the page directories */
|
||||
MmDeletePageTablePfn(TableBasePfn, 4);
|
||||
}
|
||||
|
||||
static
|
||||
PMMPTE
|
||||
MiGetPteForProcess(
|
||||
@@ -628,44 +702,6 @@ MmCreateVirtualMapping(PEPROCESS Process,
|
||||
return MmCreateVirtualMappingUnsafe(Process, Address, Protect, Pages, PageCount);
|
||||
}
|
||||
|
||||
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
|
||||
MmCreateProcessAddressSpace(IN ULONG MinWs,
|
||||
|
||||
Reference in New Issue
Block a user