Revert my changes from rev 15805.
Modified: trunk/reactos/ntoskrnl/include/internal/mm.h
Modified: trunk/reactos/ntoskrnl/mm/mdl.c
Modified: trunk/reactos/ntoskrnl/mm/mm.c
Modified: trunk/reactos/ntoskrnl/mm/ppool.c
_____
Modified: trunk/reactos/ntoskrnl/include/internal/mm.h
--- trunk/reactos/ntoskrnl/include/internal/mm.h 2005-06-05
21:12:30 UTC (rev 15815)
+++ trunk/reactos/ntoskrnl/include/internal/mm.h 2005-06-05
21:24:36 UTC (rev 15816)
@@ -367,9 +367,6 @@
/* FUNCTIONS */
-VOID MmLockPagedPool(VOID);
-VOID MmUnlockPagedPool(VOID);
-
/* aspace.c
******************************************************************/
VOID MmLockAddressSpace(PMADDRESS_SPACE AddressSpace);
_____
Modified: trunk/reactos/ntoskrnl/mm/mdl.c
--- trunk/reactos/ntoskrnl/mm/mdl.c 2005-06-05 21:12:30 UTC (rev
15815)
+++ trunk/reactos/ntoskrnl/mm/mdl.c 2005-06-05 21:24:36 UTC (rev
15816)
@@ -364,7 +364,6 @@
PFN_TYPE Page;
PEPROCESS CurrentProcess = PsGetCurrentProcess();
PMADDRESS_SPACE AddressSpace;
- BOOLEAN PagedPool;
DPRINT("MmProbeAndLockPages(Mdl %x)\n", Mdl);
@@ -399,7 +398,6 @@
Mode = KernelMode;
Mdl->Process = NULL;
AddressSpace = MmGetKernelAddressSpace();
- PagedPool = Mdl->StartVa >= MmPagedPoolBase && Mdl->StartVa <
MmPagedPoolBase + MmPagedPoolSize ? TRUE : FALSE;
}
else
{
@@ -407,21 +405,14 @@
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 @@
MmDereferencePage(Page);
}
}
- if (PagedPool)
- {
- MmUnlockPagedPool();
- }
- else
- {
- MmUnlockAddressSpace(AddressSpace);
- }
+ MmUnlockAddressSpace(AddressSpace);
ExRaiseStatus(STATUS_ACCESS_VIOLATION);
}
}
@@ -478,14 +462,7 @@
MmDereferencePage(Page);
}
}
- if (PagedPool)
- {
- MmUnlockPagedPool();
- }
- else
- {
- MmUnlockAddressSpace(AddressSpace);
- }
+ MmUnlockAddressSpace(AddressSpace);
ExRaiseStatus(STATUS_ACCESS_VIOLATION);
}
}
@@ -497,14 +474,7 @@
MmReferencePage(Page);
}
- if (PagedPool)
- {
- MmUnlockPagedPool();
- }
- else
- {
- MmUnlockAddressSpace(AddressSpace);
- }
+ MmUnlockAddressSpace(AddressSpace);
Mdl->MdlFlags |= MDL_PAGES_LOCKED;
}
_____
Modified: trunk/reactos/ntoskrnl/mm/mm.c
--- trunk/reactos/ntoskrnl/mm/mm.c 2005-06-05 21:12:30 UTC (rev
15815)
+++ trunk/reactos/ntoskrnl/mm/mm.c 2005-06-05 21:24:36 UTC (rev
15816)
@@ -215,10 +215,6 @@
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 @@
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 Status;
BOOLEAN Locked = FromMdl;
PFN_TYPE Pfn;
- BOOLEAN PagedPool;
DPRINT("MmNotPresentFault(Mode %d, Address %x)\n", Mode, Address);
@@ -347,25 +344,16 @@
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 @@
*/
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 @@
DPRINT("Completed page fault handling\n");
if (!FromMdl)
{
- if (PagedPool)
- {
- MmUnlockPagedPool();
- }
- else
- {
- MmUnlockAddressSpace(AddressSpace);
- }
+ MmUnlockAddressSpace(AddressSpace);
}
return(Status);
}
_____
Modified: trunk/reactos/ntoskrnl/mm/ppool.c
--- trunk/reactos/ntoskrnl/mm/ppool.c 2005-06-05 21:12:30 UTC (rev
15815)
+++ trunk/reactos/ntoskrnl/mm/ppool.c 2005-06-05 21:24:36 UTC (rev
15816)
@@ -41,7 +41,6 @@
ULONG MmPagedPoolSize;
ULONG MmTotalPagedPoolQuota = 0; // TODO FIXME commented out until we
use it
static PR_POOL MmPagedPool = NULL;
-static FAST_MUTEX MmPagedPoolLock;
/* FUNCTIONS
*****************************************************************/
@@ -61,19 +60,8 @@
PAGE_SIZE );
ExInitializeFastMutex(&MmPagedPool->Mutex);
- ExInitializeFastMutex(&MmPagedPoolLock);
}
-VOID MmLockPagedPool(VOID)
-{
- ExAcquireFastMutex(&MmPagedPoolLock);
-}
-
-VOID MmUnlockPagedPool(VOID)
-{
- ExReleaseFastMutex(&MmPagedPoolLock);
-}
-
/**********************************************************************
* NAME INTERNAL
* ExAllocatePagedPoolWithTag@12