mirror of
https://github.com/reactos/reactos.git
synced 2025-04-05 05:01:03 +00:00
[NTOS:MM] Remove some dead code from legacy Mm
This commit is contained in:
parent
521d330d04
commit
82dd1afe33
4 changed files with 8 additions and 107 deletions
|
@ -744,7 +744,7 @@ VOID
|
|||
NTAPI
|
||||
MmCleanProcessAddressSpace(IN PEPROCESS Process);
|
||||
|
||||
NTSTATUS
|
||||
VOID
|
||||
NTAPI
|
||||
MmDeleteProcessAddressSpace(IN PEPROCESS Process);
|
||||
|
||||
|
|
|
@ -1326,12 +1326,18 @@ MmCleanProcessAddressSpace(IN PEPROCESS Process)
|
|||
|
||||
VOID
|
||||
NTAPI
|
||||
MmDeleteProcessAddressSpace2(IN PEPROCESS Process)
|
||||
MmDeleteProcessAddressSpace(IN PEPROCESS Process)
|
||||
{
|
||||
PMMPFN Pfn1, Pfn2;
|
||||
KIRQL OldIrql;
|
||||
PFN_NUMBER PageFrameIndex;
|
||||
|
||||
#ifndef _M_AMD64
|
||||
OldIrql = MiAcquireExpansionLock();
|
||||
RemoveEntryList(&Process->MmProcessLinks);
|
||||
MiReleaseExpansionLock(OldIrql);
|
||||
#endif
|
||||
|
||||
//ASSERT(Process->CommitCharge == 0);
|
||||
|
||||
/* Remove us from the list */
|
||||
|
|
|
@ -254,13 +254,6 @@ MmTrimUserMemory(ULONG Target, ULONG Priority, PULONG NrFreedPages)
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static BOOLEAN
|
||||
MiIsBalancerThread(VOID)
|
||||
{
|
||||
return (MiBalancerThreadHandle != NULL) &&
|
||||
(PsGetCurrentThreadId() == MiBalancerThreadId.UniqueThread);
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
MmRebalanceMemoryConsumers(VOID)
|
||||
|
@ -320,32 +313,6 @@ MiBalancerThread(PVOID Unused)
|
|||
{
|
||||
ULONG InitialTarget = 0;
|
||||
|
||||
#if (_MI_PAGING_LEVELS == 2)
|
||||
if (!MiIsBalancerThread())
|
||||
{
|
||||
/* Clean up the unused PDEs */
|
||||
ULONG_PTR Address;
|
||||
PEPROCESS Process = PsGetCurrentProcess();
|
||||
|
||||
/* Acquire PFN lock */
|
||||
KIRQL OldIrql = MiAcquirePfnLock();
|
||||
PMMPDE pointerPde;
|
||||
for (Address = (ULONG_PTR)MI_LOWEST_VAD_ADDRESS;
|
||||
Address < (ULONG_PTR)MM_HIGHEST_VAD_ADDRESS;
|
||||
Address += PTE_PER_PAGE * PAGE_SIZE)
|
||||
{
|
||||
if (MiQueryPageTableReferences((PVOID)Address) == 0)
|
||||
{
|
||||
pointerPde = MiAddressToPde(Address);
|
||||
if (pointerPde->u.Hard.Valid)
|
||||
MiDeletePte(pointerPde, MiPdeToPte(pointerPde), Process, NULL);
|
||||
ASSERT(pointerPde->u.Hard.Valid == 0);
|
||||
}
|
||||
}
|
||||
/* Release lock */
|
||||
MiReleasePfnLock(OldIrql);
|
||||
}
|
||||
#endif
|
||||
do
|
||||
{
|
||||
ULONG OldTarget = InitialTarget;
|
||||
|
|
|
@ -547,76 +547,4 @@ MiRosCleanupMemoryArea(
|
|||
/* Make sure this worked! */
|
||||
ASSERT(NT_SUCCESS(Status));
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
MmDeleteProcessAddressSpace2(IN PEPROCESS Process);
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
MmDeleteProcessAddressSpace(PEPROCESS Process)
|
||||
{
|
||||
#ifndef _M_AMD64
|
||||
KIRQL OldIrql;
|
||||
#endif
|
||||
|
||||
DPRINT("MmDeleteProcessAddressSpace(Process %p (%s))\n", Process,
|
||||
Process->ImageFileName);
|
||||
|
||||
#ifndef _M_AMD64
|
||||
OldIrql = MiAcquireExpansionLock();
|
||||
RemoveEntryList(&Process->MmProcessLinks);
|
||||
MiReleaseExpansionLock(OldIrql);
|
||||
#endif
|
||||
MmLockAddressSpace(&Process->Vm);
|
||||
|
||||
#if (_MI_PAGING_LEVELS == 2)
|
||||
{
|
||||
KIRQL OldIrql;
|
||||
PVOID Address;
|
||||
PMMPDE pointerPde;
|
||||
|
||||
/* Attach to Process */
|
||||
KeAttachProcess(&Process->Pcb);
|
||||
|
||||
/* Acquire PFN lock */
|
||||
OldIrql = MiAcquirePfnLock();
|
||||
|
||||
for (Address = MI_LOWEST_VAD_ADDRESS;
|
||||
Address < MM_HIGHEST_VAD_ADDRESS;
|
||||
Address = (PVOID)((ULONG_PTR)Address + (PTE_PER_PAGE * PAGE_SIZE)))
|
||||
{
|
||||
/* At this point all references should be dead */
|
||||
if (MiQueryPageTableReferences(Address) != 0)
|
||||
{
|
||||
DPRINT1("Process %p, Address %p, UsedPageTableEntries %lu\n",
|
||||
Process,
|
||||
Address,
|
||||
MiQueryPageTableReferences(Address));
|
||||
ASSERT(MiQueryPageTableReferences(Address) == 0);
|
||||
}
|
||||
|
||||
pointerPde = MiAddressToPde(Address);
|
||||
/* Unlike in ARM3, we don't necesarrily free the PDE page as soon as reference reaches 0,
|
||||
* so we must clean up a bit when process closes */
|
||||
if (pointerPde->u.Hard.Valid)
|
||||
MiDeletePte(pointerPde, MiPdeToPte(pointerPde), Process, NULL);
|
||||
ASSERT(pointerPde->u.Hard.Valid == 0);
|
||||
}
|
||||
|
||||
/* Release lock */
|
||||
MiReleasePfnLock(OldIrql);
|
||||
|
||||
/* Detach */
|
||||
KeDetachProcess();
|
||||
}
|
||||
#endif
|
||||
|
||||
MmUnlockAddressSpace(&Process->Vm);
|
||||
|
||||
DPRINT("Finished MmDeleteProcessAddressSpace()\n");
|
||||
MmDeleteProcessAddressSpace2(Process);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
Loading…
Reference in a new issue