mirror of
https://github.com/reactos/reactos.git
synced 2024-07-08 21:55:08 +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;
|
PMEMORY_AREA MemoryArea;
|
||||||
PMM_SECTION_SEGMENT Segment;
|
PMM_SECTION_SEGMENT Segment;
|
||||||
LARGE_INTEGER FileOffset = *FileOffsetPtr, End, FirstMapped;
|
LARGE_INTEGER FileOffset = *FileOffsetPtr, End, FirstMapped;
|
||||||
|
KIRQL OldIrql;
|
||||||
|
|
||||||
DPRINT("MiZeroFillSection(Address %x,Offset %x,Length %x)\n", Address, FileOffset.LowPart, Length);
|
DPRINT("MiZeroFillSection(Address %x,Offset %x,Length %x)\n", Address, FileOffset.LowPart, Length);
|
||||||
|
|
||||||
AddressSpace = MmGetKernelAddressSpace();
|
AddressSpace = MmGetKernelAddressSpace();
|
||||||
|
|
||||||
MmLockAddressSpace(AddressSpace);
|
MmLockAddressSpace(AddressSpace);
|
||||||
MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, Address);
|
MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, Address);
|
||||||
MmUnlockAddressSpace(AddressSpace);
|
MmUnlockAddressSpace(AddressSpace);
|
||||||
|
@ -140,7 +144,10 @@ MiZeroFillSection
|
||||||
MmSetPageEntrySectionSegment(Segment, &FileOffset, MAKE_PFN_SSE(Page));
|
MmSetPageEntrySectionSegment(Segment, &FileOffset, MAKE_PFN_SSE(Page));
|
||||||
Address = ((PCHAR)MemoryArea->StartingAddress) + FileOffset.QuadPart - FirstMapped.QuadPart;
|
Address = ((PCHAR)MemoryArea->StartingAddress) + FileOffset.QuadPart - FirstMapped.QuadPart;
|
||||||
|
|
||||||
|
OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
|
||||||
MmReferencePage(Page);
|
MmReferencePage(Page);
|
||||||
|
KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
|
||||||
|
|
||||||
MmCreateVirtualMapping(NULL, Address, PAGE_READWRITE, &Page, 1);
|
MmCreateVirtualMapping(NULL, Address, PAGE_READWRITE, &Page, 1);
|
||||||
MmInsertRmap(Page, NULL, Address);
|
MmInsertRmap(Page, NULL, Address);
|
||||||
}
|
}
|
||||||
|
@ -175,6 +182,7 @@ _MiFlushMappedSection
|
||||||
LARGE_INTEGER FileOffset;
|
LARGE_INTEGER FileOffset;
|
||||||
PFN_NUMBER Page;
|
PFN_NUMBER Page;
|
||||||
PPFN_NUMBER Pages;
|
PPFN_NUMBER Pages;
|
||||||
|
KIRQL OldIrql;
|
||||||
|
|
||||||
DPRINT("MiFlushMappedSection(%x,%08x,%x,%d,%s:%d)\n", BaseAddress, BaseOffset->LowPart, FileSize, WriteData, File, Line);
|
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)) &&
|
(MmIsDirtyPageRmap(Page) || IS_DIRTY_SSE(Entry)) &&
|
||||||
FileOffset.QuadPart < FileSize->QuadPart)
|
FileOffset.QuadPart < FileSize->QuadPart)
|
||||||
{
|
{
|
||||||
|
OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
|
||||||
MmReferencePage(Page);
|
MmReferencePage(Page);
|
||||||
|
KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
|
||||||
Pages[(PageAddress - BeginningAddress) >> PAGE_SHIFT] = Entry;
|
Pages[(PageAddress - BeginningAddress) >> PAGE_SHIFT] = Entry;
|
||||||
}
|
}
|
||||||
else
|
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 Entry;
|
||||||
ULONG Attributes;
|
ULONG Attributes;
|
||||||
PEPROCESS Process = MmGetAddressSpaceOwner(AddressSpace);
|
PEPROCESS Process = MmGetAddressSpaceOwner(AddressSpace);
|
||||||
|
KIRQL OldIrql;
|
||||||
|
|
||||||
DPRINT("Not Present: %p %p (%p-%p)\n", AddressSpace, Address, MemoryArea->StartingAddress, MemoryArea->EndingAddress);
|
DPRINT("Not Present: %p %p (%p-%p)\n", AddressSpace, Address, MemoryArea->StartingAddress, MemoryArea->EndingAddress);
|
||||||
|
|
||||||
|
@ -175,7 +176,9 @@ MmNotPresentFaultCachePage
|
||||||
KeBugCheck(CACHE_MANAGER);
|
KeBugCheck(CACHE_MANAGER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
|
||||||
MmReferencePage(Page);
|
MmReferencePage(Page);
|
||||||
|
KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
|
||||||
|
|
||||||
Status = MmCreateVirtualMapping(Process, Address, Attributes, &Page, 1);
|
Status = MmCreateVirtualMapping(Process, Address, Attributes, &Page, 1);
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
|
|
Loading…
Reference in a new issue