https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b445005c7086ef76a0ace…
commit b445005c7086ef76a0acefc022878d47ada1487c
Author:     Jérôme Gardou <jerome.gardou(a)reactos.org>
AuthorDate: Wed Mar 10 15:24:31 2021 +0100
Commit:     Jérôme Gardou <zefklop(a)users.noreply.github.com>
CommitDate: Thu Apr 8 15:40:37 2021 +0200
    [NTOS:MM] Get rid of MmRosFlushVirtualMemory
    It's not used anywhere now, and it will eventually be gone
---
 ntoskrnl/include/internal/mm.h |  8 -----
 ntoskrnl/mm/ARM3/virtual.c     |  6 ++--
 ntoskrnl/mm/section.c          | 75 ------------------------------------------
 3 files changed, 4 insertions(+), 85 deletions(-)
diff --git a/ntoskrnl/include/internal/mm.h b/ntoskrnl/include/internal/mm.h
index f5dd0a4e049..93c44e5bd05 100644
--- a/ntoskrnl/include/internal/mm.h
+++ b/ntoskrnl/include/internal/mm.h
@@ -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(
diff --git a/ntoskrnl/mm/ARM3/virtual.c b/ntoskrnl/mm/ARM3/virtual.c
index 986b345e6c6..eb03fa15e75 100644
--- a/ntoskrnl/mm/ARM3/virtual.c
+++ b/ntoskrnl/mm/ARM3/virtual.c
@@ -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
diff --git a/ntoskrnl/mm/section.c b/ntoskrnl/mm/section.c
index 5df50f191ef..2485d5bb5f5 100644
--- a/ntoskrnl/mm/section.c
+++ b/ntoskrnl/mm/section.c
@@ -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