/*
* Get or create a page operation
*/
- PageOp = MmGetPageOp(MemoryArea, (ULONG)PsGetCurrentProcessId(),
+ PageOp = MmGetPageOp(MemoryArea, (ULONG)MemoryArea->Process->UniqueProcessId,
(PVOID)PAGE_ROUND_DOWN(Address), NULL, 0,
MM_PAGEOP_PAGEIN);
if (PageOp == NULL)
if (PageOp->OpType != MM_PAGEOP_PAGEIN)
{
MmLockAddressSpace(AddressSpace);
+ KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE);
MmReleasePageOp(PageOp);
return(STATUS_MM_RESTART_OPERATION);
}
if (!NT_SUCCESS(PageOp->Status))
{
MmLockAddressSpace(AddressSpace);
+ KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE);
+ Status = PageOp->Status;
MmReleasePageOp(PageOp);
return(Status);
}
{
MmLockPage(MmGetPhysicalAddressForProcess(NULL, Address));
}
+ KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE);
MmReleasePageOp(PageOp);
return(STATUS_SUCCESS);
}
Status = MmRequestPageMemoryConsumer(MC_USER, TRUE, &Page);
MmLockAddressSpace(AddressSpace);
}
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("MmRequestPageMemoryConsumer failed, status = %x\n", Status);
+ KeBugCheck(0);
+ }
/*
* Handle swapped out pages.
* Set the page. If we fail because we are out of memory then
* try again
*/
- Status = MmCreateVirtualMapping(PsGetCurrentProcess(),
- Address,
+ Status = MmCreateVirtualMapping(MemoryArea->Process,
+ (PVOID)PAGE_ROUND_DOWN(Address),
MemoryArea->Attributes,
Page,
FALSE);
while (Status == STATUS_NO_MEMORY)
{
MmUnlockAddressSpace(AddressSpace);
- Status = MmCreateVirtualMapping(PsGetCurrentProcess(),
+ Status = MmCreateVirtualMapping(MemoryArea->Process,
Address,
MemoryArea->Attributes,
Page,
/*
* Add the page to the process's working set
*/
- MmInsertRmap(Page, PsGetCurrentProcess(), (PVOID)PAGE_ROUND_DOWN(Address));
+ MmInsertRmap(Page, MemoryArea->Process, (PVOID)PAGE_ROUND_DOWN(Address));
/*
* Finish the operation
MmAlterRegion(AddressSpace,
MemoryArea->BaseAddress,
&MemoryArea->Data.VirtualMemoryData.RegionListHead,
- PBaseAddress, RegionSize,
+ BaseAddress, RegionSize,
Type, Protect, MmModifyAttributes);
MmUnlockAddressSpace(AddressSpace);
ObDereferenceObject(Process);
}
Status = MmCreateMemoryArea(Process,
- &Process->AddressSpace,
+ AddressSpace,
MEMORY_AREA_VIRTUAL_MEMORY,
&BaseAddress,
RegionSize,