- Check for a privat page and change only the page protection

for such a page in MmAccessFaultSectionView.

svn path=/trunk/; revision=7932
This commit is contained in:
Hartmut Birr 2004-01-30 23:57:58 +00:00
parent 5dee2e6519
commit dab0a77461

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: section.c,v 1.142 2004/01/27 20:13:08 hbirr Exp $ /* $Id: section.c,v 1.143 2004/01/30 23:57:58 hbirr Exp $
* *
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/section.c * FILE: ntoskrnl/mm/section.c
@ -1218,6 +1218,7 @@ MmAccessFaultSectionView(PMADDRESS_SPACE AddressSpace,
ULONG Offset; ULONG Offset;
PMM_PAGEOP PageOp; PMM_PAGEOP PageOp;
PMM_REGION Region; PMM_REGION Region;
ULONG Entry;
/* /*
* Check if the page has been paged out or has already been set readwrite * Check if the page has been paged out or has already been set readwrite
@ -1253,15 +1254,11 @@ MmAccessFaultSectionView(PMADDRESS_SPACE AddressSpace,
*/ */
MmLockSectionSegment(Segment); MmLockSectionSegment(Segment);
/* OldPage = MmGetPhysicalAddressForProcess(NULL, Address);
* Sanity check. Entry = MmGetPageEntrySectionSegment(Segment, Offset);
*/
if (MmGetPageEntrySectionSegment(Segment, Offset) == 0)
{
DPRINT1("COW fault for page with PESS 0. Address was 0x%.8X\n",
Address);
}
MmUnlockSectionSegment(Segment); MmUnlockSectionSegment(Segment);
/* /*
* Check if we are doing COW * Check if we are doing COW
*/ */
@ -1273,6 +1270,18 @@ MmAccessFaultSectionView(PMADDRESS_SPACE AddressSpace,
return(STATUS_UNSUCCESSFUL); return(STATUS_UNSUCCESSFUL);
} }
if (IS_SWAP_FROM_SSE(Entry) ||
PAGE_FROM_SSE(Entry) != OldPage.u.LowPart)
{
/* This is a private page. We must only change the page protection. */
MmSetPageProtect(AddressSpace->Process, (PVOID)PAddress, Region->Protect);
if (Locked)
{
MmLockPage(OldPage);
}
return(STATUS_SUCCESS);
}
/* /*
* Get or create a pageop * Get or create a pageop
*/ */
@ -1330,7 +1339,6 @@ MmAccessFaultSectionView(PMADDRESS_SPACE AddressSpace,
/* /*
* Copy the old page * Copy the old page
*/ */
OldPage = MmGetPhysicalAddressForProcess(NULL, Address);
NewAddress = ExAllocatePageWithPhysPage(NewPage); NewAddress = ExAllocatePageWithPhysPage(NewPage);
memcpy(NewAddress, (PVOID)PAddress, PAGE_SIZE); memcpy(NewAddress, (PVOID)PAddress, PAGE_SIZE);