mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 01:24:38 +00:00
More swapping fixes
svn path=/trunk/; revision=2495
This commit is contained in:
parent
3a8ce6bf63
commit
fe7d926068
4 changed files with 39 additions and 17 deletions
|
@ -18,7 +18,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: dpc.c,v 1.21 2001/04/03 17:25:49 dwelch Exp $
|
||||
/* $Id: dpc.c,v 1.22 2002/01/09 03:00:20 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -136,8 +136,8 @@ KeRemoveQueueDpc (PKDPC Dpc)
|
|||
{
|
||||
KIRQL oldIrql;
|
||||
|
||||
KeAcquireSpinLockAtDpcLevel( &DpcQueueLock );
|
||||
KeRaiseIrql( HIGH_LEVEL, &oldIrql );
|
||||
KeAcquireSpinLockAtDpcLevel(&DpcQueueLock);
|
||||
KeRaiseIrql(HIGH_LEVEL, &oldIrql);
|
||||
if (!Dpc->Lock)
|
||||
{
|
||||
KeReleaseSpinLock(&DpcQueueLock, oldIrql);
|
||||
|
@ -178,7 +178,7 @@ KeInsertQueueDpc (PKDPC Dpc,
|
|||
{
|
||||
return(FALSE);
|
||||
}
|
||||
KeRaiseIrql( HIGH_LEVEL, &oldlvl );
|
||||
KeRaiseIrql(HIGH_LEVEL, &oldlvl);
|
||||
KeAcquireSpinLockAtDpcLevel(&DpcQueueLock);
|
||||
InsertHeadList(&DpcQueueHead,&Dpc->DpcListEntry);
|
||||
DPRINT("Dpc->DpcListEntry.Flink %x\n", Dpc->DpcListEntry.Flink);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: pageop.c,v 1.5 2001/04/04 22:21:31 dwelch Exp $
|
||||
/* $Id: pageop.c,v 1.6 2002/01/09 03:00:21 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -23,7 +23,7 @@
|
|||
#define PAGEOP_HASH_TABLE_SIZE (32)
|
||||
|
||||
KSPIN_LOCK MmPageOpHashTableLock;
|
||||
PMM_PAGEOP MmPageOpHashTable[PAGEOP_HASH_TABLE_SIZE];
|
||||
PMM_PAGEOP MmPageOpHashTable[PAGEOP_HASH_TABLE_SIZE] = {NULL, } ;
|
||||
|
||||
#define TAG_MM_PAGEOP TAG('M', 'P', 'O', 'P')
|
||||
|
||||
|
@ -38,13 +38,13 @@ MmReleasePageOp(PMM_PAGEOP PageOp)
|
|||
KIRQL oldIrql;
|
||||
PMM_PAGEOP PrevPageOp;
|
||||
|
||||
KeAcquireSpinLock(&MmPageOpHashTableLock, &oldIrql);
|
||||
PageOp->ReferenceCount--;
|
||||
if (PageOp->ReferenceCount > 0)
|
||||
{
|
||||
KeReleaseSpinLock(&MmPageOpHashTableLock, oldIrql);
|
||||
return;
|
||||
}
|
||||
|
||||
KeAcquireSpinLock(&MmPageOpHashTableLock, &oldIrql);
|
||||
PrevPageOp = MmPageOpHashTable[PageOp->Hash];
|
||||
if (PrevPageOp == PageOp)
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: section.c,v 1.75 2002/01/08 00:49:00 dwelch Exp $
|
||||
/* $Id: section.c,v 1.76 2002/01/09 03:00:21 dwelch Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/mm/section.c
|
||||
|
@ -1226,7 +1226,8 @@ MmPageOutSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
Context.Segment = Segment;
|
||||
Context.Offset = Offset;
|
||||
Context.WasDirty = FALSE;
|
||||
if (IS_SWAP_FROM_SSE(Entry) ||
|
||||
if (Segment->Characteristics & IMAGE_SECTION_CHAR_BSS ||
|
||||
IS_SWAP_FROM_SSE(Entry) ||
|
||||
(PVOID)(PAGE_FROM_SSE(Entry)) != PhysicalAddress)
|
||||
{
|
||||
Context.Private = Private = TRUE;
|
||||
|
@ -1319,7 +1320,8 @@ MmPageOutSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
}
|
||||
if (Private)
|
||||
{
|
||||
if (SwapEntry == 0)
|
||||
if (!(Segment->Characteristics & IMAGE_SECTION_CHAR_BSS) &&
|
||||
SwapEntry == 0)
|
||||
{
|
||||
DPRINT1("Private page, non-dirty but not swapped out "
|
||||
"process %d address 0x%.8X\n",
|
||||
|
@ -1396,6 +1398,9 @@ MmPageOutSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
(ULONG)PhysicalAddress,
|
||||
FALSE);
|
||||
MmSetDirtyPage(MemoryArea->Process, Address);
|
||||
MmInsertRmap(PhysicalAddress,
|
||||
MemoryArea->Process,
|
||||
Address);
|
||||
MmSetPageEntrySectionSegment(Segment, Offset.QuadPart,
|
||||
(ULONG)PhysicalAddress);
|
||||
MmSharePageEntrySectionSegment(Segment, Offset.QuadPart);
|
||||
|
@ -1441,6 +1446,9 @@ MmPageOutSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
(ULONG)PhysicalAddress,
|
||||
FALSE);
|
||||
MmSetDirtyPage(MemoryArea->Process, Address);
|
||||
MmInsertRmap(PhysicalAddress,
|
||||
MemoryArea->Process,
|
||||
Address);
|
||||
MmSetPageEntrySectionSegment(Segment, Offset.QuadPart,
|
||||
(ULONG)PhysicalAddress);
|
||||
MmSharePageEntrySectionSegment(Segment, Offset.QuadPart);
|
||||
|
@ -2579,11 +2587,15 @@ MmFreeSectionPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address, ULONG P
|
|||
|
||||
Entry = MmGetPageEntrySectionSegment(MArea->Data.SectionData.Segment,
|
||||
Offset);
|
||||
/*
|
||||
* Just dereference private pages
|
||||
*/
|
||||
if (PhysAddr != (Entry & 0xFFFFF000))
|
||||
{
|
||||
if (IS_SWAP_FROM_SSE(Entry))
|
||||
{
|
||||
KeBugCheck(0);
|
||||
}
|
||||
else if (PhysAddr != (PAGE_FROM_SSE(Entry)))
|
||||
{
|
||||
/*
|
||||
* Just dereference private pages
|
||||
*/
|
||||
MmDeleteRmap((PVOID)PhysAddr, MArea->Process, Address);
|
||||
MmDereferencePage((PVOID)PhysAddr);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: virtual.c,v 1.54 2002/01/08 00:49:01 dwelch Exp $
|
||||
/* $Id: virtual.c,v 1.55 2002/01/09 03:00:21 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -119,6 +119,11 @@ MmPageOutVirtualMemory(PMADDRESS_SPACE AddressSpace,
|
|||
MmDeleteVirtualMapping(MemoryArea->Process, Address, FALSE,
|
||||
NULL, (PULONG)&PhysicalAddress);
|
||||
MmDeleteAllRmaps(PhysicalAddress, NULL, NULL);
|
||||
if (MmGetSavedSwapEntryPage(PhysicalAddress) != 0)
|
||||
{
|
||||
DPRINT1("Read-only page was swapped out.\n");
|
||||
KeBugCheck(0);
|
||||
}
|
||||
MmReleasePageMemoryConsumer(MC_USER, PhysicalAddress);
|
||||
|
||||
PageOp->Status = STATUS_SUCCESS;
|
||||
|
@ -140,6 +145,11 @@ MmPageOutVirtualMemory(PMADDRESS_SPACE AddressSpace,
|
|||
{
|
||||
MmDeleteVirtualMapping(MemoryArea->Process, Address, FALSE, NULL, NULL);
|
||||
MmDeleteAllRmaps(PhysicalAddress, NULL, NULL);
|
||||
if ((SwapEntry = MmGetSavedSwapEntryPage(PhysicalAddress)) != 0)
|
||||
{
|
||||
MmCreatePageFileMapping(MemoryArea->Process, Address, SwapEntry);
|
||||
MmSetSavedSwapEntryPage(PhysicalAddress, 0);
|
||||
}
|
||||
MmReleasePageMemoryConsumer(MC_USER, PhysicalAddress);
|
||||
PageOp->Status = STATUS_SUCCESS;
|
||||
KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE);
|
||||
|
|
Loading…
Reference in a new issue