mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 17:44:45 +00:00
Revert my changes from rev 15805.
svn path=/trunk/; revision=15816
This commit is contained in:
parent
f97e4e54cd
commit
1272e9ca67
4 changed files with 50 additions and 114 deletions
|
@ -367,9 +367,6 @@ typedef VOID (*PMM_FREE_PAGE_FUNC)(PVOID Context, PMEMORY_AREA MemoryArea,
|
|||
|
||||
/* FUNCTIONS */
|
||||
|
||||
VOID MmLockPagedPool(VOID);
|
||||
VOID MmUnlockPagedPool(VOID);
|
||||
|
||||
/* aspace.c ******************************************************************/
|
||||
|
||||
VOID MmLockAddressSpace(PMADDRESS_SPACE AddressSpace);
|
||||
|
|
|
@ -364,7 +364,6 @@ VOID STDCALL MmProbeAndLockPages (PMDL Mdl,
|
|||
PFN_TYPE Page;
|
||||
PEPROCESS CurrentProcess = PsGetCurrentProcess();
|
||||
PMADDRESS_SPACE AddressSpace;
|
||||
BOOLEAN PagedPool;
|
||||
|
||||
DPRINT("MmProbeAndLockPages(Mdl %x)\n", Mdl);
|
||||
|
||||
|
@ -399,7 +398,6 @@ VOID STDCALL MmProbeAndLockPages (PMDL Mdl,
|
|||
Mode = KernelMode;
|
||||
Mdl->Process = NULL;
|
||||
AddressSpace = MmGetKernelAddressSpace();
|
||||
PagedPool = Mdl->StartVa >= MmPagedPoolBase && Mdl->StartVa < MmPagedPoolBase + MmPagedPoolSize ? TRUE : FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -407,21 +405,14 @@ VOID STDCALL MmProbeAndLockPages (PMDL Mdl,
|
|||
Mode = UserMode;
|
||||
Mdl->Process = CurrentProcess;
|
||||
AddressSpace = &CurrentProcess->AddressSpace;
|
||||
PagedPool = FALSE;
|
||||
}
|
||||
|
||||
if (PagedPool)
|
||||
{
|
||||
MmLockPagedPool();
|
||||
}
|
||||
else
|
||||
{
|
||||
MmLockAddressSpace(AddressSpace);
|
||||
}
|
||||
|
||||
/*
|
||||
* Lock the pages
|
||||
*/
|
||||
MmLockAddressSpace(AddressSpace);
|
||||
|
||||
for (i = 0; i < NrPages; i++)
|
||||
{
|
||||
PVOID Address;
|
||||
|
@ -447,14 +438,7 @@ VOID STDCALL MmProbeAndLockPages (PMDL Mdl,
|
|||
MmDereferencePage(Page);
|
||||
}
|
||||
}
|
||||
if (PagedPool)
|
||||
{
|
||||
MmUnlockPagedPool();
|
||||
}
|
||||
else
|
||||
{
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
}
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
ExRaiseStatus(STATUS_ACCESS_VIOLATION);
|
||||
}
|
||||
}
|
||||
|
@ -478,14 +462,7 @@ VOID STDCALL MmProbeAndLockPages (PMDL Mdl,
|
|||
MmDereferencePage(Page);
|
||||
}
|
||||
}
|
||||
if (PagedPool)
|
||||
{
|
||||
MmUnlockPagedPool();
|
||||
}
|
||||
else
|
||||
{
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
}
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
ExRaiseStatus(STATUS_ACCESS_VIOLATION);
|
||||
}
|
||||
}
|
||||
|
@ -497,14 +474,7 @@ VOID STDCALL MmProbeAndLockPages (PMDL Mdl,
|
|||
MmReferencePage(Page);
|
||||
}
|
||||
|
||||
if (PagedPool)
|
||||
{
|
||||
MmUnlockPagedPool();
|
||||
}
|
||||
else
|
||||
{
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
}
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
Mdl->MdlFlags |= MDL_PAGES_LOCKED;
|
||||
}
|
||||
|
||||
|
|
|
@ -215,10 +215,6 @@ NTSTATUS MmAccessFault(KPROCESSOR_MODE Mode,
|
|||
DbgPrint("%s:%d\n",__FILE__,__LINE__);
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
if (Address >= (ULONG_PTR)MmPagedPoolBase && Address < (ULONG_PTR)MmPagedPoolBase + MmPagedPoolSize)
|
||||
{
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
AddressSpace = MmGetKernelAddressSpace();
|
||||
}
|
||||
else
|
||||
|
@ -289,7 +285,9 @@ NTSTATUS MmCommitPagedPoolAddress(PVOID Address, BOOLEAN Locked)
|
|||
Status = MmRequestPageMemoryConsumer(MC_PPOOL, FALSE, &AllocatedPage);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
||||
Status = MmRequestPageMemoryConsumer(MC_PPOOL, TRUE, &AllocatedPage);
|
||||
MmLockAddressSpace(MmGetKernelAddressSpace());
|
||||
}
|
||||
Status =
|
||||
MmCreateVirtualMapping(NULL,
|
||||
|
@ -313,7 +311,6 @@ NTSTATUS MmNotPresentFault(KPROCESSOR_MODE Mode,
|
|||
NTSTATUS Status;
|
||||
BOOLEAN Locked = FromMdl;
|
||||
PFN_TYPE Pfn;
|
||||
BOOLEAN PagedPool;
|
||||
|
||||
DPRINT("MmNotPresentFault(Mode %d, Address %x)\n", Mode, Address);
|
||||
|
||||
|
@ -347,25 +344,16 @@ NTSTATUS MmNotPresentFault(KPROCESSOR_MODE Mode,
|
|||
CPRINT("Address: %x\n", Address);
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
PagedPool = Address >= (ULONG_PTR)MmPagedPoolBase && Address < (ULONG_PTR)MmPagedPoolBase + MmPagedPoolSize ? TRUE : FALSE;
|
||||
AddressSpace = MmGetKernelAddressSpace();
|
||||
}
|
||||
else
|
||||
{
|
||||
PagedPool = FALSE;
|
||||
AddressSpace = &PsGetCurrentProcess()->AddressSpace;
|
||||
}
|
||||
|
||||
if (!FromMdl)
|
||||
{
|
||||
if (PagedPool)
|
||||
{
|
||||
MmLockPagedPool();
|
||||
}
|
||||
else
|
||||
{
|
||||
MmLockAddressSpace(AddressSpace);
|
||||
}
|
||||
MmLockAddressSpace(AddressSpace);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -373,56 +361,56 @@ NTSTATUS MmNotPresentFault(KPROCESSOR_MODE Mode,
|
|||
*/
|
||||
do
|
||||
{
|
||||
if (PagedPool)
|
||||
MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, (PVOID)Address);
|
||||
if (MemoryArea == NULL || MemoryArea->DeleteInProgress)
|
||||
{
|
||||
Status = MmCommitPagedPoolAddress((PVOID)Address, Locked);
|
||||
if (!FromMdl)
|
||||
{
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
}
|
||||
return (STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
else
|
||||
|
||||
switch (MemoryArea->Type)
|
||||
{
|
||||
MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, (PVOID)Address);
|
||||
if (MemoryArea == NULL || MemoryArea->DeleteInProgress)
|
||||
{
|
||||
if (!FromMdl)
|
||||
case MEMORY_AREA_PAGED_POOL:
|
||||
{
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
Status = MmCommitPagedPoolAddress((PVOID)Address, Locked);
|
||||
break;
|
||||
}
|
||||
return (STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
|
||||
switch (MemoryArea->Type)
|
||||
{
|
||||
case MEMORY_AREA_SYSTEM:
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
break;
|
||||
case MEMORY_AREA_SYSTEM:
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
break;
|
||||
|
||||
case MEMORY_AREA_SECTION_VIEW:
|
||||
Status = MmNotPresentFaultSectionView(AddressSpace,
|
||||
MemoryArea,
|
||||
(PVOID)Address,
|
||||
Locked);
|
||||
break;
|
||||
case MEMORY_AREA_SECTION_VIEW:
|
||||
Status = MmNotPresentFaultSectionView(AddressSpace,
|
||||
MemoryArea,
|
||||
(PVOID)Address,
|
||||
Locked);
|
||||
break;
|
||||
|
||||
case MEMORY_AREA_VIRTUAL_MEMORY:
|
||||
case MEMORY_AREA_PEB_OR_TEB:
|
||||
Status = MmNotPresentFaultVirtualMemory(AddressSpace,
|
||||
MemoryArea,
|
||||
(PVOID)Address,
|
||||
Locked);
|
||||
break;
|
||||
case MEMORY_AREA_VIRTUAL_MEMORY:
|
||||
case MEMORY_AREA_PEB_OR_TEB:
|
||||
Status = MmNotPresentFaultVirtualMemory(AddressSpace,
|
||||
MemoryArea,
|
||||
(PVOID)Address,
|
||||
Locked);
|
||||
break;
|
||||
|
||||
case MEMORY_AREA_SHARED_DATA:
|
||||
Pfn = MmSharedDataPagePhysicalAddress.QuadPart >> PAGE_SHIFT;
|
||||
Status = MmCreateVirtualMapping(PsGetCurrentProcess(),
|
||||
(PVOID)PAGE_ROUND_DOWN(Address),
|
||||
PAGE_READONLY,
|
||||
&Pfn,
|
||||
1);
|
||||
break;
|
||||
case MEMORY_AREA_SHARED_DATA:
|
||||
Pfn = MmSharedDataPagePhysicalAddress.QuadPart >> PAGE_SHIFT;
|
||||
Status =
|
||||
MmCreateVirtualMapping(PsGetCurrentProcess(),
|
||||
(PVOID)PAGE_ROUND_DOWN(Address),
|
||||
PAGE_READONLY,
|
||||
&Pfn,
|
||||
1);
|
||||
break;
|
||||
|
||||
default:
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (Status == STATUS_MM_RESTART_OPERATION);
|
||||
|
@ -430,14 +418,7 @@ NTSTATUS MmNotPresentFault(KPROCESSOR_MODE Mode,
|
|||
DPRINT("Completed page fault handling\n");
|
||||
if (!FromMdl)
|
||||
{
|
||||
if (PagedPool)
|
||||
{
|
||||
MmUnlockPagedPool();
|
||||
}
|
||||
else
|
||||
{
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
}
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
}
|
||||
return(Status);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,6 @@ PVOID MmPagedPoolBase;
|
|||
ULONG MmPagedPoolSize;
|
||||
ULONG MmTotalPagedPoolQuota = 0; // TODO FIXME commented out until we use it
|
||||
static PR_POOL MmPagedPool = NULL;
|
||||
static FAST_MUTEX MmPagedPoolLock;
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
|
@ -61,17 +60,6 @@ MmInitializePagedPool(VOID)
|
|||
PAGE_SIZE );
|
||||
|
||||
ExInitializeFastMutex(&MmPagedPool->Mutex);
|
||||
ExInitializeFastMutex(&MmPagedPoolLock);
|
||||
}
|
||||
|
||||
VOID MmLockPagedPool(VOID)
|
||||
{
|
||||
ExAcquireFastMutex(&MmPagedPoolLock);
|
||||
}
|
||||
|
||||
VOID MmUnlockPagedPool(VOID)
|
||||
{
|
||||
ExReleaseFastMutex(&MmPagedPoolLock);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
|
|
Loading…
Reference in a new issue