Author: ros-arm-bringup Date: Sun Jul 27 15:58:23 2008 New Revision: 34859
URL: http://svn.reactos.org/svn/reactos?rev=34859&view=rev Log: - Fix a couple of bugs, and majorly refactor MmDeleteVirtualMapping to sync it to the x86 version somewhat more.
Modified: trunk/reactos/ntoskrnl/mm/arm/stubs.c
Modified: trunk/reactos/ntoskrnl/mm/arm/stubs.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/arm/stubs.c?rev... ============================================================================== --- trunk/reactos/ntoskrnl/mm/arm/stubs.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/arm/stubs.c [iso-8859-1] Sun Jul 27 15:58:23 2008 @@ -569,80 +569,42 @@ { PMMPTE PointerPte; MMPTE Pte; + PFN_NUMBER Pfn = 0;
// // Get the PTE // PointerPte = MiGetPageTableForProcess(NULL, Address, FALSE); - if (!PointerPte) - { - // - // Invalid PDE - // - if (WasDirty) *WasDirty = FALSE; - if (Page) *Page = 0; - return; - } - - // - // Save the PTE - // - Pte = *PointerPte; - if (PointerPte->u.Hard.L1.Fault.Type == FaultPte) - { - // - // Invalid PTE - // - if (WasDirty) *WasDirty = FALSE; - if (Page) *Page = 0; - return; - } - - // - // Destroy the PTE - // - PointerPte->u.Hard.AsUlong = 0; - ASSERT(PointerPte->u.Hard.L2.Fault.Type == FaultPte); - - // - // Flush the TLB - // - MiFlushTlb(PointerPte, Address); - - // - // Check if the PTE was valid - // - if (Pte.u.Hard.L2.Fault.Type != FaultPte) - { - // - // Mark the page as unmapped - // - MmMarkPageUnmapped(Pte.u.Hard.L2.Small.BaseAddress); - } - else - { - // - // Make it sane - // - Pte.u.Hard.L2.Small.BaseAddress = 0; - } - - // - // Check if this was our page, and valid - // - if ((FreePage) && (Pte.u.Hard.L2.Fault.Type != FaultPte)) - { - // - // Release it - // - MmReleasePageMemoryConsumer(MC_NPPOOL, Pte.u.Hard.L2.Small.BaseAddress); + if (PointerPte) + { + // + // Save and destroy the PTE + // + Pte = *PointerPte; + PointerPte->u.Hard.AsUlong = 0; + + // + // Flush the TLB + // + MiFlushTlb(PointerPte, Address); + + // + // Unmap the PFN + // + Pfn = Pte.u.Hard.L2.Small.BaseAddress; + if (Pfn) MmMarkPageUnmapped(Pfn); + + // + // Release the PFN if it was ours + // + if ((FreePage) && (Pfn)) MmReleasePageMemoryConsumer(MC_NPPOOL, Pfn); }
// // Return if the page was dirty // - if (WasDirty) *WasDirty = TRUE; // LIE!!! - if (Page) *Page = Pte.u.Hard.L2.Small.BaseAddress; + if (WasDirty) *WasDirty = FALSE; // LIE!!! + if (Page) *Page = Pfn; }
PVOID