mirror of
https://github.com/reactos/reactos.git
synced 2024-10-02 23:46:50 +00:00
[NEWCC]
- Hold the PFN lock when referencing pages svn path=/trunk/; revision=56049
This commit is contained in:
parent
4a78d2e988
commit
9973fe86bf
10
reactos/ntoskrnl/cache/section/data.c
vendored
10
reactos/ntoskrnl/cache/section/data.c
vendored
|
@ -104,8 +104,12 @@ MiZeroFillSection
|
|||
PMEMORY_AREA MemoryArea;
|
||||
PMM_SECTION_SEGMENT Segment;
|
||||
LARGE_INTEGER FileOffset = *FileOffsetPtr, End, FirstMapped;
|
||||
KIRQL OldIrql;
|
||||
|
||||
DPRINT("MiZeroFillSection(Address %x,Offset %x,Length %x)\n", Address, FileOffset.LowPart, Length);
|
||||
|
||||
AddressSpace = MmGetKernelAddressSpace();
|
||||
|
||||
MmLockAddressSpace(AddressSpace);
|
||||
MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, Address);
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
|
@ -140,7 +144,10 @@ MiZeroFillSection
|
|||
MmSetPageEntrySectionSegment(Segment, &FileOffset, MAKE_PFN_SSE(Page));
|
||||
Address = ((PCHAR)MemoryArea->StartingAddress) + FileOffset.QuadPart - FirstMapped.QuadPart;
|
||||
|
||||
OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
|
||||
MmReferencePage(Page);
|
||||
KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
|
||||
|
||||
MmCreateVirtualMapping(NULL, Address, PAGE_READWRITE, &Page, 1);
|
||||
MmInsertRmap(Page, NULL, Address);
|
||||
}
|
||||
|
@ -175,6 +182,7 @@ _MiFlushMappedSection
|
|||
LARGE_INTEGER FileOffset;
|
||||
PFN_NUMBER Page;
|
||||
PPFN_NUMBER Pages;
|
||||
KIRQL OldIrql;
|
||||
|
||||
DPRINT("MiFlushMappedSection(%x,%08x,%x,%d,%s:%d)\n", BaseAddress, BaseOffset->LowPart, FileSize, WriteData, File, Line);
|
||||
|
||||
|
@ -222,7 +230,9 @@ _MiFlushMappedSection
|
|||
(MmIsDirtyPageRmap(Page) || IS_DIRTY_SSE(Entry)) &&
|
||||
FileOffset.QuadPart < FileSize->QuadPart)
|
||||
{
|
||||
OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
|
||||
MmReferencePage(Page);
|
||||
KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
|
||||
Pages[(PageAddress - BeginningAddress) >> PAGE_SHIFT] = Entry;
|
||||
}
|
||||
else
|
||||
|
|
3
reactos/ntoskrnl/cache/section/fault.c
vendored
3
reactos/ntoskrnl/cache/section/fault.c
vendored
|
@ -73,6 +73,7 @@ MmNotPresentFaultCachePage
|
|||
ULONG Entry;
|
||||
ULONG Attributes;
|
||||
PEPROCESS Process = MmGetAddressSpaceOwner(AddressSpace);
|
||||
KIRQL OldIrql;
|
||||
|
||||
DPRINT("Not Present: %p %p (%p-%p)\n", AddressSpace, Address, MemoryArea->StartingAddress, MemoryArea->EndingAddress);
|
||||
|
||||
|
@ -175,7 +176,9 @@ MmNotPresentFaultCachePage
|
|||
KeBugCheck(CACHE_MANAGER);
|
||||
}
|
||||
|
||||
OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
|
||||
MmReferencePage(Page);
|
||||
KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
|
||||
|
||||
Status = MmCreateVirtualMapping(Process, Address, Attributes, &Page, 1);
|
||||
if (NT_SUCCESS(Status))
|
||||
|
|
Loading…
Reference in a new issue