2001-12-31 01:53:46 +00:00
|
|
|
/*
|
|
|
|
* ReactOS kernel
|
|
|
|
* Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
2002-11-09 20:27:03 +00:00
|
|
|
/* $Id: rmap.c,v 1.14 2002/11/09 20:27:03 hbirr Exp $
|
2001-12-31 01:53:46 +00:00
|
|
|
*
|
|
|
|
* COPYRIGHT: See COPYING in the top directory
|
|
|
|
* PROJECT: ReactOS kernel
|
|
|
|
* FILE: ntoskrnl/mm/rmap.c
|
|
|
|
* PURPOSE: kernel memory managment functions
|
|
|
|
* PROGRAMMER: David Welch (welch@cwcom.net)
|
|
|
|
* UPDATE HISTORY:
|
|
|
|
* Created 27/12/01
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES *****************************************************************/
|
|
|
|
|
2002-09-08 10:23:54 +00:00
|
|
|
#include <ddk/ntddk.h>
|
|
|
|
#include <internal/mm.h>
|
|
|
|
#include <internal/ps.h>
|
2001-12-31 01:53:46 +00:00
|
|
|
|
|
|
|
#define NDEBUG
|
|
|
|
#include <internal/debug.h>
|
|
|
|
|
|
|
|
/* TYPES ********************************************************************/
|
|
|
|
|
|
|
|
typedef struct _MM_RMAP_ENTRY
|
|
|
|
{
|
|
|
|
struct _MM_RMAP_ENTRY* Next;
|
|
|
|
PEPROCESS Process;
|
|
|
|
PVOID Address;
|
|
|
|
} MM_RMAP_ENTRY, *PMM_RMAP_ENTRY;
|
|
|
|
|
2002-11-05 20:48:08 +00:00
|
|
|
#define TAG_RMAP TAG('R', 'M', 'A', 'P')
|
|
|
|
|
2001-12-31 01:53:46 +00:00
|
|
|
/* GLOBALS ******************************************************************/
|
|
|
|
|
2002-05-14 21:19:21 +00:00
|
|
|
static FAST_MUTEX RmapListLock;
|
2001-12-31 01:53:46 +00:00
|
|
|
|
|
|
|
/* FUNCTIONS ****************************************************************/
|
|
|
|
|
|
|
|
VOID
|
|
|
|
MmInitializeRmapList(VOID)
|
|
|
|
{
|
2002-05-14 21:19:21 +00:00
|
|
|
ExInitializeFastMutex(&RmapListLock);
|
2001-12-31 01:53:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NTSTATUS
|
2002-08-14 20:58:39 +00:00
|
|
|
MmWritePagePhysicalAddress(PHYSICAL_ADDRESS PhysicalAddress)
|
2001-12-31 01:53:46 +00:00
|
|
|
{
|
|
|
|
PMM_RMAP_ENTRY entry;
|
|
|
|
PMEMORY_AREA MemoryArea;
|
|
|
|
ULONG Type;
|
|
|
|
PVOID Address;
|
|
|
|
PEPROCESS Process;
|
|
|
|
PMM_PAGEOP PageOp;
|
|
|
|
LARGE_INTEGER Offset;
|
|
|
|
NTSTATUS Status;
|
|
|
|
|
2002-08-17 14:14:20 +00:00
|
|
|
/*
|
|
|
|
* Check that the address still has a valid rmap; then reference the
|
|
|
|
* process so it isn't freed while we are working.
|
|
|
|
*/
|
2002-05-14 21:19:21 +00:00
|
|
|
ExAcquireFastMutex(&RmapListLock);
|
2001-12-31 01:53:46 +00:00
|
|
|
entry = MmGetRmapListHeadPage(PhysicalAddress);
|
|
|
|
if (entry == NULL)
|
|
|
|
{
|
2002-05-14 21:19:21 +00:00
|
|
|
ExReleaseFastMutex(&RmapListLock);
|
2001-12-31 01:53:46 +00:00
|
|
|
return(STATUS_UNSUCCESSFUL);
|
|
|
|
}
|
|
|
|
Process = entry->Process;
|
|
|
|
Address = entry->Address;
|
|
|
|
if ((((ULONG)Address) & 0xFFF) != 0)
|
|
|
|
{
|
|
|
|
KeBugCheck(0);
|
|
|
|
}
|
2002-08-27 06:36:32 +00:00
|
|
|
Status = ObReferenceObjectByPointer(Process, PROCESS_ALL_ACCESS, NULL, KernelMode);
|
2002-08-14 20:58:39 +00:00
|
|
|
ExReleaseFastMutex(&RmapListLock);
|
2002-08-27 06:36:32 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
return Status;
|
|
|
|
}
|
2002-08-17 14:14:20 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Lock the address space; then check that the address we are using
|
|
|
|
* still corresponds to a valid memory area (the page might have been
|
|
|
|
* freed or paged out after we read the rmap entry.)
|
|
|
|
*/
|
2001-12-31 01:53:46 +00:00
|
|
|
MmLockAddressSpace(&Process->AddressSpace);
|
|
|
|
MemoryArea = MmOpenMemoryAreaByAddress(&Process->AddressSpace, Address);
|
2002-08-17 14:14:20 +00:00
|
|
|
if (MemoryArea == NULL)
|
|
|
|
{
|
2002-11-09 20:27:03 +00:00
|
|
|
MmUnlockAddressSpace(&Process->AddressSpace);
|
2002-08-17 14:14:20 +00:00
|
|
|
ObDereferenceObject(Process);
|
|
|
|
return(STATUS_UNSUCCESSFUL);
|
|
|
|
}
|
|
|
|
|
2001-12-31 01:53:46 +00:00
|
|
|
Type = MemoryArea->Type;
|
2002-08-10 16:41:20 +00:00
|
|
|
if (Type == MEMORY_AREA_SECTION_VIEW)
|
2001-12-31 01:53:46 +00:00
|
|
|
{
|
|
|
|
Offset.QuadPart = (ULONG)((Address - (ULONG)MemoryArea->BaseAddress) +
|
|
|
|
MemoryArea->Data.SectionData.ViewOffset);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get or create a pageop
|
|
|
|
*/
|
2002-05-14 21:19:21 +00:00
|
|
|
PageOp = MmGetPageOp(MemoryArea, 0, 0,
|
|
|
|
MemoryArea->Data.SectionData.Segment,
|
2001-12-31 01:53:46 +00:00
|
|
|
Offset.u.LowPart, MM_PAGEOP_PAGEOUT);
|
|
|
|
if (PageOp == NULL)
|
|
|
|
{
|
|
|
|
DPRINT1("MmGetPageOp failed\n");
|
|
|
|
KeBugCheck(0);
|
|
|
|
}
|
|
|
|
|
2002-08-17 14:14:20 +00:00
|
|
|
|
2001-12-31 01:53:46 +00:00
|
|
|
if (PageOp->Thread != PsGetCurrentThread())
|
|
|
|
{
|
|
|
|
MmReleasePageOp(PageOp);
|
|
|
|
MmUnlockAddressSpace(&Process->AddressSpace);
|
2002-08-27 06:36:32 +00:00
|
|
|
ObDereferenceObject(Process);
|
2001-12-31 01:53:46 +00:00
|
|
|
return(STATUS_UNSUCCESSFUL);
|
|
|
|
}
|
2002-05-14 21:19:21 +00:00
|
|
|
|
2002-08-14 20:58:39 +00:00
|
|
|
/*
|
|
|
|
* Release locks now we have a page op.
|
|
|
|
*/
|
|
|
|
MmUnlockAddressSpace(&Process->AddressSpace);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Do the actual page out work.
|
|
|
|
*/
|
|
|
|
Status = MmWritePageSectionView(&Process->AddressSpace, MemoryArea,
|
|
|
|
Address, PageOp);
|
|
|
|
}
|
|
|
|
else if (Type == MEMORY_AREA_VIRTUAL_MEMORY)
|
|
|
|
{
|
|
|
|
PageOp = MmGetPageOp(MemoryArea, Process->UniqueProcessId,
|
|
|
|
Address, NULL, 0, MM_PAGEOP_PAGEOUT);
|
2002-08-17 14:14:20 +00:00
|
|
|
|
|
|
|
|
2002-08-14 20:58:39 +00:00
|
|
|
if (PageOp->Thread != PsGetCurrentThread())
|
|
|
|
{
|
|
|
|
MmReleasePageOp(PageOp);
|
|
|
|
MmUnlockAddressSpace(&Process->AddressSpace);
|
2002-08-27 06:36:32 +00:00
|
|
|
ObDereferenceObject(Process);
|
2002-08-14 20:58:39 +00:00
|
|
|
return(STATUS_UNSUCCESSFUL);
|
|
|
|
}
|
|
|
|
|
2001-12-31 01:53:46 +00:00
|
|
|
/*
|
|
|
|
* Release locks now we have a page op.
|
|
|
|
*/
|
|
|
|
MmUnlockAddressSpace(&Process->AddressSpace);
|
2002-08-14 20:58:39 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Do the actual page out work.
|
|
|
|
*/
|
|
|
|
Status = MmWritePageVirtualMemory(&Process->AddressSpace, MemoryArea,
|
|
|
|
Address, PageOp);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
KeBugCheck(0);
|
2002-08-17 14:14:20 +00:00
|
|
|
}
|
2002-08-27 06:36:32 +00:00
|
|
|
ObDereferenceObject(Process);
|
2002-08-14 20:58:39 +00:00
|
|
|
return(Status);
|
|
|
|
}
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
MmPageOutPhysicalAddress(PHYSICAL_ADDRESS PhysicalAddress)
|
|
|
|
{
|
|
|
|
PMM_RMAP_ENTRY entry;
|
|
|
|
PMEMORY_AREA MemoryArea;
|
|
|
|
ULONG Type;
|
|
|
|
PVOID Address;
|
|
|
|
PEPROCESS Process;
|
|
|
|
PMM_PAGEOP PageOp;
|
|
|
|
LARGE_INTEGER Offset;
|
|
|
|
NTSTATUS Status;
|
|
|
|
|
|
|
|
ExAcquireFastMutex(&RmapListLock);
|
|
|
|
entry = MmGetRmapListHeadPage(PhysicalAddress);
|
|
|
|
if (entry == NULL)
|
|
|
|
{
|
2002-05-14 21:19:21 +00:00
|
|
|
ExReleaseFastMutex(&RmapListLock);
|
2002-08-14 20:58:39 +00:00
|
|
|
return(STATUS_UNSUCCESSFUL);
|
|
|
|
}
|
|
|
|
Process = entry->Process;
|
|
|
|
Address = entry->Address;
|
|
|
|
if ((((ULONG)Address) & 0xFFF) != 0)
|
|
|
|
{
|
|
|
|
KeBugCheck(0);
|
|
|
|
}
|
|
|
|
|
2002-08-27 06:36:32 +00:00
|
|
|
Status = ObReferenceObjectByPointer(Process, PROCESS_ALL_ACCESS, NULL, KernelMode);
|
2002-08-14 20:58:39 +00:00
|
|
|
ExReleaseFastMutex(&RmapListLock);
|
2002-08-27 06:36:32 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
return Status;
|
|
|
|
}
|
2002-08-14 20:58:39 +00:00
|
|
|
MmLockAddressSpace(&Process->AddressSpace);
|
|
|
|
MemoryArea = MmOpenMemoryAreaByAddress(&Process->AddressSpace, Address);
|
|
|
|
Type = MemoryArea->Type;
|
|
|
|
if (Type == MEMORY_AREA_SECTION_VIEW)
|
|
|
|
{
|
|
|
|
Offset.QuadPart = (ULONG)((Address - (ULONG)MemoryArea->BaseAddress) +
|
|
|
|
MemoryArea->Data.SectionData.ViewOffset);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get or create a pageop
|
|
|
|
*/
|
|
|
|
PageOp = MmGetPageOp(MemoryArea, 0, 0,
|
|
|
|
MemoryArea->Data.SectionData.Segment,
|
|
|
|
Offset.u.LowPart, MM_PAGEOP_PAGEOUT);
|
|
|
|
if (PageOp == NULL)
|
|
|
|
{
|
|
|
|
DPRINT1("MmGetPageOp failed\n");
|
|
|
|
KeBugCheck(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (PageOp->Thread != PsGetCurrentThread())
|
|
|
|
{
|
|
|
|
MmReleasePageOp(PageOp);
|
|
|
|
MmUnlockAddressSpace(&Process->AddressSpace);
|
2002-08-27 06:36:32 +00:00
|
|
|
ObDereferenceObject(Process);
|
2002-08-14 20:58:39 +00:00
|
|
|
return(STATUS_UNSUCCESSFUL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Release locks now we have a page op.
|
|
|
|
*/
|
|
|
|
MmUnlockAddressSpace(&Process->AddressSpace);
|
2001-12-31 01:53:46 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Do the actual page out work.
|
|
|
|
*/
|
2002-05-14 21:19:21 +00:00
|
|
|
Status = MmPageOutSectionView(&Process->AddressSpace, MemoryArea,
|
2002-01-08 00:49:02 +00:00
|
|
|
Address, PageOp);
|
2001-12-31 01:53:46 +00:00
|
|
|
}
|
|
|
|
else if (Type == MEMORY_AREA_VIRTUAL_MEMORY)
|
|
|
|
{
|
|
|
|
PageOp = MmGetPageOp(MemoryArea, Process->UniqueProcessId,
|
|
|
|
Address, NULL, 0, MM_PAGEOP_PAGEOUT);
|
|
|
|
if (PageOp->Thread != PsGetCurrentThread())
|
|
|
|
{
|
|
|
|
MmReleasePageOp(PageOp);
|
|
|
|
MmUnlockAddressSpace(&Process->AddressSpace);
|
2002-08-27 06:36:32 +00:00
|
|
|
ObDereferenceObject(Process);
|
2001-12-31 01:53:46 +00:00
|
|
|
return(STATUS_UNSUCCESSFUL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Release locks now we have a page op.
|
|
|
|
*/
|
|
|
|
MmUnlockAddressSpace(&Process->AddressSpace);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Do the actual page out work.
|
|
|
|
*/
|
2002-05-14 21:19:21 +00:00
|
|
|
Status = MmPageOutVirtualMemory(&Process->AddressSpace, MemoryArea,
|
2002-01-08 00:49:02 +00:00
|
|
|
Address, PageOp);
|
2001-12-31 01:53:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
KeBugCheck(0);
|
|
|
|
}
|
2002-08-27 06:36:32 +00:00
|
|
|
ObDereferenceObject(Process);
|
2001-12-31 01:53:46 +00:00
|
|
|
return(Status);
|
|
|
|
}
|
|
|
|
|
2002-08-14 20:58:39 +00:00
|
|
|
VOID
|
|
|
|
MmSetCleanAllRmaps(PHYSICAL_ADDRESS PhysicalAddress)
|
|
|
|
{
|
|
|
|
PMM_RMAP_ENTRY current_entry;
|
|
|
|
|
|
|
|
ExAcquireFastMutex(&RmapListLock);
|
|
|
|
current_entry = MmGetRmapListHeadPage(PhysicalAddress);
|
|
|
|
if (current_entry == NULL)
|
|
|
|
{
|
|
|
|
DPRINT1("MmIsDirtyRmap: No rmaps.\n");
|
|
|
|
KeBugCheck(0);
|
|
|
|
}
|
|
|
|
while (current_entry != NULL)
|
|
|
|
{
|
|
|
|
MmSetCleanPage(current_entry->Process, current_entry->Address);
|
|
|
|
current_entry = current_entry->Next;
|
|
|
|
}
|
|
|
|
ExReleaseFastMutex(&RmapListLock);
|
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
|
|
|
MmSetDirtyAllRmaps(PHYSICAL_ADDRESS PhysicalAddress)
|
|
|
|
{
|
|
|
|
PMM_RMAP_ENTRY current_entry;
|
|
|
|
|
|
|
|
ExAcquireFastMutex(&RmapListLock);
|
|
|
|
current_entry = MmGetRmapListHeadPage(PhysicalAddress);
|
|
|
|
if (current_entry == NULL)
|
|
|
|
{
|
|
|
|
DPRINT1("MmIsDirtyRmap: No rmaps.\n");
|
|
|
|
KeBugCheck(0);
|
|
|
|
}
|
|
|
|
while (current_entry != NULL)
|
|
|
|
{
|
|
|
|
MmSetDirtyPage(current_entry->Process, current_entry->Address);
|
|
|
|
current_entry = current_entry->Next;
|
|
|
|
}
|
|
|
|
ExReleaseFastMutex(&RmapListLock);
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL
|
|
|
|
MmIsDirtyPageRmap(PHYSICAL_ADDRESS PhysicalAddress)
|
|
|
|
{
|
|
|
|
PMM_RMAP_ENTRY current_entry;
|
|
|
|
|
|
|
|
ExAcquireFastMutex(&RmapListLock);
|
|
|
|
current_entry = MmGetRmapListHeadPage(PhysicalAddress);
|
|
|
|
if (current_entry == NULL)
|
|
|
|
{
|
|
|
|
ExReleaseFastMutex(&RmapListLock);
|
|
|
|
return(FALSE);
|
|
|
|
}
|
|
|
|
while (current_entry != NULL)
|
|
|
|
{
|
|
|
|
if (MmIsDirtyPage(current_entry->Process, current_entry->Address))
|
|
|
|
{
|
|
|
|
ExReleaseFastMutex(&RmapListLock);
|
|
|
|
return(TRUE);
|
|
|
|
}
|
|
|
|
current_entry = current_entry->Next;
|
|
|
|
}
|
|
|
|
ExReleaseFastMutex(&RmapListLock);
|
|
|
|
return(FALSE);
|
|
|
|
}
|
|
|
|
|
2002-05-13 18:10:41 +00:00
|
|
|
VOID
|
2002-06-04 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
* ntoskrnl/ke/i386/exp.c (KiDoubleFaultHandler): Print CR3
correctly.
2002-06-04 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
* ntoskrnl/include/internal/ps.h: Added KTHREAD_STACK_LIMIT definition.
* ntoskrnl/ke/i386/tskswitch.S (Ki386ContextSwitch): Force all the
pages of the kernel stack to be accessible from this process.
2002-06-04 David Welch <welch@cwcom.net>
* ntoskrnl/cc/view.c (ReadCacheSegmentChain): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/cc/copy.c (CcRosCreateCacheSegment): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/cc/copy.c (CcFreeCachePage): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/include/internal/mm.h: Changed prototypes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/include/internal/ps.h (KPROCESS): Changed type of
page directory base to PHYSICAL_ADDRESS.
* ntoskrnl/include/internal/i386/mm.h: Changed prototypes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/ke/kthread.c (KeFreeStackPage): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/ke/kthread.c (KeInitializeThread): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/ke/process.c (KeAttachProcess, KeDetachProcess): Changes
to use PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/ke/kernel.c (PcrPages, KeApplicationProcessorInit): Changes
to use PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/balance.c (MM_ALLOCATION_REQUEST): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/balance.c (MmReleasePageMemoryConsumer): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/balance.c (MmRequestPageMemoryConsumer): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/cont.c (MmFreeContinuousPage): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/cont.c (MmAllocateContinuousAlignedMemory): Changes to
use PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/freelist.c (MmTransferOwnershipPage,
MmGetLRUFirstUserPage, MmGetLRUNextUserPage, MmGetContinuousPages,
MmInitializePageList, MmSetFlagsPage, MmSetRmapListHeadPage,
MmGetRmapListHeadPage, MmMarkPageMapped, MmMarkPageUnmapped,
MmGetFlagsPage, MmSetSavedSwapEntryPage, MmGetSavedSwapEntryPage,
MmReferencePage, MmGetReferenceCountPage, MmIsUsablePage,
MmDereferencePage, MmGetLockCountPage, MmLockPage, MmUnlockPage,
MmAllocPage): Changes to use PHYSICAL_ADDRESS type for physical
addresses.
* ntoskrnl/mm/iospace.c (MmMapIoSpace): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/kmap.c (ExAllocatePage, MiZeroPage, MiCopyFromUserPage,
ExAllocatePageWithPhysPage): Changes to use PHYSICAL_ADDRESS type for
physical addresses.
* ntoskrnl/mm/marea.c (MmFreeMemoryArea): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/mdl.c (MmUnlockPages, MmMapLockedPages,
MmProbeAndLockPages): Changes to use PHYSICAL_ADDRESS type for
physical addresses.
* ntoskrnl/mm/mm.c (MmSharedDataPagePhysicalAddress,
MmCommitPagedPoolAddress, MmNotPresentFault): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/mminit.c (MmInitVirtualMemory): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/ncache.c (MmAllocateNonCachedMemory,
MmFreeNonCachedPage): Changes to use PHYSICAL_ADDRESS type for
physical addresses.
* ntoskrnl/mm/npool.c (grow_kernel_pool): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/rmap.c (MmPageOutPhysicalAddress, MmInsertRmap,
MmDeleteAllRmaps, MmDeleteRmap): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/section.c (MiReadPage, MmNotPresentFaultSectionView,
MmAccessFaultSectionView, MmPageOutDeleteMapping,
MmPageOutSectionView, MmFreeSectionPage): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/slab.c (ExGrowSlabCache): Changes to use
PHYSICAL_ADDRESS type for physical address.
* ntoskrnl/mm/virtual.c (MmPageOutVirtualMemory,
MmNotPresentFaultVirtualMemory, MmFreeVirtualMemoryPage): Changes to
use PHYSICAL_ADDRESS type for physical address.
* ntoskrnl/mm/wset.c (MmTrimUserMemory): Changes to use
PHYSICAL_ADDRESS type for physical address.
* ntoskrnl/mm/page.c (Mmi386ReleaseMmInfo, MmCopyMmInfo,
MmGetPhysicalAddressForProcess, MmCreateVirtualMapping,
MmCreateVirtualMappingUnsafe, MmCreateVirtualMappingForProcess,
MmDeleteVirtualMapping): Changes to use PHYSICAL_ADDRESS type for
physical address.
* ntoskrnl/ps/process (PsInitProcessManagment): Changes to use
PHYSICAL_ADDRESS type for physical address.
* ntoskrnl/ps/thread.c (PsAllocateCallbackStack): Changes to use
PHYSICAL_ADDRESS type for physical address.
2002-06-04 David Welch <welch@cwcom.net>
* Lots of change since the ChangeLog was last updated.
svn path=/trunk/; revision=3000
2002-06-04 15:26:58 +00:00
|
|
|
MmInsertRmap(PHYSICAL_ADDRESS PhysicalAddress, PEPROCESS Process,
|
|
|
|
PVOID Address)
|
2002-05-13 18:10:41 +00:00
|
|
|
{
|
2002-05-14 21:19:21 +00:00
|
|
|
PMM_RMAP_ENTRY current_entry;
|
|
|
|
PMM_RMAP_ENTRY new_entry;
|
2002-05-13 18:10:41 +00:00
|
|
|
|
2002-05-14 21:19:21 +00:00
|
|
|
Address = (PVOID)PAGE_ROUND_DOWN(Address);
|
2002-05-13 18:10:41 +00:00
|
|
|
|
2002-11-05 20:48:08 +00:00
|
|
|
new_entry = ExAllocatePoolWithTag(NonPagedPool, sizeof(MM_RMAP_ENTRY), TAG_RMAP);
|
2002-05-14 21:19:21 +00:00
|
|
|
if (new_entry == NULL)
|
2001-12-31 01:53:46 +00:00
|
|
|
{
|
2002-05-14 21:19:21 +00:00
|
|
|
KeBugCheck(0);
|
2002-05-13 18:10:41 +00:00
|
|
|
}
|
2002-05-14 21:19:21 +00:00
|
|
|
new_entry->Address = Address;
|
|
|
|
new_entry->Process = Process;
|
2002-05-13 18:10:41 +00:00
|
|
|
|
2002-06-04 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
* ntoskrnl/ke/i386/exp.c (KiDoubleFaultHandler): Print CR3
correctly.
2002-06-04 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
* ntoskrnl/include/internal/ps.h: Added KTHREAD_STACK_LIMIT definition.
* ntoskrnl/ke/i386/tskswitch.S (Ki386ContextSwitch): Force all the
pages of the kernel stack to be accessible from this process.
2002-06-04 David Welch <welch@cwcom.net>
* ntoskrnl/cc/view.c (ReadCacheSegmentChain): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/cc/copy.c (CcRosCreateCacheSegment): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/cc/copy.c (CcFreeCachePage): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/include/internal/mm.h: Changed prototypes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/include/internal/ps.h (KPROCESS): Changed type of
page directory base to PHYSICAL_ADDRESS.
* ntoskrnl/include/internal/i386/mm.h: Changed prototypes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/ke/kthread.c (KeFreeStackPage): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/ke/kthread.c (KeInitializeThread): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/ke/process.c (KeAttachProcess, KeDetachProcess): Changes
to use PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/ke/kernel.c (PcrPages, KeApplicationProcessorInit): Changes
to use PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/balance.c (MM_ALLOCATION_REQUEST): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/balance.c (MmReleasePageMemoryConsumer): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/balance.c (MmRequestPageMemoryConsumer): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/cont.c (MmFreeContinuousPage): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/cont.c (MmAllocateContinuousAlignedMemory): Changes to
use PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/freelist.c (MmTransferOwnershipPage,
MmGetLRUFirstUserPage, MmGetLRUNextUserPage, MmGetContinuousPages,
MmInitializePageList, MmSetFlagsPage, MmSetRmapListHeadPage,
MmGetRmapListHeadPage, MmMarkPageMapped, MmMarkPageUnmapped,
MmGetFlagsPage, MmSetSavedSwapEntryPage, MmGetSavedSwapEntryPage,
MmReferencePage, MmGetReferenceCountPage, MmIsUsablePage,
MmDereferencePage, MmGetLockCountPage, MmLockPage, MmUnlockPage,
MmAllocPage): Changes to use PHYSICAL_ADDRESS type for physical
addresses.
* ntoskrnl/mm/iospace.c (MmMapIoSpace): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/kmap.c (ExAllocatePage, MiZeroPage, MiCopyFromUserPage,
ExAllocatePageWithPhysPage): Changes to use PHYSICAL_ADDRESS type for
physical addresses.
* ntoskrnl/mm/marea.c (MmFreeMemoryArea): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/mdl.c (MmUnlockPages, MmMapLockedPages,
MmProbeAndLockPages): Changes to use PHYSICAL_ADDRESS type for
physical addresses.
* ntoskrnl/mm/mm.c (MmSharedDataPagePhysicalAddress,
MmCommitPagedPoolAddress, MmNotPresentFault): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/mminit.c (MmInitVirtualMemory): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/ncache.c (MmAllocateNonCachedMemory,
MmFreeNonCachedPage): Changes to use PHYSICAL_ADDRESS type for
physical addresses.
* ntoskrnl/mm/npool.c (grow_kernel_pool): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/rmap.c (MmPageOutPhysicalAddress, MmInsertRmap,
MmDeleteAllRmaps, MmDeleteRmap): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/section.c (MiReadPage, MmNotPresentFaultSectionView,
MmAccessFaultSectionView, MmPageOutDeleteMapping,
MmPageOutSectionView, MmFreeSectionPage): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/slab.c (ExGrowSlabCache): Changes to use
PHYSICAL_ADDRESS type for physical address.
* ntoskrnl/mm/virtual.c (MmPageOutVirtualMemory,
MmNotPresentFaultVirtualMemory, MmFreeVirtualMemoryPage): Changes to
use PHYSICAL_ADDRESS type for physical address.
* ntoskrnl/mm/wset.c (MmTrimUserMemory): Changes to use
PHYSICAL_ADDRESS type for physical address.
* ntoskrnl/mm/page.c (Mmi386ReleaseMmInfo, MmCopyMmInfo,
MmGetPhysicalAddressForProcess, MmCreateVirtualMapping,
MmCreateVirtualMappingUnsafe, MmCreateVirtualMappingForProcess,
MmDeleteVirtualMapping): Changes to use PHYSICAL_ADDRESS type for
physical address.
* ntoskrnl/ps/process (PsInitProcessManagment): Changes to use
PHYSICAL_ADDRESS type for physical address.
* ntoskrnl/ps/thread.c (PsAllocateCallbackStack): Changes to use
PHYSICAL_ADDRESS type for physical address.
2002-06-04 David Welch <welch@cwcom.net>
* Lots of change since the ChangeLog was last updated.
svn path=/trunk/; revision=3000
2002-06-04 15:26:58 +00:00
|
|
|
if (MmGetPhysicalAddressForProcess(Process, Address).QuadPart !=
|
|
|
|
PhysicalAddress.QuadPart)
|
2002-05-13 18:10:41 +00:00
|
|
|
{
|
2002-05-14 21:19:21 +00:00
|
|
|
DPRINT1("Insert rmap (%d, 0x%.8X) 0x%.8X which doesn't match physical "
|
|
|
|
"address 0x%.8X\n", Process->UniqueProcessId, Address,
|
|
|
|
MmGetPhysicalAddressForProcess(Process, Address),
|
2002-01-08 00:49:02 +00:00
|
|
|
PhysicalAddress)
|
2001-12-31 01:53:46 +00:00
|
|
|
KeBugCheck(0);
|
|
|
|
}
|
|
|
|
|
2002-05-14 21:19:21 +00:00
|
|
|
ExAcquireFastMutex(&RmapListLock);
|
|
|
|
current_entry = MmGetRmapListHeadPage(PhysicalAddress);
|
|
|
|
new_entry->Next = current_entry;
|
|
|
|
MmSetRmapListHeadPage(PhysicalAddress, new_entry);
|
|
|
|
ExReleaseFastMutex(&RmapListLock);
|
2001-12-31 01:53:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
2002-06-04 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
* ntoskrnl/ke/i386/exp.c (KiDoubleFaultHandler): Print CR3
correctly.
2002-06-04 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
* ntoskrnl/include/internal/ps.h: Added KTHREAD_STACK_LIMIT definition.
* ntoskrnl/ke/i386/tskswitch.S (Ki386ContextSwitch): Force all the
pages of the kernel stack to be accessible from this process.
2002-06-04 David Welch <welch@cwcom.net>
* ntoskrnl/cc/view.c (ReadCacheSegmentChain): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/cc/copy.c (CcRosCreateCacheSegment): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/cc/copy.c (CcFreeCachePage): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/include/internal/mm.h: Changed prototypes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/include/internal/ps.h (KPROCESS): Changed type of
page directory base to PHYSICAL_ADDRESS.
* ntoskrnl/include/internal/i386/mm.h: Changed prototypes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/ke/kthread.c (KeFreeStackPage): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/ke/kthread.c (KeInitializeThread): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/ke/process.c (KeAttachProcess, KeDetachProcess): Changes
to use PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/ke/kernel.c (PcrPages, KeApplicationProcessorInit): Changes
to use PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/balance.c (MM_ALLOCATION_REQUEST): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/balance.c (MmReleasePageMemoryConsumer): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/balance.c (MmRequestPageMemoryConsumer): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/cont.c (MmFreeContinuousPage): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/cont.c (MmAllocateContinuousAlignedMemory): Changes to
use PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/freelist.c (MmTransferOwnershipPage,
MmGetLRUFirstUserPage, MmGetLRUNextUserPage, MmGetContinuousPages,
MmInitializePageList, MmSetFlagsPage, MmSetRmapListHeadPage,
MmGetRmapListHeadPage, MmMarkPageMapped, MmMarkPageUnmapped,
MmGetFlagsPage, MmSetSavedSwapEntryPage, MmGetSavedSwapEntryPage,
MmReferencePage, MmGetReferenceCountPage, MmIsUsablePage,
MmDereferencePage, MmGetLockCountPage, MmLockPage, MmUnlockPage,
MmAllocPage): Changes to use PHYSICAL_ADDRESS type for physical
addresses.
* ntoskrnl/mm/iospace.c (MmMapIoSpace): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/kmap.c (ExAllocatePage, MiZeroPage, MiCopyFromUserPage,
ExAllocatePageWithPhysPage): Changes to use PHYSICAL_ADDRESS type for
physical addresses.
* ntoskrnl/mm/marea.c (MmFreeMemoryArea): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/mdl.c (MmUnlockPages, MmMapLockedPages,
MmProbeAndLockPages): Changes to use PHYSICAL_ADDRESS type for
physical addresses.
* ntoskrnl/mm/mm.c (MmSharedDataPagePhysicalAddress,
MmCommitPagedPoolAddress, MmNotPresentFault): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/mminit.c (MmInitVirtualMemory): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/ncache.c (MmAllocateNonCachedMemory,
MmFreeNonCachedPage): Changes to use PHYSICAL_ADDRESS type for
physical addresses.
* ntoskrnl/mm/npool.c (grow_kernel_pool): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/rmap.c (MmPageOutPhysicalAddress, MmInsertRmap,
MmDeleteAllRmaps, MmDeleteRmap): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/section.c (MiReadPage, MmNotPresentFaultSectionView,
MmAccessFaultSectionView, MmPageOutDeleteMapping,
MmPageOutSectionView, MmFreeSectionPage): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/slab.c (ExGrowSlabCache): Changes to use
PHYSICAL_ADDRESS type for physical address.
* ntoskrnl/mm/virtual.c (MmPageOutVirtualMemory,
MmNotPresentFaultVirtualMemory, MmFreeVirtualMemoryPage): Changes to
use PHYSICAL_ADDRESS type for physical address.
* ntoskrnl/mm/wset.c (MmTrimUserMemory): Changes to use
PHYSICAL_ADDRESS type for physical address.
* ntoskrnl/mm/page.c (Mmi386ReleaseMmInfo, MmCopyMmInfo,
MmGetPhysicalAddressForProcess, MmCreateVirtualMapping,
MmCreateVirtualMappingUnsafe, MmCreateVirtualMappingForProcess,
MmDeleteVirtualMapping): Changes to use PHYSICAL_ADDRESS type for
physical address.
* ntoskrnl/ps/process (PsInitProcessManagment): Changes to use
PHYSICAL_ADDRESS type for physical address.
* ntoskrnl/ps/thread.c (PsAllocateCallbackStack): Changes to use
PHYSICAL_ADDRESS type for physical address.
2002-06-04 David Welch <welch@cwcom.net>
* Lots of change since the ChangeLog was last updated.
svn path=/trunk/; revision=3000
2002-06-04 15:26:58 +00:00
|
|
|
MmDeleteAllRmaps(PHYSICAL_ADDRESS PhysicalAddress, PVOID Context,
|
2002-05-14 21:19:21 +00:00
|
|
|
VOID (*DeleteMapping)(PVOID Context, PEPROCESS Process,
|
2002-01-08 00:49:02 +00:00
|
|
|
PVOID Address))
|
2001-12-31 01:53:46 +00:00
|
|
|
{
|
|
|
|
PMM_RMAP_ENTRY current_entry;
|
|
|
|
PMM_RMAP_ENTRY previous_entry;
|
|
|
|
|
2002-05-14 21:19:21 +00:00
|
|
|
ExAcquireFastMutex(&RmapListLock);
|
2001-12-31 01:53:46 +00:00
|
|
|
current_entry = MmGetRmapListHeadPage(PhysicalAddress);
|
2002-01-08 00:49:02 +00:00
|
|
|
if (current_entry == NULL)
|
|
|
|
{
|
|
|
|
DPRINT1("MmDeleteAllRmaps: No rmaps.\n");
|
|
|
|
KeBugCheck(0);
|
|
|
|
}
|
2001-12-31 01:53:46 +00:00
|
|
|
while (current_entry != NULL)
|
|
|
|
{
|
|
|
|
previous_entry = current_entry;
|
|
|
|
current_entry = current_entry->Next;
|
|
|
|
if (DeleteMapping)
|
|
|
|
{
|
2002-05-14 21:19:21 +00:00
|
|
|
DeleteMapping(Context, previous_entry->Process,
|
2002-01-08 00:49:02 +00:00
|
|
|
previous_entry->Address);
|
2001-12-31 01:53:46 +00:00
|
|
|
}
|
|
|
|
ExFreePool(previous_entry);
|
|
|
|
}
|
|
|
|
MmSetRmapListHeadPage(PhysicalAddress, NULL);
|
2002-05-14 21:19:21 +00:00
|
|
|
ExReleaseFastMutex(&RmapListLock);
|
2001-12-31 01:53:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
2002-06-04 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
* ntoskrnl/ke/i386/exp.c (KiDoubleFaultHandler): Print CR3
correctly.
2002-06-04 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
* ntoskrnl/include/internal/ps.h: Added KTHREAD_STACK_LIMIT definition.
* ntoskrnl/ke/i386/tskswitch.S (Ki386ContextSwitch): Force all the
pages of the kernel stack to be accessible from this process.
2002-06-04 David Welch <welch@cwcom.net>
* ntoskrnl/cc/view.c (ReadCacheSegmentChain): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/cc/copy.c (CcRosCreateCacheSegment): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/cc/copy.c (CcFreeCachePage): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/include/internal/mm.h: Changed prototypes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/include/internal/ps.h (KPROCESS): Changed type of
page directory base to PHYSICAL_ADDRESS.
* ntoskrnl/include/internal/i386/mm.h: Changed prototypes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/ke/kthread.c (KeFreeStackPage): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/ke/kthread.c (KeInitializeThread): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/ke/process.c (KeAttachProcess, KeDetachProcess): Changes
to use PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/ke/kernel.c (PcrPages, KeApplicationProcessorInit): Changes
to use PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/balance.c (MM_ALLOCATION_REQUEST): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/balance.c (MmReleasePageMemoryConsumer): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/balance.c (MmRequestPageMemoryConsumer): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/cont.c (MmFreeContinuousPage): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/cont.c (MmAllocateContinuousAlignedMemory): Changes to
use PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/freelist.c (MmTransferOwnershipPage,
MmGetLRUFirstUserPage, MmGetLRUNextUserPage, MmGetContinuousPages,
MmInitializePageList, MmSetFlagsPage, MmSetRmapListHeadPage,
MmGetRmapListHeadPage, MmMarkPageMapped, MmMarkPageUnmapped,
MmGetFlagsPage, MmSetSavedSwapEntryPage, MmGetSavedSwapEntryPage,
MmReferencePage, MmGetReferenceCountPage, MmIsUsablePage,
MmDereferencePage, MmGetLockCountPage, MmLockPage, MmUnlockPage,
MmAllocPage): Changes to use PHYSICAL_ADDRESS type for physical
addresses.
* ntoskrnl/mm/iospace.c (MmMapIoSpace): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/kmap.c (ExAllocatePage, MiZeroPage, MiCopyFromUserPage,
ExAllocatePageWithPhysPage): Changes to use PHYSICAL_ADDRESS type for
physical addresses.
* ntoskrnl/mm/marea.c (MmFreeMemoryArea): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/mdl.c (MmUnlockPages, MmMapLockedPages,
MmProbeAndLockPages): Changes to use PHYSICAL_ADDRESS type for
physical addresses.
* ntoskrnl/mm/mm.c (MmSharedDataPagePhysicalAddress,
MmCommitPagedPoolAddress, MmNotPresentFault): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/mminit.c (MmInitVirtualMemory): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/ncache.c (MmAllocateNonCachedMemory,
MmFreeNonCachedPage): Changes to use PHYSICAL_ADDRESS type for
physical addresses.
* ntoskrnl/mm/npool.c (grow_kernel_pool): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/rmap.c (MmPageOutPhysicalAddress, MmInsertRmap,
MmDeleteAllRmaps, MmDeleteRmap): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/section.c (MiReadPage, MmNotPresentFaultSectionView,
MmAccessFaultSectionView, MmPageOutDeleteMapping,
MmPageOutSectionView, MmFreeSectionPage): Changes to use
PHYSICAL_ADDRESS type for physical addresses.
* ntoskrnl/mm/slab.c (ExGrowSlabCache): Changes to use
PHYSICAL_ADDRESS type for physical address.
* ntoskrnl/mm/virtual.c (MmPageOutVirtualMemory,
MmNotPresentFaultVirtualMemory, MmFreeVirtualMemoryPage): Changes to
use PHYSICAL_ADDRESS type for physical address.
* ntoskrnl/mm/wset.c (MmTrimUserMemory): Changes to use
PHYSICAL_ADDRESS type for physical address.
* ntoskrnl/mm/page.c (Mmi386ReleaseMmInfo, MmCopyMmInfo,
MmGetPhysicalAddressForProcess, MmCreateVirtualMapping,
MmCreateVirtualMappingUnsafe, MmCreateVirtualMappingForProcess,
MmDeleteVirtualMapping): Changes to use PHYSICAL_ADDRESS type for
physical address.
* ntoskrnl/ps/process (PsInitProcessManagment): Changes to use
PHYSICAL_ADDRESS type for physical address.
* ntoskrnl/ps/thread.c (PsAllocateCallbackStack): Changes to use
PHYSICAL_ADDRESS type for physical address.
2002-06-04 David Welch <welch@cwcom.net>
* Lots of change since the ChangeLog was last updated.
svn path=/trunk/; revision=3000
2002-06-04 15:26:58 +00:00
|
|
|
MmDeleteRmap(PHYSICAL_ADDRESS PhysicalAddress, PEPROCESS Process,
|
|
|
|
PVOID Address)
|
2001-12-31 01:53:46 +00:00
|
|
|
{
|
2002-05-14 21:19:21 +00:00
|
|
|
PMM_RMAP_ENTRY current_entry, previous_entry;
|
2001-12-31 01:53:46 +00:00
|
|
|
|
2002-05-14 21:19:21 +00:00
|
|
|
ExAcquireFastMutex(&RmapListLock);
|
|
|
|
previous_entry = NULL;
|
|
|
|
current_entry = MmGetRmapListHeadPage(PhysicalAddress);
|
|
|
|
while (current_entry != NULL)
|
2001-12-31 01:53:46 +00:00
|
|
|
{
|
2002-05-14 21:19:21 +00:00
|
|
|
if (current_entry->Process == Process &&
|
|
|
|
current_entry->Address == Address)
|
|
|
|
{
|
|
|
|
if (previous_entry == NULL)
|
|
|
|
{
|
|
|
|
MmSetRmapListHeadPage(PhysicalAddress, current_entry->Next);
|
|
|
|
ExReleaseFastMutex(&RmapListLock);
|
|
|
|
ExFreePool(current_entry);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
previous_entry->Next = current_entry->Next;
|
|
|
|
ExReleaseFastMutex(&RmapListLock);
|
|
|
|
ExFreePool(current_entry);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
previous_entry = current_entry;
|
|
|
|
current_entry = current_entry->Next;
|
2001-12-31 01:53:46 +00:00
|
|
|
}
|
2002-05-14 21:19:21 +00:00
|
|
|
KeBugCheck(0);
|
2001-12-31 01:53:46 +00:00
|
|
|
}
|