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

wstree.c File Reference

#include "mi.h"

Go to the source code of this file.

Functions

ULONG MiLookupWsleHashIndex (IN ULONG_PTR WsleEntry, IN PMMWSL WorkingSetList)
VOID MiCheckWsleHash (IN PMMWSL WorkingSetList)
VOID FASTCALL MiInsertWsle (IN WSLE_NUMBER Entry, IN PMMWSL WorkingSetList)
WSLE_NUMBER FASTCALL MiLocateWsle (IN PVOID VirtualAddress, IN PMMWSL WorkingSetList, IN WSLE_NUMBER WsPfnIndex)
VOID FASTCALL MiRemoveWsle (IN WSLE_NUMBER Entry, IN PMMWSL WorkingSetList)
VOID MiSwapWslEntries (IN WSLE_NUMBER SwapEntry, IN WSLE_NUMBER Entry, IN PMMSUPPORT WsInfo)
VOID MiRemoveWsleFromFreeList (IN ULONG Entry, IN PMMWSLE Wsle, IN PMMWSL WorkingSetList)

Variables

ULONG MmSystemCodePage
ULONG MmSystemCachePage
ULONG MmPagedPoolPage
ULONG MmSystemDriverPage


Function Documentation

VOID MiCheckWsleHash IN PMMWSL  WorkingSetList  ) 
 

Referenced by MiGrowWsleHash(), and MiInsertWsle().

VOID FASTCALL MiInsertWsle IN WSLE_NUMBER  Entry,
IN PMMWSL  WorkingSetList
 

Definition at line 51 of file wstree.c.

References _MMSUPPORT::AllowWorkingSetAdjustment, ASSERT, DbgPrint, _MMWSLENTRY::Direct, _MMWSLE::e1, _MMWSLE_HASH::Index, Index, KeQueryTickCount(), Key, _MMWSLE_HASH::Key, LOCK_EXPANSION_IF_ALPHA, _MMWSLE::Long, MI_WSLE_HASH, MiCheckWsleHash(), MiFreeWsle(), MiGetPteAddress, MM_DBG_PTE_UPDATE, MM_GROW_WSLE_HASH, MmSessionSpace, MmSystemCacheWorkingSetList, MmSystemCacheWs, MmWorkingSetList, NULL, PAGE_ALIGN, PAGE_SIZE, PERFINFO_GET_PAGE_INFO, PERFINFO_LOG_WS_REMOVAL, PERFINFO_PAGE_INFO_DECL, PsGetCurrentProcess, Size, TickCount(), TRUE, _MMSUPPORT::u, _MMWSLE::u1, UNLOCK_EXPANSION_IF_ALPHA, _MMWSLENTRY::Valid, _MMWSLE::VirtualAddress, _MM_SESSION_SPACE::Vm, and WSLE_NUMBER.

Referenced by MiRemoveWorkingSetPages(), and MiUpdateWsle().

00058 : 00059 00060 This routine inserts a Working Set List Entry (WSLE) into the 00061 working set. 00062 00063 Arguments: 00064 00065 Entry - The index number of the WSLE to insert. 00066 00067 WorkingSetList - Supplies the working set list to insert into. 00068 00069 Return Value: 00070 00071 None. 00072 00073 Environment: 00074 00075 Kernel mode, APCs disabled, Working Set Mutex held. 00076 00077 --*/ 00078 00079 { 00080 PVOID VirtualAddress; 00081 PMMWSLE Wsle; 00082 PMMSUPPORT WsInfo; 00083 WSLE_NUMBER Hash; 00084 PMMWSLE_HASH Table; 00085 WSLE_NUMBER j; 00086 PMMPTE PointerPte; 00087 WSLE_NUMBER Index; 00088 LARGE_INTEGER TickCount; 00089 ULONG Size; 00090 #if defined(_ALPHA_) && !defined(_AXP64_) 00091 KIRQL OldIrql; 00092 #endif 00093 00094 Wsle = WorkingSetList->Wsle; 00095 00096 VirtualAddress = PAGE_ALIGN(Wsle[Entry].u1.VirtualAddress); 00097 00098 #if DBG 00099 if (MmDebug & MM_DBG_PTE_UPDATE) { 00100 DbgPrint("inserting element %lx %lx\n", Entry, Wsle[Entry].u1.Long); 00101 } 00102 00103 ASSERT (Wsle[Entry].u1.e1.Valid == 1); 00104 ASSERT (Wsle[Entry].u1.e1.Direct != 1); 00105 #endif //DBG 00106 00107 WorkingSetList->NonDirectCount += 1; 00108 00109 if ((Table = WorkingSetList->HashTable) == NULL) { 00110 return; 00111 } 00112 00113 #if DBG 00114 MmNumberOfInserts += 1; 00115 #endif //DBG 00116 00117 Hash = MI_WSLE_HASH(Wsle[Entry].u1.Long, WorkingSetList); 00118 00119 // 00120 // Check hash table size and see if there is enough room to 00121 // hash or if the table should be grown. 00122 // 00123 00124 if ((WorkingSetList->NonDirectCount + 10 + 00125 (WorkingSetList->HashTableSize >> 4)) > 00126 WorkingSetList->HashTableSize) { 00127 00128 if (WorkingSetList == MmWorkingSetList) { 00129 WsInfo = &PsGetCurrentProcess()->Vm; 00130 ASSERT (WsInfo->u.Flags.SessionSpace == 0); 00131 } 00132 else if (WorkingSetList == MmSystemCacheWorkingSetList) { 00133 WsInfo = &MmSystemCacheWs; 00134 ASSERT (WsInfo->u.Flags.SessionSpace == 0); 00135 } 00136 else { 00137 WsInfo = &MmSessionSpace->Vm; 00138 ASSERT (WsInfo->u.Flags.SessionSpace == 1); 00139 } 00140 00141 if ((Table + WorkingSetList->HashTableSize + ((2*PAGE_SIZE) / sizeof (MMWSLE_HASH)) <= (PMMWSLE_HASH)WorkingSetList->HighestPermittedHashAddress) && 00142 (WsInfo->AllowWorkingSetAdjustment)) { 00143 00144 #if defined(_ALPHA_) && !defined(_AXP64_) 00145 LOCK_EXPANSION_IF_ALPHA (OldIrql); 00146 #endif 00147 WsInfo->AllowWorkingSetAdjustment = MM_GROW_WSLE_HASH; 00148 #if defined(_ALPHA_) && !defined(_AXP64_) 00149 UNLOCK_EXPANSION_IF_ALPHA (OldIrql); 00150 #endif 00151 } 00152 00153 if ((WorkingSetList->NonDirectCount + 00154 (WorkingSetList->HashTableSize >> 4)) > 00155 WorkingSetList->HashTableSize) { 00156 00157 // 00158 // No more room in the hash table, remove one and add there. 00159 // Pick a victim within 16 of where this would hash to. 00160 // 00161 00162 KeQueryTickCount(&TickCount); 00163 j = Hash + (TickCount.LowPart & 0xF); 00164 00165 Size = WorkingSetList->HashTableSize; 00166 00167 if (j >= Size) { 00168 j = TickCount.LowPart & 0xF; 00169 } 00170 00171 do { 00172 if (Table[j].Key != 0) { 00173 PERFINFO_PAGE_INFO_DECL(); 00174 00175 PointerPte = MiGetPteAddress (Table[j].Key); 00176 Index = WorkingSetList->HashTable[j].Index; 00177 ASSERT (Wsle[Index].u1.e1.Valid == 1); 00178 PointerPte = MiGetPteAddress (Wsle[Index].u1.VirtualAddress); 00179 00180 PERFINFO_GET_PAGE_INFO(PointerPte); 00181 if (MiFreeWsle (Index, WsInfo, PointerPte)) { 00182 PERFINFO_LOG_WS_REMOVAL(PERFINFO_LOG_TYPE_OUTWS_HASHFULL, WsInfo); 00183 break; 00184 } 00185 } 00186 j += 1; 00187 if (j >= Size) { 00188 j = 0; 00189 } 00190 } while (TRUE); 00191 } 00192 } 00193 00194 // 00195 // Add to the hash table. 00196 // 00197 00198 while (Table[Hash].Key != 0) { 00199 Hash += 1; 00200 if (Hash >= WorkingSetList->HashTableSize) { 00201 Hash = 0; 00202 } 00203 } 00204 00205 Table[Hash].Key = Wsle[Entry].u1.Long & ~(PAGE_SIZE - 1); 00206 Table[Hash].Index = Entry; 00207 00208 #if DBG 00209 if ((MmNumberOfInserts % 1000) == 0) { 00210 MiCheckWsleHash (WorkingSetList); 00211 } 00212 #endif //DBG 00213 return; 00214 }

WSLE_NUMBER FASTCALL MiLocateWsle IN PVOID  VirtualAddress,
IN PMMWSL  WorkingSetList,
IN WSLE_NUMBER  WsPfnIndex
 

Definition at line 248 of file wstree.c.

References ASSERT, _MMWSLE_HASH::Index, KeBugCheckEx(), _MMWSLE_HASH::Key, MI_GET_WORKING_SET_FROM_PTE, MI_MAXIMUM_PTE_WORKING_SET_INDEX, MI_WSLE_HASH, MiGetPteAddress, PAGE_ALIGN, _MMPTE::u, _MMWSLE::u1, _MMWSLE::VirtualAddress, and WSLE_NUMBER.

Referenced by MiAllocatePoolPages(), MiCloneProcessAddressSpace(), MiCopyOnWrite(), MiDecommitPages(), MiDeleteAddressesInWorkingSet(), MiDeletePte(), MiDeleteSystemPagableVm(), MiGetPageProtection(), MiLockCode(), MiRemoveMappedPtes(), MiRemovePageFromWorkingSet(), MiSessionCommitPageTables(), MiSessionCopyOnWrite(), MiSetProtectionOnSection(), MmUnmapViewInSystemCache(), NtLockVirtualMemory(), and NtUnlockVirtualMemory().

00256 : 00257 00258 This function locates the specified virtual address within the 00259 working set list. 00260 00261 Arguments: 00262 00263 VirtualAddress - Supplies the virtual to locate within the working 00264 set list. 00265 00266 WorkingSetList - Supplies the working set list to search. 00267 00268 WsPfnIndex - Supplies a hint to try before hashing or walking linearly. 00269 00270 Return Value: 00271 00272 Returns the index into the working set list which contains the entry. 00273 00274 Environment: 00275 00276 Kernel mode, APCs disabled, Working Set Mutex held. 00277 00278 --*/ 00279 00280 { 00281 WSLE_NUMBER i; 00282 PMMWSLE Wsle; 00283 ULONG Hash; 00284 PMMWSLE_HASH Table; 00285 ULONG Tries; 00286 WSLE_NUMBER WsPteIndex; 00287 PMMPTE PointerPte; 00288 00289 Wsle = WorkingSetList->Wsle; 00290 00291 VirtualAddress = PAGE_ALIGN(VirtualAddress); 00292 00293 #if defined (_WIN64) 00294 PointerPte = MiGetPteAddress (VirtualAddress); 00295 WsPteIndex = MI_GET_WORKING_SET_FROM_PTE (PointerPte); 00296 if (WsPteIndex != 0) { 00297 while (WsPteIndex <= WorkingSetList->LastInitializedWsle) { 00298 if ((VirtualAddress == PAGE_ALIGN(Wsle[WsPteIndex].u1.VirtualAddress)) && 00299 (Wsle[WsPteIndex].u1.e1.Valid == 1)) { 00300 return WsPteIndex; 00301 } 00302 WsPteIndex += MI_MAXIMUM_PTE_WORKING_SET_INDEX; 00303 } 00304 00305 // 00306 // No working set index for this PTE ! 00307 // 00308 00309 KeBugCheckEx (MEMORY_MANAGEMENT, 00310 0x41283, 00311 (ULONG_PTR)VirtualAddress, 00312 PointerPte->u.Long, 00313 (ULONG_PTR)WorkingSetList); 00314 } 00315 #endif 00316 00317 if (WsPfnIndex <= WorkingSetList->LastInitializedWsle) { 00318 if ((VirtualAddress == PAGE_ALIGN(Wsle[WsPfnIndex].u1.VirtualAddress)) && 00319 (Wsle[WsPfnIndex].u1.e1.Valid == 1)) { 00320 return WsPfnIndex; 00321 } 00322 } 00323 00324 if (WorkingSetList->HashTable) { 00325 Tries = 0; 00326 Table = WorkingSetList->HashTable; 00327 00328 Hash = MI_WSLE_HASH(VirtualAddress, WorkingSetList); 00329 00330 while (Table[Hash].Key != (ULONG_PTR)VirtualAddress) { 00331 Hash += 1; 00332 if (Hash >= WorkingSetList->HashTableSize) { 00333 Hash = 0; 00334 if (Tries != 0) { 00335 KeBugCheckEx (MEMORY_MANAGEMENT, 00336 0x41284, 00337 (ULONG_PTR)VirtualAddress, 00338 WsPfnIndex, 00339 (ULONG_PTR)WorkingSetList); 00340 } 00341 Tries = 1; 00342 } 00343 } 00344 ASSERT (WorkingSetList->Wsle[Table[Hash].Index].u1.e1.Direct == 0); 00345 return Table[Hash].Index; 00346 } 00347 00348 i = 0; 00349 00350 for (; ; ) { 00351 if ((VirtualAddress == PAGE_ALIGN(Wsle[i].u1.VirtualAddress)) && 00352 (Wsle[i].u1.e1.Valid == 1)) { 00353 ASSERT (WorkingSetList->Wsle[i].u1.e1.Direct == 0); 00354 return i; 00355 } 00356 i += 1; 00357 } 00358 }

ULONG MiLookupWsleHashIndex IN ULONG_PTR  WsleEntry,
IN PMMWSL  WorkingSetList
 

Definition at line 765 of file wstree.c.

References KeBugCheckEx(), _MMWSLE_HASH::Key, MI_WSLE_HASH, and PAGE_SIZE.

Referenced by MiSwapWslEntries().

00770 { 00771 ULONG Hash; 00772 ULONG_PTR VirtualAddress; 00773 PMMWSLE_HASH Table; 00774 ULONG Tries = 0; 00775 00776 Table = WorkingSetList->HashTable; 00777 VirtualAddress = WsleEntry & ~(PAGE_SIZE - 1); 00778 00779 Hash = MI_WSLE_HASH(WsleEntry, WorkingSetList); 00780 00781 while (Table[Hash].Key != (ULONG_PTR)VirtualAddress) { 00782 Hash += 1; 00783 if (Hash >= WorkingSetList->HashTableSize) { 00784 Hash = 0; 00785 if (Tries != 0) { 00786 KeBugCheckEx (MEMORY_MANAGEMENT, 00787 0x41884, 00788 (ULONG_PTR)VirtualAddress, 00789 WsleEntry, 00790 (ULONG_PTR)WorkingSetList); 00791 } 00792 Tries = 1; 00793 } 00794 } 00795 return Hash; 00796 }

VOID FASTCALL MiRemoveWsle IN WSLE_NUMBER  Entry,
IN PMMWSL  WorkingSetList
 

Definition at line 464 of file wstree.c.

References ASSERT, DbgPrint, _MMWSLE::e1, KeBugCheckEx(), _MMWSLE_HASH::Key, _MMWSLE::Long, MI_IS_SYSTEM_CACHE_ADDRESS, MI_WSLE_HASH, MiDumpWsl(), MM_DBG_DUMP_WSL, MM_DBG_PTE_UPDATE, MM_PAGED_POOL_START, MmNonPagedSystemStart, MmPagedPoolPage, MmSystemCachePage, MmSystemCacheStart, MmSystemCacheWorkingSetList, MmSystemCodePage, MmSystemDriverPage, PAGE_ALIGN, _MMWSLE::u1, _MMWSLENTRY::Valid, and _MMWSLE::VirtualAddress.

Referenced by MiDecommitPages(), MiDeletePte(), MiDeleteSystemPagableVm(), MiFreeWsle(), MiLockCode(), MiRemoveMappedPtes(), MiRemovePageFromWorkingSet(), MiRemoveWorkingSetPages(), and MmUnmapViewInSystemCache().

00471 : 00472 00473 This routine removes a Working Set List Entry (WSLE) from the 00474 working set. 00475 00476 Arguments: 00477 00478 Entry - The index number of the WSLE to remove. 00479 00480 00481 Return Value: 00482 00483 None. 00484 00485 Environment: 00486 00487 Kernel mode, APCs disabled, Working Set Mutex held. 00488 00489 --*/ 00490 { 00491 PMMWSLE Wsle; 00492 PVOID VirtualAddress; 00493 PMMWSLE_HASH Table; 00494 ULONG Hash; 00495 ULONG Tries; 00496 00497 Wsle = WorkingSetList->Wsle; 00498 00499 // 00500 // Locate the entry in the tree. 00501 // 00502 00503 #if DBG 00504 if (MmDebug & MM_DBG_PTE_UPDATE) { 00505 DbgPrint("removing wsle %lx %lx\n", 00506 Entry, Wsle[Entry].u1.Long); 00507 } 00508 if (MmDebug & MM_DBG_DUMP_WSL) { 00509 MiDumpWsl(); 00510 DbgPrint(" \n"); 00511 } 00512 00513 #endif //DBG 00514 00515 ASSERT (Wsle[Entry].u1.e1.Valid == 1); 00516 00517 VirtualAddress = PAGE_ALIGN (Wsle[Entry].u1.VirtualAddress); 00518 00519 if (WorkingSetList == MmSystemCacheWorkingSetList) { 00520 00521 // 00522 // count system space inserts and removals. 00523 // 00524 00525 #if defined(_X86_) 00526 if (MI_IS_SYSTEM_CACHE_ADDRESS(VirtualAddress)) { 00527 MmSystemCachePage -= 1; 00528 } else 00529 #endif 00530 if (VirtualAddress < MmSystemCacheStart) { 00531 MmSystemCodePage -= 1; 00532 } else if (VirtualAddress < MM_PAGED_POOL_START) { 00533 MmSystemCachePage -= 1; 00534 } else if (VirtualAddress < MmNonPagedSystemStart) { 00535 MmPagedPoolPage -= 1; 00536 } else { 00537 MmSystemDriverPage -= 1; 00538 } 00539 } 00540 00541 Wsle[Entry].u1.e1.Valid = 0; 00542 00543 if (Wsle[Entry].u1.e1.Direct == 0) { 00544 00545 WorkingSetList->NonDirectCount -= 1; 00546 00547 if (WorkingSetList->HashTable) { 00548 Hash = MI_WSLE_HASH(Wsle[Entry].u1.Long, WorkingSetList); 00549 Table = WorkingSetList->HashTable; 00550 Tries = 0; 00551 00552 while (Table[Hash].Key != (ULONG_PTR)VirtualAddress) { 00553 Hash += 1; 00554 if (Hash >= WorkingSetList->HashTableSize) { 00555 Hash = 0; 00556 if (Tries != 0) { 00557 KeBugCheckEx (MEMORY_MANAGEMENT, 00558 0x41784, 00559 (ULONG_PTR)VirtualAddress, 00560 Entry, 00561 (ULONG_PTR)WorkingSetList); 00562 } 00563 Tries = 1; 00564 } 00565 } 00566 Table[Hash].Key = 0; 00567 00568 } 00569 } 00570 00571 return; 00572 }

VOID MiRemoveWsleFromFreeList IN ULONG  Entry,
IN PMMWSLE  Wsle,
IN PMMWSL  WorkingSetList
 

Definition at line 799 of file wstree.c.

References ASSERT, MM_FREE_WSLE_SHIFT, WSLE_NULL_INDEX, and WSLE_NUMBER.

Referenced by MiSwapWslEntries().

00807 : 00808 00809 This routine removes a working set list entry from the free list. 00810 It is used when the entry required is not the first element 00811 in the free list. 00812 00813 Arguments: 00814 00815 Entry - Supplies the index of the entry to remove. 00816 00817 Wsle - Supplies a pointer to the array of WSLEs. 00818 00819 WorkingSetList - Supplies a pointer to the working set list. 00820 00821 Return Value: 00822 00823 None. 00824 00825 Environment: 00826 00827 Kernel mode, Working set lock and PFN lock held, APCs disabled. 00828 00829 --*/ 00830 00831 { 00832 WSLE_NUMBER Free; 00833 WSLE_NUMBER ParentFree; 00834 00835 Free = WorkingSetList->FirstFree; 00836 00837 if (Entry == Free) { 00838 ASSERT ((Wsle[Entry].u1.Long >> MM_FREE_WSLE_SHIFT) <= WorkingSetList->LastInitializedWsle); 00839 WorkingSetList->FirstFree = (WSLE_NUMBER)(Wsle[Entry].u1.Long >> MM_FREE_WSLE_SHIFT); 00840 00841 } else { 00842 do { 00843 ParentFree = Free; 00844 ASSERT (Wsle[Free].u1.e1.Valid == 0); 00845 Free = (WSLE_NUMBER)(Wsle[Free].u1.Long >> MM_FREE_WSLE_SHIFT); 00846 } while (Free != Entry); 00847 00848 Wsle[ParentFree].u1.Long = Wsle[Entry].u1.Long; 00849 } 00850 ASSERT ((WorkingSetList->FirstFree <= WorkingSetList->LastInitializedWsle) || 00851 (WorkingSetList->FirstFree == WSLE_NULL_INDEX)); 00852 return; 00853 }

VOID MiSwapWslEntries IN WSLE_NUMBER  SwapEntry,
IN WSLE_NUMBER  Entry,
IN PMMSUPPORT  WsInfo
 

Definition at line 576 of file wstree.c.

References ASSERT, _MMWSL::FirstFree, _MMWSL::HashTable, _MMWSLE_HASH::Index, _MMWSL::LastInitializedWsle, LOCK_PFN, MI_PFN_ELEMENT, MI_SET_PTE_IN_WORKING_SET, MiGetPteAddress, MiLookupWsleHashIndex(), MiRemoveWsleFromFreeList(), MM_FREE_WSLE_SHIFT, _MMPTE::u, _MMPFN::u1, _MMWSLE::u1, UNLOCK_PFN, _MMWSL::Wsle, WSLE_NULL_INDEX, and WSLE_NUMBER.

Referenced by MiAddWorkingSetPage(), MiAddWsleHash(), MiAllocatePoolPages(), MiDecommitPages(), MiDeleteAddressesInWorkingSet(), MiDeletePte(), MiDeleteSystemPagableVm(), MiLockCode(), MiRemovePageFromWorkingSet(), MiSessionCommitPageTables(), MiUpdateWsle(), NtLockVirtualMemory(), and NtUnlockVirtualMemory().

00584 : 00585 00586 This routine swaps the working set list entries Entry and SwapEntry 00587 in the specified working set list (process or system cache). 00588 00589 Arguments: 00590 00591 SwapEntry - Supplies the first entry to swap. This entry must be 00592 valid, i.e. in the working set at the current time. 00593 00594 Entry - Supplies the other entry to swap. This entry may be valid 00595 or invalid. 00596 00597 WsInfo - Supplies the working set list. 00598 00599 Return Value: 00600 00601 None. 00602 00603 Environment: 00604 00605 Kernel mode, Working set lock and PFN lock held (if system cache), 00606 APCs disabled. 00607 00608 --*/ 00609 00610 { 00611 MMWSLE WsleEntry; 00612 MMWSLE WsleSwap; 00613 PMMPTE PointerPte; 00614 PMMPFN Pfn1; 00615 PMMWSLE Wsle; 00616 PMMWSL WorkingSetList; 00617 PMMWSLE_HASH Table; 00618 #if DBG 00619 WSLE_NUMBER CurrentSize = WsInfo->WorkingSetSize; 00620 #endif //DBG 00621 #if PFN_CONSISTENCY 00622 KIRQL OldIrql; 00623 #endif 00624 00625 WorkingSetList = WsInfo->VmWorkingSetList; 00626 Wsle = WorkingSetList->Wsle; 00627 00628 WsleSwap = Wsle[SwapEntry]; 00629 00630 ASSERT (WsleSwap.u1.e1.Valid != 0); 00631 00632 WsleEntry = Wsle[Entry]; 00633 00634 Table = WorkingSetList->HashTable; 00635 00636 if (WsleEntry.u1.e1.Valid == 0) { 00637 00638 // 00639 // Entry is not on any list. Remove it from the free list. 00640 // 00641 00642 MiRemoveWsleFromFreeList (Entry, Wsle, WorkingSetList); 00643 00644 // 00645 // Copy the Entry to this free one. 00646 // 00647 00648 Wsle[Entry] = WsleSwap; 00649 00650 PointerPte = MiGetPteAddress (WsleSwap.u1.VirtualAddress); 00651 00652 if (WsleSwap.u1.e1.Direct) { 00653 Pfn1 = MI_PFN_ELEMENT (PointerPte->u.Hard.PageFrameNumber); 00654 #if PFN_CONSISTENCY 00655 OldIrql = 99; 00656 if (PFN_LOCK_OWNED_BY_ME() == 0) { 00657 LOCK_PFN (OldIrql); 00658 } 00659 #endif 00660 Pfn1->u1.WsIndex = Entry; 00661 #if PFN_CONSISTENCY 00662 if (OldIrql != 99) { 00663 UNLOCK_PFN (OldIrql); 00664 } 00665 #endif 00666 } else { 00667 00668 // 00669 // Update hash table. 00670 // 00671 00672 if (Table) { 00673 Table [ MiLookupWsleHashIndex (WsleSwap.u1.Long, 00674 WorkingSetList)].Index = Entry; 00675 } 00676 } 00677 00678 MI_SET_PTE_IN_WORKING_SET (PointerPte, Entry); 00679 00680 // 00681 // Put entry on free list. 00682 // 00683 00684 ASSERT (WorkingSetList->FirstFree <= WorkingSetList->LastInitializedWsle); 00685 Wsle[SwapEntry].u1.Long = WorkingSetList->FirstFree << MM_FREE_WSLE_SHIFT; 00686 WorkingSetList->FirstFree = SwapEntry; 00687 ASSERT ((WorkingSetList->FirstFree <= WorkingSetList->LastInitializedWsle) || 00688 (WorkingSetList->FirstFree == WSLE_NULL_INDEX)); 00689 00690 } else { 00691 00692 // 00693 // Both entries are valid. 00694 // 00695 00696 Wsle[SwapEntry] = WsleEntry; 00697 00698 PointerPte = MiGetPteAddress (WsleEntry.u1.VirtualAddress); 00699 00700 if (WsleEntry.u1.e1.Direct) { 00701 00702 // 00703 // Swap the PFN WsIndex element to point to the new slot. 00704 // 00705 00706 Pfn1 = MI_PFN_ELEMENT (PointerPte->u.Hard.PageFrameNumber); 00707 #if PFN_CONSISTENCY 00708 OldIrql = 99; 00709 if (PFN_LOCK_OWNED_BY_ME() == 0) { 00710 LOCK_PFN (OldIrql); 00711 } 00712 #endif 00713 Pfn1->u1.WsIndex = SwapEntry; 00714 #if PFN_CONSISTENCY 00715 if (OldIrql != 99) { 00716 UNLOCK_PFN (OldIrql); 00717 } 00718 #endif 00719 } else { 00720 00721 // 00722 // Update hash table. 00723 // 00724 00725 if (Table) { 00726 Table[ MiLookupWsleHashIndex (WsleEntry.u1.Long, 00727 WorkingSetList)].Index = SwapEntry; 00728 } 00729 } 00730 00731 MI_SET_PTE_IN_WORKING_SET (PointerPte, SwapEntry); 00732 00733 Wsle[Entry] = WsleSwap; 00734 00735 PointerPte = MiGetPteAddress (WsleSwap.u1.VirtualAddress); 00736 00737 if (WsleSwap.u1.e1.Direct) { 00738 00739 Pfn1 = MI_PFN_ELEMENT (PointerPte->u.Hard.PageFrameNumber); 00740 #if PFN_CONSISTENCY 00741 OldIrql = 99; 00742 if (PFN_LOCK_OWNED_BY_ME() == 0) { 00743 LOCK_PFN (OldIrql); 00744 } 00745 #endif 00746 Pfn1->u1.WsIndex = Entry; 00747 #if PFN_CONSISTENCY 00748 if (OldIrql != 99) { 00749 UNLOCK_PFN (OldIrql); 00750 } 00751 #endif 00752 } else { 00753 if (Table) { 00754 Table[ MiLookupWsleHashIndex (WsleSwap.u1.Long, 00755 WorkingSetList)].Index = Entry; 00756 } 00757 } 00758 MI_SET_PTE_IN_WORKING_SET (PointerPte, Entry); 00759 } 00760 ASSERT (CurrentSize == WsInfo->WorkingSetSize); 00761 return; 00762 }


Variable Documentation

ULONG MmPagedPoolPage
 

Definition at line 30 of file wstree.c.

ULONG MmSystemCachePage
 

Definition at line 29 of file wstree.c.

ULONG MmSystemCodePage
 

Definition at line 28 of file wstree.c.

ULONG MmSystemDriverPage
 

Definition at line 31 of file wstree.c.


Generated on Sat May 15 19:46:10 2004 for test by doxygen 1.3.7