[NTOS:MM] Get rid of MmRosFlushVirtualMemory

It's not used anywhere now, and it will eventually be gone
This commit is contained in:
Jérôme Gardou 2021-03-10 15:24:31 +01:00 committed by Jérôme Gardou
parent 9e121fb6c2
commit b445005c70
3 changed files with 4 additions and 85 deletions

View file

@ -1402,14 +1402,6 @@ MmMakePagesDirty(
_In_ PVOID Address,
_In_ ULONG Length);
NTSTATUS
NTAPI
MmRosFlushVirtualMemory(
_In_ PEPROCESS Process,
_Inout_ PVOID* Address,
_Inout_ PSIZE_T Length,
_Out_ PIO_STATUS_BLOCK Iosb);
NTSTATUS
NTAPI
MmFlushSegment(

View file

@ -1356,8 +1356,10 @@ MmFlushVirtualMemory(IN PEPROCESS Process,
OUT PIO_STATUS_BLOCK IoStatusBlock)
{
PAGED_CODE();
/* For now we call the old Mm */
return MmRosFlushVirtualMemory(Process, BaseAddress, RegionSize, IoStatusBlock);
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
ULONG

View file

@ -4534,81 +4534,6 @@ MmArePagesResident(
return Ret;
}
NTSTATUS
NTAPI
MmRosFlushVirtualMemory(
_In_ PEPROCESS Process,
_Inout_ PVOID* Address,
_Inout_ PSIZE_T Length,
_Out_ PIO_STATUS_BLOCK Iosb)
{
PMEMORY_AREA MemoryArea;
PMM_SECTION_SEGMENT Segment;
LARGE_INTEGER SegmentOffset, RangeEnd;
PMMSUPPORT AddressSpace = Process ? &Process->Vm : MmGetKernelAddressSpace();
PVOID CurrentAddress;
PAGED_CODE();
MmLockAddressSpace(AddressSpace);
DPRINT("Flushing Process %p at %p --> 0x%x", Process, *Address, *Length);
MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, *Address);
if ((MemoryArea == NULL) || (MemoryArea->Type != MEMORY_AREA_SECTION_VIEW) ||
(MemoryArea->VadNode.u.VadFlags.VadType == VadImageMap))
{
DPRINT1("Unable to find memory area at address %p.\n", Address);
MmUnlockAddressSpace(AddressSpace);
return STATUS_NOT_MAPPED_VIEW;
}
Segment = MemoryArea->SectionData.Segment;
SegmentOffset.QuadPart = PAGE_ROUND_DOWN(*Address) - MA_GetStartingAddress(MemoryArea)
+ MemoryArea->SectionData.ViewOffset;
RangeEnd.QuadPart = PAGE_ROUND_UP((ULONG_PTR)*Address + *Length) - MA_GetStartingAddress(MemoryArea)
+ MemoryArea->SectionData.ViewOffset;
CurrentAddress = *Address;
MmUnlockAddressSpace(AddressSpace);
MmLockSectionSegment(Segment);
Iosb->Information = 0;
while (SegmentOffset.QuadPart < RangeEnd.QuadPart)
{
ULONG_PTR Entry = MmGetPageEntrySectionSegment(Segment, &SegmentOffset);
/* Let any pending read proceed */
while (MM_IS_WAIT_PTE(Entry))
{
MmUnlockSectionSegment(Segment);
YieldProcessor();
MmLockSectionSegment(Segment);
Entry = MmGetPageEntrySectionSegment(Segment, &SegmentOffset);
}
/* We are called from Cc, this can't be backed by the page files */
ASSERT(!IS_SWAP_FROM_SSE(Entry));
/* At this point, there may be a valid page there */
if (Entry != 0)
{
/* This will write the page to disk, if needed */
MmCheckDirtySegment(Segment, &SegmentOffset, Process ? MmIsDirtyPage(Process, CurrentAddress) : FALSE, FALSE);
Iosb->Information += PAGE_SIZE;
}
SegmentOffset.QuadPart += PAGE_SIZE;
CurrentAddress = (PVOID)((ULONG_PTR)CurrentAddress + PAGE_SIZE);
}
MmUnlockSectionSegment(Segment);
return STATUS_SUCCESS;
}
/* Like CcPurgeCache but for the in-memory segment */
BOOLEAN
NTAPI