- Use MmCreateHyperspaceMapping() again.

- Delete hyperspace mapping before releasing cache segment (bug #4249).

svn path=/trunk/; revision=40018
This commit is contained in:
Dmitry Gorbachev 2009-03-14 21:29:37 +00:00
parent a1fee90219
commit aa365b7e33
2 changed files with 13 additions and 5 deletions

View file

@ -1076,18 +1076,18 @@ MmUpdatePageDir(PEPROCESS Process, PVOID Address, ULONG Size)
{
ULONG StartOffset, EndOffset, Offset;
PULONG Pde;
if (Address < MmSystemRangeStart)
{
KeBugCheck(MEMORY_MANAGEMENT);
}
StartOffset = ADDR_TO_PDE_OFFSET(Address);
EndOffset = ADDR_TO_PDE_OFFSET((PVOID)((ULONG_PTR)Address + Size));
if (Process != NULL && Process != PsGetCurrentProcess())
{
Pde = MiMapPageToZeroInHyperSpace(PTE_TO_PFN(Process->Pcb.DirectoryTableBase[0]));
Pde = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase[0]));
}
else
{
@ -1100,6 +1100,10 @@ MmUpdatePageDir(PEPROCESS Process, PVOID Address, ULONG Size)
InterlockedCompareExchangePte(&Pde[Offset], MmGlobalKernelPageDirectory[Offset], 0);
}
}
if (Pde != (PULONG)PAGEDIRECTORY_MAP)
{
MmDeleteHyperspaceMapping(Pde);
}
}
extern MMPTE HyperTemplatePte;

View file

@ -691,7 +691,8 @@ MiReadPage(PMEMORY_AREA MemoryArea,
return Status;
}
}
PageAddr = MiMapPageToZeroInHyperSpace(*Page);
PageAddr = MmCreateHyperspaceMapping(*Page);
CacheSegOffset = BaseOffset + CacheSeg->Bcb->CacheSegmentSize - FileOffset;
Length = RawLength - SegOffset;
if (Length <= CacheSegOffset && Length <= PAGE_SIZE)
@ -705,6 +706,7 @@ MiReadPage(PMEMORY_AREA MemoryArea,
else
{
memcpy(PageAddr, (char*)BaseAddress + FileOffset - BaseOffset, CacheSegOffset);
MmDeleteHyperspaceMapping(PageAddr);
CcRosReleaseCacheSegment(Bcb, CacheSeg, TRUE, FALSE, FALSE);
Status = CcRosGetCacheSegment(Bcb,
FileOffset + CacheSegOffset,
@ -729,6 +731,7 @@ MiReadPage(PMEMORY_AREA MemoryArea,
return Status;
}
}
PageAddr = MmCreateHyperspaceMapping(*Page);
if (Length < PAGE_SIZE)
{
memcpy((char*)PageAddr + CacheSegOffset, BaseAddress, Length - CacheSegOffset);
@ -738,6 +741,7 @@ MiReadPage(PMEMORY_AREA MemoryArea,
memcpy((char*)PageAddr + CacheSegOffset, BaseAddress, PAGE_SIZE - CacheSegOffset);
}
}
MmDeleteHyperspaceMapping(PageAddr);
CcRosReleaseCacheSegment(Bcb, CacheSeg, TRUE, FALSE, FALSE);
}
return(STATUS_SUCCESS);