2001-03-13 16:25:55 +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-09-07 15:13:13 +00:00
|
|
|
/* $Id: mm.c,v 1.59 2002/09/07 15:12:59 chorns Exp $
|
2000-03-20 18:00:55 +00:00
|
|
|
*
|
1998-08-25 04:27:26 +00:00
|
|
|
* COPYRIGHT: See COPYING in the top directory
|
|
|
|
* PROJECT: ReactOS kernel
|
1998-09-05 17:34:23 +00:00
|
|
|
* FILE: ntoskrnl/mm/mm.c
|
1998-08-25 04:27:26 +00:00
|
|
|
* PURPOSE: kernel memory managment functions
|
1999-03-31 10:59:32 +00:00
|
|
|
* PROGRAMMER: David Welch (welch@cwcom.net)
|
1998-08-25 04:27:26 +00:00
|
|
|
* UPDATE HISTORY:
|
|
|
|
* Created 9/4/98
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES *****************************************************************/
|
|
|
|
|
2002-09-07 15:13:13 +00:00
|
|
|
#include <ntoskrnl.h>
|
1998-08-25 04:27:26 +00:00
|
|
|
|
|
|
|
#define NDEBUG
|
|
|
|
#include <internal/debug.h>
|
|
|
|
|
2002-09-07 15:13:13 +00:00
|
|
|
|
1998-08-25 04:27:26 +00:00
|
|
|
/* GLOBALS *****************************************************************/
|
|
|
|
|
2002-05-14 21:19:21 +00:00
|
|
|
MM_STATS MmStats;
|
2000-04-02 13:32:43 +00:00
|
|
|
|
1998-08-25 04:27:26 +00:00
|
|
|
/* FUNCTIONS ****************************************************************/
|
|
|
|
|
2000-07-04 08:52:47 +00:00
|
|
|
NTSTATUS MmReleaseMemoryArea(PEPROCESS Process, PMEMORY_AREA Marea)
|
1999-11-24 11:51:55 +00:00
|
|
|
{
|
2001-03-08 22:06:02 +00:00
|
|
|
NTSTATUS Status;
|
2000-07-04 08:52:47 +00:00
|
|
|
|
|
|
|
DPRINT("MmReleaseMemoryArea(Process %x, Marea %x)\n",Process,Marea);
|
|
|
|
|
2001-03-08 22:06:02 +00:00
|
|
|
DPRINT("Releasing %x between %x %x (type %d)\n",
|
|
|
|
Marea, Marea->BaseAddress, Marea->BaseAddress + Marea->Length,
|
|
|
|
Marea->Type);
|
2000-07-04 08:52:47 +00:00
|
|
|
|
2001-02-10 22:51:11 +00:00
|
|
|
switch (Marea->Type)
|
2000-07-04 08:52:47 +00:00
|
|
|
{
|
2002-08-10 16:41:20 +00:00
|
|
|
case MEMORY_AREA_SECTION_VIEW:
|
2001-03-08 22:06:02 +00:00
|
|
|
Status = MmUnmapViewOfSection(Process, Marea->BaseAddress);
|
|
|
|
assert(Status == STATUS_SUCCESS);
|
2001-02-10 22:51:11 +00:00
|
|
|
return(STATUS_SUCCESS);
|
|
|
|
|
2001-03-13 16:25:55 +00:00
|
|
|
case MEMORY_AREA_VIRTUAL_MEMORY:
|
|
|
|
MmFreeVirtualMemory(Process, Marea);
|
2001-03-08 22:06:02 +00:00
|
|
|
break;
|
2001-02-10 22:51:11 +00:00
|
|
|
|
|
|
|
case MEMORY_AREA_SHARED_DATA:
|
2001-03-08 22:06:02 +00:00
|
|
|
Status = MmFreeMemoryArea(&Process->AddressSpace,
|
|
|
|
Marea->BaseAddress,
|
|
|
|
0,
|
|
|
|
NULL,
|
|
|
|
NULL);
|
2001-02-10 22:51:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
KeBugCheck(0);
|
2000-07-04 08:52:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return(STATUS_SUCCESS);
|
1999-11-24 11:51:55 +00:00
|
|
|
}
|
|
|
|
|
2000-07-04 08:52:47 +00:00
|
|
|
NTSTATUS MmReleaseMmInfo(PEPROCESS Process)
|
1999-04-14 00:52:19 +00:00
|
|
|
{
|
2000-07-04 08:52:47 +00:00
|
|
|
PLIST_ENTRY CurrentEntry;
|
|
|
|
PMEMORY_AREA Current;
|
1999-04-14 00:52:19 +00:00
|
|
|
|
2001-03-08 22:06:02 +00:00
|
|
|
DPRINT("MmReleaseMmInfo(Process %x (%s))\n", Process,
|
|
|
|
Process->ImageFileName);
|
1999-04-14 00:52:19 +00:00
|
|
|
|
2000-07-04 08:52:47 +00:00
|
|
|
MmLockAddressSpace(&Process->AddressSpace);
|
2001-03-08 22:06:02 +00:00
|
|
|
|
|
|
|
CurrentEntry = Process->AddressSpace.MAreaListHead.Flink;
|
|
|
|
while (CurrentEntry != &Process->AddressSpace.MAreaListHead)
|
2000-07-04 08:52:47 +00:00
|
|
|
{
|
|
|
|
Current = CONTAINING_RECORD(CurrentEntry, MEMORY_AREA, Entry);
|
2001-03-08 22:06:02 +00:00
|
|
|
CurrentEntry = CurrentEntry->Flink;
|
2000-07-04 08:52:47 +00:00
|
|
|
|
|
|
|
MmReleaseMemoryArea(Process, Current);
|
|
|
|
}
|
1999-04-14 00:52:19 +00:00
|
|
|
|
2000-07-04 08:52:47 +00:00
|
|
|
Mmi386ReleaseMmInfo(Process);
|
1999-04-14 00:52:19 +00:00
|
|
|
|
2000-07-04 08:52:47 +00:00
|
|
|
MmUnlockAddressSpace(&Process->AddressSpace);
|
2001-03-07 16:48:45 +00:00
|
|
|
MmDestroyAddressSpace(&Process->AddressSpace);
|
1999-04-14 00:52:19 +00:00
|
|
|
|
2000-07-04 08:52:47 +00:00
|
|
|
DPRINT("Finished MmReleaseMmInfo()\n");
|
|
|
|
return(STATUS_SUCCESS);
|
|
|
|
}
|
2000-03-20 18:00:55 +00:00
|
|
|
|
2000-07-04 08:52:47 +00:00
|
|
|
BOOLEAN STDCALL MmIsNonPagedSystemAddressValid(PVOID VirtualAddress)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOLEAN STDCALL MmIsAddressValid(PVOID VirtualAddress)
|
|
|
|
/*
|
|
|
|
* FUNCTION: Checks whether the given address is valid for a read or write
|
|
|
|
* ARGUMENTS:
|
|
|
|
* VirtualAddress = address to check
|
|
|
|
* RETURNS: True if the access would be valid
|
|
|
|
* False if the access would cause a page fault
|
|
|
|
* NOTES: This function checks whether a byte access to the page would
|
|
|
|
* succeed. Is this realistic for RISC processors which don't
|
|
|
|
* allow byte granular access?
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
MEMORY_AREA* MemoryArea;
|
|
|
|
PMADDRESS_SPACE AddressSpace;
|
|
|
|
|
|
|
|
AddressSpace = &PsGetCurrentProcess()->AddressSpace;
|
|
|
|
|
|
|
|
MmLockAddressSpace(AddressSpace);
|
|
|
|
MemoryArea = MmOpenMemoryAreaByAddress(AddressSpace,
|
|
|
|
VirtualAddress);
|
2000-03-20 18:00:55 +00:00
|
|
|
|
2000-07-04 08:52:47 +00:00
|
|
|
if (MemoryArea == NULL)
|
|
|
|
{
|
|
|
|
MmUnlockAddressSpace(AddressSpace);
|
|
|
|
return(FALSE);
|
|
|
|
}
|
|
|
|
MmUnlockAddressSpace(AddressSpace);
|
|
|
|
return(TRUE);
|
1999-04-14 00:52:19 +00:00
|
|
|
}
|
|
|
|
|
2000-04-07 02:24:03 +00:00
|
|
|
NTSTATUS MmAccessFault(KPROCESSOR_MODE Mode,
|
2001-02-14 02:53:54 +00:00
|
|
|
ULONG Address,
|
|
|
|
BOOLEAN FromMdl)
|
2000-04-07 02:24:03 +00:00
|
|
|
{
|
2001-02-10 22:51:11 +00:00
|
|
|
PMADDRESS_SPACE AddressSpace;
|
|
|
|
MEMORY_AREA* MemoryArea;
|
|
|
|
NTSTATUS Status;
|
2001-02-14 02:53:54 +00:00
|
|
|
BOOLEAN Locked = FromMdl;
|
2001-02-10 22:51:11 +00:00
|
|
|
|
2001-02-14 02:53:54 +00:00
|
|
|
DPRINT("MmAccessFault(Mode %d, Address %x)\n", Mode, Address);
|
2001-02-10 22:51:11 +00:00
|
|
|
|
|
|
|
if (KeGetCurrentIrql() >= DISPATCH_LEVEL)
|
|
|
|
{
|
|
|
|
DbgPrint("Page fault at high IRQL was %d\n", KeGetCurrentIrql());
|
2002-09-07 15:13:13 +00:00
|
|
|
KeDumpStackFrames((PULONG)__builtin_frame_address(0));
|
2001-02-10 22:51:11 +00:00
|
|
|
return(STATUS_UNSUCCESSFUL);
|
|
|
|
}
|
|
|
|
if (PsGetCurrentProcess() == NULL)
|
|
|
|
{
|
|
|
|
DbgPrint("No current process\n");
|
|
|
|
return(STATUS_UNSUCCESSFUL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Find the memory area for the faulting address
|
|
|
|
*/
|
|
|
|
if (Address >= KERNEL_BASE)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Check permissions
|
|
|
|
*/
|
|
|
|
if (Mode != KernelMode)
|
|
|
|
{
|
|
|
|
DbgPrint("%s:%d\n",__FILE__,__LINE__);
|
|
|
|
return(STATUS_UNSUCCESSFUL);
|
|
|
|
}
|
|
|
|
AddressSpace = MmGetKernelAddressSpace();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
AddressSpace = &PsGetCurrentProcess()->AddressSpace;
|
|
|
|
}
|
|
|
|
|
2001-02-14 02:53:54 +00:00
|
|
|
if (!FromMdl)
|
|
|
|
{
|
|
|
|
MmLockAddressSpace(AddressSpace);
|
|
|
|
}
|
2001-02-10 22:51:11 +00:00
|
|
|
MemoryArea = MmOpenMemoryAreaByAddress(AddressSpace, (PVOID)Address);
|
|
|
|
if (MemoryArea == NULL)
|
|
|
|
{
|
|
|
|
DbgPrint("%s:%d\n",__FILE__,__LINE__);
|
2001-02-14 02:53:54 +00:00
|
|
|
if (!FromMdl)
|
|
|
|
{
|
|
|
|
MmUnlockAddressSpace(AddressSpace);
|
|
|
|
}
|
2001-02-10 22:51:11 +00:00
|
|
|
return(STATUS_UNSUCCESSFUL);
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (MemoryArea->Type)
|
|
|
|
{
|
|
|
|
case MEMORY_AREA_SYSTEM:
|
|
|
|
Status = STATUS_UNSUCCESSFUL;
|
|
|
|
break;
|
2001-12-20 03:56:10 +00:00
|
|
|
|
|
|
|
case MEMORY_AREA_PAGED_POOL:
|
|
|
|
Status = STATUS_SUCCESS;
|
|
|
|
break;
|
2001-02-10 22:51:11 +00:00
|
|
|
|
2002-08-10 16:41:20 +00:00
|
|
|
case MEMORY_AREA_SECTION_VIEW:
|
2001-02-10 22:51:11 +00:00
|
|
|
Status = MmAccessFaultSectionView(AddressSpace,
|
|
|
|
MemoryArea,
|
2001-02-14 02:53:54 +00:00
|
|
|
(PVOID)Address,
|
|
|
|
Locked);
|
2001-02-10 22:51:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MEMORY_AREA_VIRTUAL_MEMORY:
|
|
|
|
Status = STATUS_UNSUCCESSFUL;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MEMORY_AREA_SHARED_DATA:
|
|
|
|
Status = STATUS_UNSUCCESSFUL;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
Status = STATUS_UNSUCCESSFUL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
DPRINT("Completed page fault handling\n");
|
2001-02-14 02:53:54 +00:00
|
|
|
if (!FromMdl)
|
|
|
|
{
|
|
|
|
MmUnlockAddressSpace(AddressSpace);
|
|
|
|
}
|
2001-02-10 22:51:11 +00:00
|
|
|
return(Status);
|
2000-04-07 02:24:03 +00:00
|
|
|
}
|
|
|
|
|
2001-12-20 03:56:10 +00:00
|
|
|
NTSTATUS MmCommitPagedPoolAddress(PVOID Address)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
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
|
|
|
PHYSICAL_ADDRESS AllocatedPage;
|
2001-12-31 01:53:46 +00:00
|
|
|
Status = MmRequestPageMemoryConsumer(MC_PPOOL, FALSE, &AllocatedPage);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
|
|
|
Status = MmRequestPageMemoryConsumer(MC_PPOOL, TRUE, &AllocatedPage);
|
|
|
|
MmLockAddressSpace(MmGetKernelAddressSpace());
|
|
|
|
}
|
2001-12-20 03:56:10 +00:00
|
|
|
Status =
|
|
|
|
MmCreateVirtualMapping(NULL,
|
|
|
|
(PVOID)PAGE_ROUND_DOWN(Address),
|
2001-12-27 23:56:42 +00:00
|
|
|
PAGE_READWRITE,
|
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
|
|
|
AllocatedPage,
|
2002-01-01 00:21:57 +00:00
|
|
|
FALSE);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
|
|
|
Status =
|
|
|
|
MmCreateVirtualMapping(NULL,
|
|
|
|
(PVOID)PAGE_ROUND_DOWN(Address),
|
|
|
|
PAGE_READWRITE,
|
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
|
|
|
AllocatedPage,
|
2002-01-01 00:21:57 +00:00
|
|
|
FALSE);
|
|
|
|
MmLockAddressSpace(MmGetKernelAddressSpace());
|
|
|
|
}
|
2001-12-20 03:56:10 +00:00
|
|
|
return(Status);
|
|
|
|
}
|
|
|
|
|
2000-04-07 02:24:03 +00:00
|
|
|
NTSTATUS MmNotPresentFault(KPROCESSOR_MODE Mode,
|
2001-02-14 02:53:54 +00:00
|
|
|
ULONG Address,
|
|
|
|
BOOLEAN FromMdl)
|
1999-04-14 00:52:19 +00:00
|
|
|
{
|
2000-03-29 13:11:55 +00:00
|
|
|
PMADDRESS_SPACE AddressSpace;
|
1999-04-14 00:52:19 +00:00
|
|
|
MEMORY_AREA* MemoryArea;
|
1999-04-18 21:13:11 +00:00
|
|
|
NTSTATUS Status;
|
2001-02-14 02:53:54 +00:00
|
|
|
BOOLEAN Locked = FromMdl;
|
1999-04-14 00:52:19 +00:00
|
|
|
|
2000-05-24 22:29:38 +00:00
|
|
|
DPRINT("MmNotPresentFault(Mode %d, Address %x)\n", Mode, Address);
|
1999-11-02 08:55:45 +00:00
|
|
|
|
1999-05-29 00:15:17 +00:00
|
|
|
if (KeGetCurrentIrql() >= DISPATCH_LEVEL)
|
1999-04-14 00:52:19 +00:00
|
|
|
{
|
1999-05-29 00:15:17 +00:00
|
|
|
DbgPrint("Page fault at high IRQL was %d\n", KeGetCurrentIrql());
|
2000-04-07 02:24:03 +00:00
|
|
|
return(STATUS_UNSUCCESSFUL);
|
1999-04-14 00:52:19 +00:00
|
|
|
}
|
1999-12-12 00:59:39 +00:00
|
|
|
if (PsGetCurrentProcess() == NULL)
|
|
|
|
{
|
|
|
|
DbgPrint("No current process\n");
|
2000-04-07 02:24:03 +00:00
|
|
|
return(STATUS_UNSUCCESSFUL);
|
1999-12-12 00:59:39 +00:00
|
|
|
}
|
1999-04-14 00:52:19 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Find the memory area for the faulting address
|
|
|
|
*/
|
2000-04-07 02:24:03 +00:00
|
|
|
if (Address >= KERNEL_BASE)
|
1999-04-14 00:52:19 +00:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Check permissions
|
|
|
|
*/
|
2000-04-07 02:24:03 +00:00
|
|
|
if (Mode != KernelMode)
|
1999-04-14 00:52:19 +00:00
|
|
|
{
|
1999-10-14 16:54:17 +00:00
|
|
|
DbgPrint("%s:%d\n",__FILE__,__LINE__);
|
2000-04-07 02:24:03 +00:00
|
|
|
return(STATUS_UNSUCCESSFUL);
|
1999-04-14 00:52:19 +00:00
|
|
|
}
|
2000-03-29 13:11:55 +00:00
|
|
|
AddressSpace = MmGetKernelAddressSpace();
|
1999-04-14 00:52:19 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-07-04 08:52:47 +00:00
|
|
|
AddressSpace = &PsGetCurrentProcess()->AddressSpace;
|
1999-04-14 00:52:19 +00:00
|
|
|
}
|
|
|
|
|
2001-02-14 02:53:54 +00:00
|
|
|
if (!FromMdl)
|
|
|
|
{
|
|
|
|
MmLockAddressSpace(AddressSpace);
|
|
|
|
}
|
2001-04-04 22:21:32 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Call the memory area specific fault handler
|
|
|
|
*/
|
|
|
|
do
|
1999-04-14 00:52:19 +00:00
|
|
|
{
|
2001-04-04 22:21:32 +00:00
|
|
|
MemoryArea = MmOpenMemoryAreaByAddress(AddressSpace, (PVOID)Address);
|
|
|
|
if (MemoryArea == NULL)
|
|
|
|
{
|
|
|
|
if (!FromMdl)
|
|
|
|
{
|
|
|
|
MmUnlockAddressSpace(AddressSpace);
|
|
|
|
}
|
2001-04-09 02:45:04 +00:00
|
|
|
return (STATUS_UNSUCCESSFUL);
|
2001-04-04 22:21:32 +00:00
|
|
|
}
|
2001-04-09 02:45:04 +00:00
|
|
|
|
|
|
|
switch (MemoryArea->Type)
|
2001-04-04 22:21:32 +00:00
|
|
|
{
|
2001-12-20 03:56:10 +00:00
|
|
|
case MEMORY_AREA_PAGED_POOL:
|
|
|
|
{
|
|
|
|
Status = MmCommitPagedPoolAddress((PVOID)Address);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2001-04-09 02:45:04 +00:00
|
|
|
case MEMORY_AREA_SYSTEM:
|
|
|
|
Status = STATUS_UNSUCCESSFUL;
|
|
|
|
break;
|
|
|
|
|
2002-08-10 16:41:20 +00:00
|
|
|
case MEMORY_AREA_SECTION_VIEW:
|
2001-04-09 02:45:04 +00:00
|
|
|
Status = MmNotPresentFaultSectionView(AddressSpace,
|
|
|
|
MemoryArea,
|
|
|
|
(PVOID)Address,
|
|
|
|
Locked);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MEMORY_AREA_VIRTUAL_MEMORY:
|
|
|
|
Status = MmNotPresentFaultVirtualMemory(AddressSpace,
|
|
|
|
MemoryArea,
|
|
|
|
(PVOID)Address,
|
|
|
|
Locked);
|
2001-04-04 22:21:32 +00:00
|
|
|
break;
|
|
|
|
|
2001-04-09 02:45:04 +00:00
|
|
|
case MEMORY_AREA_SHARED_DATA:
|
|
|
|
Status =
|
2001-12-20 03:56:10 +00:00
|
|
|
MmCreateVirtualMapping(PsGetCurrentProcess(),
|
2002-01-01 00:21:57 +00:00
|
|
|
(PVOID)PAGE_ROUND_DOWN(Address),
|
|
|
|
PAGE_READONLY,
|
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
|
|
|
MmSharedDataPagePhysicalAddress,
|
2002-01-01 00:21:57 +00:00
|
|
|
FALSE);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
MmUnlockAddressSpace(&PsGetCurrentProcess()->AddressSpace);
|
|
|
|
Status =
|
|
|
|
MmCreateVirtualMapping(PsGetCurrentProcess(),
|
|
|
|
(PVOID)PAGE_ROUND_DOWN(Address),
|
|
|
|
PAGE_READONLY,
|
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
|
|
|
MmSharedDataPagePhysicalAddress,
|
2002-01-01 00:21:57 +00:00
|
|
|
TRUE);
|
|
|
|
MmLockAddressSpace(&PsGetCurrentProcess()->AddressSpace);
|
|
|
|
}
|
2001-04-09 02:45:04 +00:00
|
|
|
break;
|
2001-04-04 22:21:32 +00:00
|
|
|
|
2001-04-09 02:45:04 +00:00
|
|
|
default:
|
|
|
|
Status = STATUS_UNSUCCESSFUL;
|
|
|
|
break;
|
2001-04-04 22:21:32 +00:00
|
|
|
}
|
1999-04-14 00:52:19 +00:00
|
|
|
}
|
2001-04-04 22:21:32 +00:00
|
|
|
while (Status == STATUS_MM_RESTART_OPERATION);
|
|
|
|
|
1999-04-14 00:52:19 +00:00
|
|
|
DPRINT("Completed page fault handling\n");
|
2001-02-14 02:53:54 +00:00
|
|
|
if (!FromMdl)
|
|
|
|
{
|
|
|
|
MmUnlockAddressSpace(AddressSpace);
|
|
|
|
}
|
2000-04-07 02:24:03 +00:00
|
|
|
return(Status);
|
1999-04-14 00:52:19 +00:00
|
|
|
}
|
|
|
|
|
2000-04-02 13:32:43 +00:00
|
|
|
/* Miscellanea functions: they may fit somewhere else */
|
|
|
|
|
2001-01-08 02:14:06 +00:00
|
|
|
DWORD STDCALL
|
|
|
|
MmAdjustWorkingSetSize (DWORD Unknown0,
|
|
|
|
DWORD Unknown1,
|
|
|
|
DWORD Unknown2)
|
2000-04-02 13:32:43 +00:00
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DWORD
|
|
|
|
STDCALL
|
|
|
|
MmDbgTranslatePhysicalAddress (
|
|
|
|
DWORD Unknown0,
|
|
|
|
DWORD Unknown1
|
|
|
|
)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
STDCALL
|
|
|
|
MmGrowKernelStack (
|
|
|
|
DWORD Unknown0
|
|
|
|
)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return (STATUS_NOT_IMPLEMENTED);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOLEAN
|
|
|
|
STDCALL
|
|
|
|
MmSetAddressRangeModified (
|
2002-09-07 15:13:13 +00:00
|
|
|
IN PVOID Address,
|
|
|
|
IN ULONG Length
|
2000-04-02 13:32:43 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return (FALSE);
|
|
|
|
}
|
|
|
|
|
2000-03-20 18:00:55 +00:00
|
|
|
/* EOF */
|