Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

setmodfy.c File Reference

#include "mi.h"

Go to the source code of this file.

Functions

VOID MiSetModifyBit (IN PMMPFN Pfn)
ULONG FASTCALL MiDetermineUserGlobalPteMask (IN PMMPTE Pte)
VOID MiSetDirtyBit (IN PVOID FaultingAddress, IN PMMPTE PointerPte, IN ULONG PfnHeld)


Function Documentation

ULONG FASTCALL MiDetermineUserGlobalPteMask IN PMMPTE  Pte  ) 
 

Definition at line 84 of file setmodfy.c.

References FALSE, MI_IS_SESSION_PTE, MiGetPdeAddress, MiGetPteAddress, MiHighestUserPde, MiHighestUserPte, MM_SYSTEM_CACHE_WORKING_SET, MmPteGlobal, NULL, PDE_TOP, and _MMPTE::u.

Referenced by MiInitMachineDependent().

00090 : 00091 00092 Builds a mask to OR with the PTE frame field. 00093 This mask has the valid and access bits set and 00094 has the global and owner bits set based on the 00095 address of the PTE. 00096 00097 ******************* NOTE ********************************************* 00098 THIS ROUTINE DOES NOT CHECK FOR PDEs WHICH NEED TO BE 00099 SET GLOBAL AS IT ASSUMES PDEs FOR SYSTEM SPACE ARE 00100 PROPERLY SET AT INITIALIZATION TIME! 00101 00102 Arguments: 00103 00104 Pte - Supplies a pointer to the PTE in which to fill. 00105 00106 Return Value: 00107 00108 Mask to OR into the frame to make a valid PTE. 00109 00110 Environment: 00111 00112 Kernel mode, 386 specific. 00113 00114 --*/ 00115 00116 00117 { 00118 MMPTE Mask; 00119 00120 Mask.u.Long = 0; 00121 Mask.u.Hard.Valid = 1; 00122 Mask.u.Hard.Accessed = 1; 00123 00124 if (Pte <= MiHighestUserPte) { 00125 Mask.u.Hard.Owner = 1; 00126 } else if ((Pte < MiGetPteAddress (PTE_BASE)) || 00127 (Pte >= MiGetPteAddress (MM_SYSTEM_CACHE_WORKING_SET))) { 00128 if (MI_IS_SESSION_PTE (Pte) == FALSE) { 00129 #if defined (_X86PAE_) 00130 if ((Pte < (PMMPTE)PDE_BASE) || (Pte > (PMMPTE)PDE_TOP)) 00131 #endif 00132 Mask.u.Long |= MmPteGlobal.u.Long; 00133 } 00134 } else if ((Pte >= MiGetPdeAddress (NULL)) && (Pte <= MiHighestUserPde)) { 00135 Mask.u.Hard.Owner = 1; 00136 } 00137 00138 // 00139 // Since the valid, accessed, global and owner bits are always in the 00140 // low dword of the PTE, returning a ULONG is ok. 00141 // 00142 00143 return (ULONG)Mask.u.Long; 00144 }

VOID MiSetDirtyBit IN PVOID  FaultingAddress,
IN PMMPTE  PointerPte,
IN ULONG  PfnHeld
 

Definition at line 152 of file setmodfy.c.

References MI_GET_PAGE_FRAME_FROM_PTE, MI_PFN_ELEMENT, MI_SET_ACCESSED_IN_PTE, MI_SET_PTE_DIRTY, MI_WRITE_VALID_PTE_NEW_PROTECTION, MiReleasePageFileSpace(), _MMPFN::OriginalPte, TRUE, _MMPTE::u, and _MMPFN::u3.

00160 : 00161 00162 This routine sets dirty in the specified PTE and the modify bit in the 00163 corresponding PFN element. If any page file space is allocated, it 00164 is deallocated. 00165 00166 Arguments: 00167 00168 FaultingAddress - Supplies the faulting address. 00169 00170 PointerPte - Supplies a pointer to the corresponding valid PTE. 00171 00172 PfnHeld - Supplies TRUE if the PFN lock is already held. 00173 00174 Return Value: 00175 00176 None. 00177 00178 Environment: 00179 00180 Kernel mode, APCs disabled, Working set mutex held. 00181 00182 --*/ 00183 00184 { 00185 MMPTE TempPte; 00186 ULONG PageFrameIndex; 00187 PMMPFN Pfn1; 00188 00189 // 00190 // The page is NOT copy on write, update the PTE setting both the 00191 // dirty bit and the accessed bit. Note, that as this PTE is in 00192 // the TB, the TB must be flushed. 00193 // 00194 00195 TempPte = *PointerPte; 00196 MI_SET_PTE_DIRTY (TempPte); 00197 MI_SET_ACCESSED_IN_PTE (&TempPte, 1); 00198 MI_WRITE_VALID_PTE_NEW_PROTECTION(PointerPte, TempPte); 00199 00200 // 00201 // Check state of PFN lock and if not held, don't update PFN database. 00202 // 00203 00204 if (PfnHeld) { 00205 00206 PageFrameIndex = MI_GET_PAGE_FRAME_FROM_PTE(PointerPte); 00207 Pfn1 = MI_PFN_ELEMENT (PageFrameIndex); 00208 00209 // 00210 // Set the modified field in the PFN database, also, if the physical 00211 // page is currently in a paging file, free up the page file space 00212 // as the contents are now worthless. 00213 // 00214 00215 if ((Pfn1->OriginalPte.u.Soft.Prototype == 0) && 00216 (Pfn1->u3.e1.WriteInProgress == 0)) { 00217 00218 // 00219 // This page is in page file format, deallocate the page file space. 00220 // 00221 00222 MiReleasePageFileSpace (Pfn1->OriginalPte); 00223 00224 // 00225 // Change original PTE to indicate no page file space is reserved, 00226 // otherwise the space will be deallocated when the PTE is 00227 // deleted. 00228 // 00229 00230 Pfn1->OriginalPte.u.Soft.PageFileHigh = 0; 00231 } 00232 00233 Pfn1->u3.e1.Modified = 1; 00234 } 00235 00236 // 00237 // The TB entry must be flushed as the valid PTE with the dirty bit clear 00238 // has been fetched into the TB. If it isn't flushed, another fault 00239 // is generated as the dirty bit is not set in the cached TB entry. 00240 // 00241 00242 KeFillEntryTb ((PHARDWARE_PTE)PointerPte, FaultingAddress, TRUE); 00243 return; 00244 } #endif

VOID MiSetModifyBit IN PMMPFN  Pfn  ) 
 

Definition at line 26 of file setmodfy.c.

References MiReleasePageFileSpace().

00032 : 00033 00034 This routine sets the modify bit in the specified PFN element 00035 and deallocates and allocated page file space. 00036 00037 Arguments: 00038 00039 Pfn - Supplies the pointer to the PFN element to update. 00040 00041 Return Value: 00042 00043 None. 00044 00045 Environment: 00046 00047 Kernel mode, APCs disabled, Working set mutex held and PFN lock held. 00048 00049 --*/ 00050 00051 { 00052 00053 // 00054 // Set the modified field in the PFN database, also, if the physical 00055 // page is currently in a paging file, free up the page file space 00056 // as the contents are now worthless. 00057 // 00058 00059 Pfn->u3.e1.Modified = 1; 00060 00061 if (Pfn->OriginalPte.u.Soft.Prototype == 0) { 00062 00063 // 00064 // This page is in page file format, deallocate the page file space. 00065 // 00066 00067 MiReleasePageFileSpace (Pfn->OriginalPte); 00068 00069 // 00070 // Change original PTE to indicate no page file space is reserved, 00071 // otherwise the space will be deallocated when the PTE is 00072 // deleted. 00073 // 00074 00075 Pfn->OriginalPte.u.Soft.PageFileHigh = 0; 00076 } 00077 00078 00079 return; 00080 }


Generated on Sat May 15 19:45:38 2004 for test by doxygen 1.3.7