mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Don't mark pages as unmapped when releasing them via MmUnmapIoSpace
svn path=/trunk/; revision=4924
This commit is contained in:
parent
c37620bed9
commit
96d9fbe944
9 changed files with 30 additions and 24 deletions
|
@ -234,7 +234,8 @@ MmDeleteVirtualMapping(struct _EPROCESS* Process,
|
||||||
PVOID Address,
|
PVOID Address,
|
||||||
BOOL FreePage,
|
BOOL FreePage,
|
||||||
BOOL* WasDirty,
|
BOOL* WasDirty,
|
||||||
PHYSICAL_ADDRESS* PhysicalPage);
|
PHYSICAL_ADDRESS* PhysicalPage,
|
||||||
|
BOOL MarkPageUnmapped);
|
||||||
VOID MmUpdateStackPageDir(PULONG LocalPageDir, struct _KTHREAD* KThread);
|
VOID MmUpdateStackPageDir(PULONG LocalPageDir, struct _KTHREAD* KThread);
|
||||||
|
|
||||||
#define MM_PAGE_CLEAN (0)
|
#define MM_PAGE_CLEAN (0)
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: main.c,v 1.162 2003/06/16 16:45:52 ekohl Exp $
|
/* $Id: main.c,v 1.163 2003/06/19 15:48:39 gvg Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/ke/main.c
|
* FILE: ntoskrnl/ke/main.c
|
||||||
|
@ -295,7 +295,7 @@ MiFreeBootDriverMemory(PVOID StartAddress, ULONG Length)
|
||||||
for (i = 0; i < PAGE_ROUND_UP(Length)/PAGE_SIZE; i++)
|
for (i = 0; i < PAGE_ROUND_UP(Length)/PAGE_SIZE; i++)
|
||||||
{
|
{
|
||||||
Page = MmGetPhysicalAddressForProcess(NULL, StartAddress + i * PAGE_SIZE);
|
Page = MmGetPhysicalAddressForProcess(NULL, StartAddress + i * PAGE_SIZE);
|
||||||
MmDeleteVirtualMapping(NULL, StartAddress + i * PAGE_SIZE, FALSE, NULL, NULL);
|
MmDeleteVirtualMapping(NULL, StartAddress + i * PAGE_SIZE, FALSE, NULL, NULL, TRUE);
|
||||||
MmDereferencePage(Page);
|
MmDereferencePage(Page);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: anonmem.c,v 1.13 2003/05/17 15:28:58 ekohl Exp $
|
/* $Id: anonmem.c,v 1.14 2003/06/19 15:48:39 gvg Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/mm/anonmem.c
|
* FILE: ntoskrnl/mm/anonmem.c
|
||||||
|
@ -165,7 +165,7 @@ MmPageOutVirtualMemory(PMADDRESS_SPACE AddressSpace,
|
||||||
*/
|
*/
|
||||||
if (!WasDirty)
|
if (!WasDirty)
|
||||||
{
|
{
|
||||||
MmDeleteVirtualMapping(MemoryArea->Process, Address, FALSE, NULL, NULL);
|
MmDeleteVirtualMapping(MemoryArea->Process, Address, FALSE, NULL, NULL, TRUE);
|
||||||
MmDeleteAllRmaps(PhysicalAddress, NULL, NULL);
|
MmDeleteAllRmaps(PhysicalAddress, NULL, NULL);
|
||||||
if ((SwapEntry = MmGetSavedSwapEntryPage(PhysicalAddress)) != 0)
|
if ((SwapEntry = MmGetSavedSwapEntryPage(PhysicalAddress)) != 0)
|
||||||
{
|
{
|
||||||
|
@ -218,7 +218,7 @@ MmPageOutVirtualMemory(PMADDRESS_SPACE AddressSpace,
|
||||||
* Otherwise we have succeeded, free the page
|
* Otherwise we have succeeded, free the page
|
||||||
*/
|
*/
|
||||||
DPRINT("MM: Swapped out virtual memory page 0x%.8X!\n", PhysicalAddress);
|
DPRINT("MM: Swapped out virtual memory page 0x%.8X!\n", PhysicalAddress);
|
||||||
MmDeleteVirtualMapping(MemoryArea->Process, Address, FALSE, NULL, NULL);
|
MmDeleteVirtualMapping(MemoryArea->Process, Address, FALSE, NULL, NULL, TRUE);
|
||||||
MmCreatePageFileMapping(MemoryArea->Process, Address, SwapEntry);
|
MmCreatePageFileMapping(MemoryArea->Process, Address, SwapEntry);
|
||||||
MmDeleteAllRmaps(PhysicalAddress, NULL, NULL);
|
MmDeleteAllRmaps(PhysicalAddress, NULL, NULL);
|
||||||
MmSetSavedSwapEntryPage(PhysicalAddress, 0);
|
MmSetSavedSwapEntryPage(PhysicalAddress, 0);
|
||||||
|
@ -468,7 +468,7 @@ MmModifyAttributes(PMADDRESS_SPACE AddressSpace,
|
||||||
PhysicalAddr = MmGetPhysicalAddress(BaseAddress + (i*PAGE_SIZE));
|
PhysicalAddr = MmGetPhysicalAddress(BaseAddress + (i*PAGE_SIZE));
|
||||||
MmDeleteVirtualMapping(AddressSpace->Process,
|
MmDeleteVirtualMapping(AddressSpace->Process,
|
||||||
BaseAddress + (i*PAGE_SIZE),
|
BaseAddress + (i*PAGE_SIZE),
|
||||||
FALSE, NULL, NULL);
|
FALSE, NULL, NULL, TRUE);
|
||||||
if (PhysicalAddr.QuadPart != 0)
|
if (PhysicalAddr.QuadPart != 0)
|
||||||
{
|
{
|
||||||
SWAPENTRY SavedSwapEntry;
|
SWAPENTRY SavedSwapEntry;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: page.c,v 1.51 2003/06/01 19:50:04 hbirr Exp $
|
/* $Id: page.c,v 1.52 2003/06/19 15:48:39 gvg Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/mm/i386/page.c
|
* FILE: ntoskrnl/mm/i386/page.c
|
||||||
|
@ -444,7 +444,8 @@ MmDisableVirtualMapping(PEPROCESS Process, PVOID Address, BOOL* WasDirty, PHYSIC
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
MmDeleteVirtualMapping(PEPROCESS Process, PVOID Address, BOOL FreePage,
|
MmDeleteVirtualMapping(PEPROCESS Process, PVOID Address, BOOL FreePage,
|
||||||
BOOL* WasDirty, PHYSICAL_ADDRESS* PhysicalAddr)
|
BOOL* WasDirty, PHYSICAL_ADDRESS* PhysicalAddr,
|
||||||
|
BOOL MarkPageUnmapped)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Delete a virtual mapping
|
* FUNCTION: Delete a virtual mapping
|
||||||
*/
|
*/
|
||||||
|
@ -501,7 +502,7 @@ MmDeleteVirtualMapping(PEPROCESS Process, PVOID Address, BOOL FreePage,
|
||||||
Pte = (ULONG)InterlockedExchange((PLONG)ADDR_TO_PTE(Address), 0);
|
Pte = (ULONG)InterlockedExchange((PLONG)ADDR_TO_PTE(Address), 0);
|
||||||
FLUSH_TLB;
|
FLUSH_TLB;
|
||||||
WasValid = (PAGE_MASK(Pte) != 0);
|
WasValid = (PAGE_MASK(Pte) != 0);
|
||||||
if (WasValid)
|
if (MarkPageUnmapped && WasValid)
|
||||||
{
|
{
|
||||||
MmMarkPageUnmapped(PTE_TO_PAGE(Pte));
|
MmMarkPageUnmapped(PTE_TO_PAGE(Pte));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: kmap.c,v 1.22 2002/11/05 20:41:17 hbirr Exp $
|
/* $Id: kmap.c,v 1.23 2003/06/19 15:48:39 gvg Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -43,7 +43,7 @@ ExUnmapPage(PVOID Addr)
|
||||||
|
|
||||||
DPRINT("ExUnmapPage(Addr %x)\n",Addr);
|
DPRINT("ExUnmapPage(Addr %x)\n",Addr);
|
||||||
|
|
||||||
MmDeleteVirtualMapping(NULL, (PVOID)Addr, FALSE, NULL, NULL);
|
MmDeleteVirtualMapping(NULL, (PVOID)Addr, FALSE, NULL, NULL, TRUE);
|
||||||
KeAcquireSpinLock(&AllocMapLock, &oldIrql);
|
KeAcquireSpinLock(&AllocMapLock, &oldIrql);
|
||||||
RtlClearBits(&AllocMap, Base, 1);
|
RtlClearBits(&AllocMap, Base, 1);
|
||||||
AllocMapHint = min(AllocMapHint, Base);
|
AllocMapHint = min(AllocMapHint, Base);
|
||||||
|
@ -148,7 +148,8 @@ MiFreeNonPagedPoolRegion(PVOID Addr, ULONG Count, BOOLEAN Free)
|
||||||
Addr + (i * PAGE_SIZE),
|
Addr + (i * PAGE_SIZE),
|
||||||
Free,
|
Free,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL,
|
||||||
|
TRUE);
|
||||||
}
|
}
|
||||||
KeAcquireSpinLock(&AllocMapLock, &oldlvl);
|
KeAcquireSpinLock(&AllocMapLock, &oldlvl);
|
||||||
RtlClearBits(&AllocMap, Base, Count);
|
RtlClearBits(&AllocMap, Base, Count);
|
||||||
|
|
|
@ -396,7 +396,8 @@ MmFreeMemoryArea(PMADDRESS_SPACE AddressSpace,
|
||||||
{
|
{
|
||||||
MmDeleteVirtualMapping(AddressSpace->Process,
|
MmDeleteVirtualMapping(AddressSpace->Process,
|
||||||
MemoryArea->BaseAddress + (i*PAGE_SIZE),
|
MemoryArea->BaseAddress + (i*PAGE_SIZE),
|
||||||
FALSE, &Dirty, &PhysAddr);
|
FALSE, &Dirty, &PhysAddr,
|
||||||
|
MemoryArea->Type != MEMORY_AREA_IO_MAPPING);
|
||||||
}
|
}
|
||||||
if (FreePage != NULL)
|
if (FreePage != NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: mdl.c,v 1.48 2003/05/17 15:28:58 ekohl Exp $
|
/* $Id: mdl.c,v 1.49 2003/06/19 15:48:39 gvg Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -232,7 +232,8 @@ MmUnmapLockedPages(PVOID BaseAddress, PMDL Mdl)
|
||||||
BaseAddress + (i * PAGE_SIZE),
|
BaseAddress + (i * PAGE_SIZE),
|
||||||
FALSE,
|
FALSE,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL,
|
||||||
|
TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
KeAcquireSpinLock(&MiMdlMappingRegionLock, &oldIrql);
|
KeAcquireSpinLock(&MiMdlMappingRegionLock, &oldIrql);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: mminit.c,v 1.47 2003/06/14 17:46:24 hbirr Exp $
|
/* $Id: mminit.c,v 1.48 2003/06/19 15:48:39 gvg Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top directory
|
* COPYRIGHT: See COPYING in the top directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -344,14 +344,14 @@ VOID MmInit1(ULONG FirstKrnlPhysAddr,
|
||||||
i<(KERNEL_BASE + 2 * PAGE_TABLE_SIZE);
|
i<(KERNEL_BASE + 2 * PAGE_TABLE_SIZE);
|
||||||
i=i+PAGE_SIZE)
|
i=i+PAGE_SIZE)
|
||||||
{
|
{
|
||||||
MmDeleteVirtualMapping(NULL, (PVOID)(i), FALSE, NULL, NULL);
|
MmDeleteVirtualMapping(NULL, (PVOID)(i), FALSE, NULL, NULL, TRUE);
|
||||||
}
|
}
|
||||||
DPRINT("Almost done MmInit()\n");
|
DPRINT("Almost done MmInit()\n");
|
||||||
#ifndef MP
|
#ifndef MP
|
||||||
/* FIXME: This is broken in SMP mode */
|
/* FIXME: This is broken in SMP mode */
|
||||||
MmDeleteVirtualMapping(NULL, (PVOID)&unmap_me, FALSE, NULL, NULL);
|
MmDeleteVirtualMapping(NULL, (PVOID)&unmap_me, FALSE, NULL, NULL, TRUE);
|
||||||
MmDeleteVirtualMapping(NULL, (PVOID)&unmap_me2, FALSE, NULL, NULL);
|
MmDeleteVirtualMapping(NULL, (PVOID)&unmap_me2, FALSE, NULL, NULL, TRUE);
|
||||||
MmDeleteVirtualMapping(NULL, (PVOID)&unmap_me3, FALSE, NULL, NULL);
|
MmDeleteVirtualMapping(NULL, (PVOID)&unmap_me3, FALSE, NULL, NULL, TRUE);
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* Intialize memory areas
|
* Intialize memory areas
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: section.c,v 1.116 2003/06/07 12:23:14 chorns Exp $
|
/* $Id: section.c,v 1.117 2003/06/19 15:48:39 gvg Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/mm/section.c
|
* FILE: ntoskrnl/mm/section.c
|
||||||
|
@ -1216,7 +1216,7 @@ MmAccessFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
||||||
/*
|
/*
|
||||||
* Delete the old entry.
|
* Delete the old entry.
|
||||||
*/
|
*/
|
||||||
MmDeleteVirtualMapping(AddressSpace->Process, Address, FALSE, NULL, NULL);
|
MmDeleteVirtualMapping(AddressSpace->Process, Address, FALSE, NULL, NULL, TRUE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set the PTE to point to the new page
|
* Set the PTE to point to the new page
|
||||||
|
@ -1263,7 +1263,8 @@ MmPageOutDeleteMapping(PVOID Context, PEPROCESS Process, PVOID Address)
|
||||||
Address,
|
Address,
|
||||||
FALSE,
|
FALSE,
|
||||||
&WasDirty,
|
&WasDirty,
|
||||||
&Page);
|
&Page,
|
||||||
|
TRUE);
|
||||||
if (WasDirty)
|
if (WasDirty)
|
||||||
{
|
{
|
||||||
PageOutContext->WasDirty = TRUE;
|
PageOutContext->WasDirty = TRUE;
|
||||||
|
|
Loading…
Reference in a new issue