diff options
author | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
---|---|---|
committer | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
commit | e611b132f9b8abe35b362e5870b74bce94a1e58e (patch) | |
tree | a5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/ntos/mm/alpha/setdirty.c | |
download | NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2 NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip |
Diffstat (limited to 'private/ntos/mm/alpha/setdirty.c')
-rw-r--r-- | private/ntos/mm/alpha/setdirty.c | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/private/ntos/mm/alpha/setdirty.c b/private/ntos/mm/alpha/setdirty.c new file mode 100644 index 000000000..df73963a7 --- /dev/null +++ b/private/ntos/mm/alpha/setdirty.c @@ -0,0 +1,126 @@ +/*++ + +Copyright (c) 1989 Microsoft Corporation +Copyright (c) 1992 Digital Equipment Corporation + +Module Name: + + setdirty.c + +Abstract: + + This module contains the setting dirty bit routine for memory management. + + ALPHA specific. + +Author: + + Lou Perazzoli (loup) 10-Apr-1990. + Joe Notarangelo 23-Apr-1992 ALPHA version + +Revision History: + +--*/ + +#include "mi.h" + +VOID +MiSetDirtyBit ( + IN PVOID FaultingAddress, + IN PMMPTE PointerPte, + IN ULONG PfnHeld + ) + +/*++ + +Routine Description: + + This routine sets dirty in the specified PTE and the modify bit in the + correpsonding PFN element. If any page file space is allocated, it + is deallocated. + +Arguments: + + FaultingAddress - Supplies the faulting address. + + PointerPte - Supplies a pointer to the corresponding valid PTE. + + PfnHeld - Supplies TRUE if the PFN mutex is already held. + +Return Value: + + None. + +Environment: + + Kernel mode, APC's disabled, Working set mutex held. + +--*/ + +{ + MMPTE TempPte; + ULONG PageFrameIndex; + PMMPFN Pfn1; + KIRQL OldIrql; + + // + // The TB entry must be flushed as the valid PTE with the dirty bit clear + // has been fetched into the TB. If it isn't flushed, another fault + // is generated as the dirty bit is not set in the cached TB entry. + // + + // KiFlushSingleDataTb( FaultingAddress ); + __dtbis( FaultingAddress ); + + // + // The page is NOT copy on write, update the PTE setting both the + // dirty bit and the accessed bit. Note, that as this PTE is in + // the TB, the TB must be flushed. + // + + PageFrameIndex = PointerPte->u.Hard.PageFrameNumber; + Pfn1 = MI_PFN_ELEMENT (PageFrameIndex); + + TempPte = *PointerPte; + TempPte.u.Hard.Dirty = 1; + MI_SET_ACCESSED_IN_PTE (&TempPte, 1); + *PointerPte = TempPte; + + // + // If PFN database lock is not held, then do not update the + // PFN database. + // + + if( PfnHeld ){ + + // + // Set the modified field in the PFN database, also, if the phyiscal + // page is currently in a paging file, free up the page file space + // as the contents are now worthless. + // + + if ( (Pfn1->OriginalPte.u.Soft.Prototype == 0) && + (Pfn1->u3.e1.WriteInProgress == 0) ) { + + // + // This page is in page file format, deallocate the page file space. + // + + MiReleasePageFileSpace (Pfn1->OriginalPte); + + // + // Change original PTE to indicate no page file space is reserved, + // otherwise the space will be deallocated when the PTE is + // deleted. + // + + Pfn1->OriginalPte.u.Soft.PageFileHigh = 0; + } + + Pfn1->u3.e1.Modified = 1; + + } + + + return; +} |