mirror of
https://github.com/reactos/reactos.git
synced 2025-04-30 02:58:48 +00:00
[NTOS:MM] Simplify code & fix MSVC x64 build
This commit is contained in:
parent
2ba1926037
commit
7f7abc9838
1 changed files with 11 additions and 41 deletions
|
@ -102,7 +102,7 @@ GetEntry:
|
||||||
|
|
||||||
MmLockAddressSpace(AddressSpace);
|
MmLockAddressSpace(AddressSpace);
|
||||||
|
|
||||||
if ((MmGetPfnForProcess(Process, Address) != Page) || MmIsPageAccessed(Process, Address))
|
if (MmGetPfnForProcess(Process, Address) != Page)
|
||||||
{
|
{
|
||||||
/* This changed in the short window where we didn't have any locks */
|
/* This changed in the short window where we didn't have any locks */
|
||||||
MmUnlockAddressSpace(AddressSpace);
|
MmUnlockAddressSpace(AddressSpace);
|
||||||
|
@ -152,31 +152,8 @@ GetEntry:
|
||||||
/* Delete this virtual mapping in the process */
|
/* Delete this virtual mapping in the process */
|
||||||
MmDeleteVirtualMapping(Process, Address, &Dirty, &MapPage);
|
MmDeleteVirtualMapping(Process, Address, &Dirty, &MapPage);
|
||||||
|
|
||||||
/* There is a window betwwen the start of this function and now,
|
/* We checked this earlier */
|
||||||
* where it's possible that the process changed its memory layout,
|
ASSERT(MapPage == Page);
|
||||||
* because of copy-on-write, unmapping memory, or whatsoever.
|
|
||||||
* Just go away if that is the case */
|
|
||||||
if (MapPage != Page)
|
|
||||||
{
|
|
||||||
PMM_REGION Region = MmFindRegion((PVOID)MA_GetStartingAddress(MemoryArea),
|
|
||||||
&MemoryArea->SectionData.RegionListHead,
|
|
||||||
Address, NULL);
|
|
||||||
/* Restore the mapping */
|
|
||||||
MmCreateVirtualMapping(Process, Address, Region->Protect, &MapPage, 1);
|
|
||||||
if (Dirty)
|
|
||||||
MmSetDirtyPage(Process, Address);
|
|
||||||
|
|
||||||
MmUnlockSectionSegment(Segment);
|
|
||||||
MmUnlockAddressSpace(AddressSpace);
|
|
||||||
if (Address < MmSystemRangeStart)
|
|
||||||
{
|
|
||||||
ExReleaseRundownProtection(&Process->RundownProtect);
|
|
||||||
ObDereferenceObject(Process);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We can still try to flush it to disk, though */
|
|
||||||
goto WriteSegment;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Page != PFN_FROM_SSE(Entry))
|
if (Page != PFN_FROM_SSE(Entry))
|
||||||
{
|
{
|
||||||
|
@ -232,11 +209,9 @@ GetEntry:
|
||||||
MmSetDirtyPage(Process, Address);
|
MmSetDirtyPage(Process, Address);
|
||||||
|
|
||||||
MmUnlockAddressSpace(AddressSpace);
|
MmUnlockAddressSpace(AddressSpace);
|
||||||
if (Address < MmSystemRangeStart)
|
|
||||||
{
|
|
||||||
ExReleaseRundownProtection(&Process->RundownProtect);
|
ExReleaseRundownProtection(&Process->RundownProtect);
|
||||||
ObDereferenceObject(Process);
|
ObDereferenceObject(Process);
|
||||||
}
|
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -259,11 +234,9 @@ GetEntry:
|
||||||
#endif
|
#endif
|
||||||
MmReleasePageMemoryConsumer(MC_USER, Page);
|
MmReleasePageMemoryConsumer(MC_USER, Page);
|
||||||
|
|
||||||
if (Address < MmSystemRangeStart)
|
|
||||||
{
|
|
||||||
ExReleaseRundownProtection(&Process->RundownProtect);
|
ExReleaseRundownProtection(&Process->RundownProtect);
|
||||||
ObDereferenceObject(Process);
|
ObDereferenceObject(Process);
|
||||||
}
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,11 +249,8 @@ GetEntry:
|
||||||
MmUnlockSectionSegment(Segment);
|
MmUnlockSectionSegment(Segment);
|
||||||
MmUnlockAddressSpace(AddressSpace);
|
MmUnlockAddressSpace(AddressSpace);
|
||||||
|
|
||||||
if (Address < MmSystemRangeStart)
|
|
||||||
{
|
|
||||||
ExReleaseRundownProtection(&Process->RundownProtect);
|
ExReleaseRundownProtection(&Process->RundownProtect);
|
||||||
ObDereferenceObject(Process);
|
ObDereferenceObject(Process);
|
||||||
}
|
|
||||||
|
|
||||||
if (Released) return STATUS_SUCCESS;
|
if (Released) return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue