mirror of
https://github.com/reactos/reactos.git
synced 2024-10-04 16:36:11 +00:00
[NTOSKRNL]
Fix a couple of omissions from my PAGEOP removal; Make sure to place a wait entry in the address space when faulting in bss pages. Restore the original entry in the final cases of section swap out, because the entry had been replaced with a wait and nothing else restores it. svn path=/trunk/; revision=56540
This commit is contained in:
parent
5ea511aa17
commit
37f34e8443
|
@ -60,8 +60,8 @@
|
|||
|
||||
#undef MmSetPageEntrySectionSegment
|
||||
#define MmSetPageEntrySectionSegment(S,O,E) do { \
|
||||
DPRINT("SetPageEntrySectionSegment(old,%x,%x,%x)\n", S,(O)->LowPart,E); \
|
||||
_MmSetPageEntrySectionSegment(S,O,E,__FILE__,__LINE__); \
|
||||
DPRINT("SetPageEntrySectionSegment(old,%x,%x,%x)\n",(S),(O)->LowPart,E); \
|
||||
_MmSetPageEntrySectionSegment((S),(O),(E),__FILE__,__LINE__); \
|
||||
} while (0)
|
||||
|
||||
extern MMSESSION MmSession;
|
||||
|
@ -1211,6 +1211,7 @@ MmNotPresentFaultSectionView(PMMSUPPORT AddressSpace,
|
|||
BOOLEAN HasSwapEntry;
|
||||
PVOID PAddress;
|
||||
PEPROCESS Process = MmGetAddressSpaceOwner(AddressSpace);
|
||||
SWAPENTRY SwapEntry;
|
||||
|
||||
/*
|
||||
* There is a window between taking the page fault and locking the
|
||||
|
@ -1277,7 +1278,6 @@ MmNotPresentFaultSectionView(PMMSUPPORT AddressSpace,
|
|||
|
||||
if (HasSwapEntry)
|
||||
{
|
||||
SWAPENTRY SwapEntry;
|
||||
/*
|
||||
* Is it a wait entry?
|
||||
*/
|
||||
|
@ -1307,6 +1307,7 @@ MmNotPresentFaultSectionView(PMMSUPPORT AddressSpace,
|
|||
|
||||
MmUnlockSectionSegment(Segment);
|
||||
MmDeletePageFileMapping(Process, Address, &SwapEntry);
|
||||
MmCreatePageFileMapping(Process, Address, MM_WAIT_ENTRY);
|
||||
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
MI_SET_USAGE(MI_USAGE_SECTION);
|
||||
|
@ -1389,6 +1390,9 @@ MmNotPresentFaultSectionView(PMMSUPPORT AddressSpace,
|
|||
*/
|
||||
if (Segment->Image.Characteristics & IMAGE_SCN_CNT_UNINITIALIZED_DATA)
|
||||
{
|
||||
/* We'll be unlocking the address space below. Prevent us from being preempted
|
||||
* in faulting in the page. */
|
||||
MmCreatePageFileMapping(Process, Address, MM_WAIT_ENTRY);
|
||||
MmUnlockSectionSegment(Segment);
|
||||
MI_SET_USAGE(MI_USAGE_SECTION);
|
||||
if (Process) MI_SET_PROCESS2(Process->ImageFileName);
|
||||
|
@ -1404,6 +1408,8 @@ MmNotPresentFaultSectionView(PMMSUPPORT AddressSpace,
|
|||
{
|
||||
KeBugCheck(MEMORY_MANAGEMENT);
|
||||
}
|
||||
/* Remove the wait entry we placed, so that we can map the page */
|
||||
MmDeletePageFileMapping(Process, PAddress, &SwapEntry);
|
||||
Status = MmCreateVirtualMapping(Process,
|
||||
PAddress,
|
||||
Region->Protect,
|
||||
|
@ -2189,6 +2195,8 @@ MmPageOutSectionView(PMMSUPPORT AddressSpace,
|
|||
Status = MmCreatePageFileMapping(Process,
|
||||
Address,
|
||||
SwapEntry);
|
||||
/* We had placed a wait entry upon entry ... replace it before leaving */
|
||||
MmSetPageEntrySectionSegment(Context.Segment, &Context.Offset, Entry);
|
||||
MmUnlockSectionSegment(Context.Segment);
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
@ -2202,6 +2210,7 @@ MmPageOutSectionView(PMMSUPPORT AddressSpace,
|
|||
MmLockAddressSpace(AddressSpace);
|
||||
MmLockSectionSegment(Context.Segment);
|
||||
Entry = MAKE_SWAP_SSE(SwapEntry);
|
||||
/* We had placed a wait entry upon entry ... replace it before leaving */
|
||||
MmSetPageEntrySectionSegment(Context.Segment, &Context.Offset, Entry);
|
||||
MmUnlockSectionSegment(Context.Segment);
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
|
|
Loading…
Reference in a new issue