Don't mark pages as unmapped when releasing them via MmUnmapIoSpace

svn path=/trunk/; revision=4924
This commit is contained in:
Gé van Geldorp 2003-06-19 15:48:39 +00:00
parent c37620bed9
commit 96d9fbe944
9 changed files with 30 additions and 24 deletions

View file

@ -234,7 +234,8 @@ MmDeleteVirtualMapping(struct _EPROCESS* Process,
PVOID Address,
BOOL FreePage,
BOOL* WasDirty,
PHYSICAL_ADDRESS* PhysicalPage);
PHYSICAL_ADDRESS* PhysicalPage,
BOOL MarkPageUnmapped);
VOID MmUpdateStackPageDir(PULONG LocalPageDir, struct _KTHREAD* KThread);
#define MM_PAGE_CLEAN (0)

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* 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
* 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++)
{
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);
}
}

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* 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
* FILE: ntoskrnl/mm/anonmem.c
@ -165,7 +165,7 @@ MmPageOutVirtualMemory(PMADDRESS_SPACE AddressSpace,
*/
if (!WasDirty)
{
MmDeleteVirtualMapping(MemoryArea->Process, Address, FALSE, NULL, NULL);
MmDeleteVirtualMapping(MemoryArea->Process, Address, FALSE, NULL, NULL, TRUE);
MmDeleteAllRmaps(PhysicalAddress, NULL, NULL);
if ((SwapEntry = MmGetSavedSwapEntryPage(PhysicalAddress)) != 0)
{
@ -218,7 +218,7 @@ MmPageOutVirtualMemory(PMADDRESS_SPACE AddressSpace,
* Otherwise we have succeeded, free the page
*/
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);
MmDeleteAllRmaps(PhysicalAddress, NULL, NULL);
MmSetSavedSwapEntryPage(PhysicalAddress, 0);
@ -468,7 +468,7 @@ MmModifyAttributes(PMADDRESS_SPACE AddressSpace,
PhysicalAddr = MmGetPhysicalAddress(BaseAddress + (i*PAGE_SIZE));
MmDeleteVirtualMapping(AddressSpace->Process,
BaseAddress + (i*PAGE_SIZE),
FALSE, NULL, NULL);
FALSE, NULL, NULL, TRUE);
if (PhysicalAddr.QuadPart != 0)
{
SWAPENTRY SavedSwapEntry;

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* 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
* FILE: ntoskrnl/mm/i386/page.c
@ -444,7 +444,8 @@ MmDisableVirtualMapping(PEPROCESS Process, PVOID Address, BOOL* WasDirty, PHYSIC
VOID
MmDeleteVirtualMapping(PEPROCESS Process, PVOID Address, BOOL FreePage,
BOOL* WasDirty, PHYSICAL_ADDRESS* PhysicalAddr)
BOOL* WasDirty, PHYSICAL_ADDRESS* PhysicalAddr,
BOOL MarkPageUnmapped)
/*
* 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);
FLUSH_TLB;
WasValid = (PAGE_MASK(Pte) != 0);
if (WasValid)
if (MarkPageUnmapped && WasValid)
{
MmMarkPageUnmapped(PTE_TO_PAGE(Pte));
}

View file

@ -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
* PROJECT: ReactOS kernel
@ -43,7 +43,7 @@ ExUnmapPage(PVOID 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);
RtlClearBits(&AllocMap, Base, 1);
AllocMapHint = min(AllocMapHint, Base);
@ -148,7 +148,8 @@ MiFreeNonPagedPoolRegion(PVOID Addr, ULONG Count, BOOLEAN Free)
Addr + (i * PAGE_SIZE),
Free,
NULL,
NULL);
NULL,
TRUE);
}
KeAcquireSpinLock(&AllocMapLock, &oldlvl);
RtlClearBits(&AllocMap, Base, Count);

View file

@ -396,7 +396,8 @@ MmFreeMemoryArea(PMADDRESS_SPACE AddressSpace,
{
MmDeleteVirtualMapping(AddressSpace->Process,
MemoryArea->BaseAddress + (i*PAGE_SIZE),
FALSE, &Dirty, &PhysAddr);
FALSE, &Dirty, &PhysAddr,
MemoryArea->Type != MEMORY_AREA_IO_MAPPING);
}
if (FreePage != NULL)
{

View file

@ -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
* PROJECT: ReactOS kernel
@ -232,7 +232,8 @@ MmUnmapLockedPages(PVOID BaseAddress, PMDL Mdl)
BaseAddress + (i * PAGE_SIZE),
FALSE,
NULL,
NULL);
NULL,
TRUE);
}
KeAcquireSpinLock(&MiMdlMappingRegionLock, &oldIrql);

View file

@ -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
* PROJECT: ReactOS kernel
@ -344,14 +344,14 @@ VOID MmInit1(ULONG FirstKrnlPhysAddr,
i<(KERNEL_BASE + 2 * PAGE_TABLE_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");
#ifndef MP
/* FIXME: This is broken in SMP mode */
MmDeleteVirtualMapping(NULL, (PVOID)&unmap_me, FALSE, NULL, NULL);
MmDeleteVirtualMapping(NULL, (PVOID)&unmap_me2, FALSE, NULL, NULL);
MmDeleteVirtualMapping(NULL, (PVOID)&unmap_me3, FALSE, NULL, NULL);
MmDeleteVirtualMapping(NULL, (PVOID)&unmap_me, FALSE, NULL, NULL, TRUE);
MmDeleteVirtualMapping(NULL, (PVOID)&unmap_me2, FALSE, NULL, NULL, TRUE);
MmDeleteVirtualMapping(NULL, (PVOID)&unmap_me3, FALSE, NULL, NULL, TRUE);
#endif
/*
* Intialize memory areas

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* 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
* FILE: ntoskrnl/mm/section.c
@ -1216,7 +1216,7 @@ MmAccessFaultSectionView(PMADDRESS_SPACE AddressSpace,
/*
* 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
@ -1263,7 +1263,8 @@ MmPageOutDeleteMapping(PVOID Context, PEPROCESS Process, PVOID Address)
Address,
FALSE,
&WasDirty,
&Page);
&Page,
TRUE);
if (WasDirty)
{
PageOutContext->WasDirty = TRUE;