Author: dgorbachev
Date: Sun Mar 15 00:29:37 2009
New Revision: 40018
URL:
http://svn.reactos.org/svn/reactos?rev=40018&view=rev
Log:
- Use MmCreateHyperspaceMapping() again.
- Delete hyperspace mapping before releasing cache segment (bug #4249).
Modified:
trunk/reactos/ntoskrnl/mm/i386/page.c
trunk/reactos/ntoskrnl/mm/section.c
Modified: trunk/reactos/ntoskrnl/mm/i386/page.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/i386/page.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/i386/page.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/i386/page.c [iso-8859-1] Sun Mar 15 00:29:37 2009
@@ -1076,18 +1076,18 @@
{
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
{
@@ -1099,6 +1099,10 @@
{
InterlockedCompareExchangePte(&Pde[Offset],
MmGlobalKernelPageDirectory[Offset], 0);
}
+ }
+ if (Pde != (PULONG)PAGEDIRECTORY_MAP)
+ {
+ MmDeleteHyperspaceMapping(Pde);
}
}
Modified: trunk/reactos/ntoskrnl/mm/section.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/section.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] Sun Mar 15 00:29:37 2009
@@ -691,7 +691,8 @@
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 @@
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 @@
return Status;
}
}
+ PageAddr = MmCreateHyperspaceMapping(*Page);
if (Length < PAGE_SIZE)
{
memcpy((char*)PageAddr + CacheSegOffset, BaseAddress, Length -
CacheSegOffset);
@@ -738,6 +741,7 @@
memcpy((char*)PageAddr + CacheSegOffset, BaseAddress, PAGE_SIZE -
CacheSegOffset);
}
}
+ MmDeleteHyperspaceMapping(PageAddr);
CcRosReleaseCacheSegment(Bcb, CacheSeg, TRUE, FALSE, FALSE);
}
return(STATUS_SUCCESS);