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

miglobal.c

Go to the documentation of this file.
00001 /*++ 00002 00003 Copyright (c) 1989 Microsoft Corporation 00004 00005 Module Name: 00006 00007 miglobal.c 00008 00009 Abstract: 00010 00011 This module contains the private global storage for the memory 00012 management subsystem. 00013 00014 Author: 00015 00016 Lou Perazzoli (loup) 6-Apr-1989 00017 00018 Revision History: 00019 00020 --*/ 00021 #include "mi.h" 00022 00023 // 00024 // Highest user address; 00025 // 00026 00027 PVOID MmHighestUserAddress; 00028 00029 // 00030 // Start of system address range. 00031 // 00032 00033 PVOID MmSystemRangeStart; 00034 00035 // 00036 // User probe address; 00037 // 00038 00039 ULONG_PTR MmUserProbeAddress; 00040 00041 // 00042 // Virtual bias applied during the loading of the kernel image. 00043 // 00044 00045 ULONG_PTR MmVirtualBias; 00046 00047 // 00048 // Number of secondary colors, based on level 2 d cache size. 00049 // 00050 00051 ULONG MmSecondaryColors; 00052 00053 // 00054 // The starting color index seed, incremented at each process creation. 00055 // 00056 00057 ULONG MmProcessColorSeed = 0x12345678; 00058 00059 // 00060 // Total number of physical pages available on the system. 00061 // 00062 00063 PFN_COUNT MmNumberOfPhysicalPages; 00064 00065 // 00066 // Lowest physical page number in the system. 00067 // 00068 00069 PFN_NUMBER MmLowestPhysicalPage = (PFN_NUMBER)-1; 00070 00071 // 00072 // Highest physical page number in the system. 00073 // 00074 00075 PFN_NUMBER MmHighestPhysicalPage; 00076 00077 // 00078 // Highest possible physical page number in the system. 00079 // 00080 00081 PFN_NUMBER MmHighestPossiblePhysicalPage; 00082 00083 // 00084 // Total number of available pages in the system. This 00085 // is the sum of the pages on the zeroed, free and standby lists. 00086 // 00087 00088 PFN_COUNT MmAvailablePages; 00089 PFN_NUMBER MmThrottleTop; 00090 PFN_NUMBER MmThrottleBottom; 00091 00092 // 00093 // System wide memory management statistics block. 00094 // 00095 00096 MMINFO_COUNTERS MmInfoCounters; 00097 00098 // 00099 // Total number of physical pages which would be usable if every process 00100 // was at its minimum working set size. This value is initialized 00101 // at system initialization to MmAvailablePages - MM_FLUID_PHYSICAL_PAGES. 00102 // Every time a thread is created, the kernel stack is subtracted from 00103 // this and every time a process is created, the minimum working set 00104 // is subtracted from this. If the value would become negative, the 00105 // operation (create process/kernel stack/ adjust working set) fails. 00106 // The PFN LOCK must be owned to manipulate this value. 00107 // 00108 00109 SPFN_NUMBER MmResidentAvailablePages; 00110 00111 // 00112 // The total number of pages which would be removed from working sets 00113 // if every working set was at its minimum. 00114 // 00115 00116 PFN_NUMBER MmPagesAboveWsMinimum; 00117 00118 // 00119 // The total number of pages which would be removed from working sets 00120 // if every working set above its maximum was at its maximum. 00121 // 00122 00123 PFN_NUMBER MmPagesAboveWsMaximum; 00124 00125 // 00126 // The number of pages to add to a working set if there are ample 00127 // available pages and the working set is below its maximum. 00128 // 00129 00130 // 00131 // If memory is becoming short and MmPagesAboveWsMinimum is 00132 // greater than MmPagesAboveWsThreshold, trim working sets. 00133 // 00134 00135 PFN_NUMBER MmPagesAboveWsThreshold = 37; 00136 00137 PFN_NUMBER MmWorkingSetSizeIncrement = 6; 00138 00139 // 00140 // The number of pages to extend the maximum working set size by 00141 // if the working set at its maximum and there are ample available pages. 00142 00143 PFN_NUMBER MmWorkingSetSizeExpansion = 20; 00144 00145 // 00146 // The number of pages required to be freed by working set reduction 00147 // before working set reduction is attempted. 00148 // 00149 00150 PFN_NUMBER MmWsAdjustThreshold = 45; 00151 00152 // 00153 // The number of pages available to allow the working set to be 00154 // expanded above its maximum. 00155 // 00156 00157 PFN_NUMBER MmWsExpandThreshold = 90; 00158 00159 // 00160 // The total number of pages to reduce by working set trimming. 00161 // 00162 00163 PFN_NUMBER MmWsTrimReductionGoal = 29; 00164 00165 // 00166 // The total number of pages needed for the loader to successfully hibernate. 00167 // 00168 00169 PFN_NUMBER MmHiberPages = 512; 00170 00171 // 00172 // Registry-settable threshold for using large pages. x86 only. 00173 // 00174 00175 ULONG MmLargePageMinimum; 00176 00177 PMMPFN MmPfnDatabase; 00178 00179 MMPFNLIST MmZeroedPageListHead = { 00180 0, // Total 00181 ZeroedPageList, // ListName 00182 MM_EMPTY_LIST, //Flink 00183 MM_EMPTY_LIST // Blink 00184 }; 00185 00186 MMPFNLIST MmFreePageListHead = { 00187 0, // Total 00188 FreePageList, // ListName 00189 MM_EMPTY_LIST, //Flink 00190 MM_EMPTY_LIST // Blink 00191 }; 00192 00193 MMPFNLIST MmStandbyPageListHead = { 00194 0, // Total 00195 StandbyPageList, // ListName 00196 MM_EMPTY_LIST, //Flink 00197 MM_EMPTY_LIST // Blink 00198 }; 00199 00200 MMPFNLIST MmModifiedPageListHead = { 00201 0, // Total 00202 ModifiedPageList, // ListName 00203 MM_EMPTY_LIST, //Flink 00204 MM_EMPTY_LIST // Blink 00205 }; 00206 00207 MMPFNLIST MmModifiedNoWritePageListHead = { 00208 0, // Total 00209 ModifiedNoWritePageList, // ListName 00210 MM_EMPTY_LIST, //Flink 00211 MM_EMPTY_LIST // Blink 00212 }; 00213 00214 MMPFNLIST MmBadPageListHead = { 00215 0, // Total 00216 BadPageList, // ListName 00217 MM_EMPTY_LIST, //Flink 00218 MM_EMPTY_LIST // Blink 00219 }; 00220 00221 PMMPFNLIST MmPageLocationList[NUMBER_OF_PAGE_LISTS] = { 00222 &MmZeroedPageListHead, 00223 &MmFreePageListHead, 00224 &MmStandbyPageListHead, 00225 &MmModifiedPageListHead, 00226 &MmModifiedNoWritePageListHead, 00227 &MmBadPageListHead, 00228 NULL, 00229 NULL }; 00230 00231 // PMMPFNLIST MmPageLocationList[FreePageList] = &MmFreePageListHead; 00232 // 00233 // PMMPFNLIST MmPageLocationList[ZeroedPageList] = &MmZeroedPageListHead; 00234 // 00235 // PMMPFNLIST MmPageLocationList[StandbyPageList] = &MmStandbyPageListHead; 00236 // 00237 // PMMPFNLIST MmPageLocationList[ModifiedPageList] = &MmModifiedPageListHead; 00238 // 00239 // PMMPFNLIST MmPageLocationList[ModifiedNoWritePageList] = &MmModifiedNoWritePageListHead; 00240 // 00241 // PMMPFNLIST MmPageLocationList[BadPageList] = &MmBadPageListHead; 00242 // 00243 // PMMPFNLIST MmPageLocationList[ActiveAndValid] = NULL; 00244 // 00245 // PMMPFNLIST MmPageLocationList[TransitionPage] = NULL; 00246 00247 PMMPTE MiHighestUserPte; 00248 PMMPTE MiHighestUserPde; 00249 00250 PMMPTE MiSessionBasePte; 00251 PMMPTE MiSessionLastPte; 00252 00253 // 00254 // Hyper space items. 00255 // 00256 00257 PMMPTE MmFirstReservedMappingPte; 00258 00259 PMMPTE MmLastReservedMappingPte; 00260 00261 PMMWSL MmWorkingSetList; 00262 00263 PMMWSLE MmWsle; 00264 00265 // 00266 // Event for available pages, set means pages are available. 00267 // 00268 00269 KEVENT MmAvailablePagesEvent; 00270 00271 // 00272 // Event for the zeroing page thread. 00273 // 00274 00275 KEVENT MmZeroingPageEvent; 00276 00277 // 00278 // Boolean to indicate if the zeroing page thread is currently 00279 // active. This is set to true when the zeroing page event is 00280 // set and set to false when the zeroing page thread is done 00281 // zeroing all the pages on the free list. 00282 // 00283 00284 BOOLEAN MmZeroingPageThreadActive; 00285 00286 // 00287 // Minimum number of free pages before zeroing page thread starts. 00288 // 00289 00290 PFN_NUMBER MmMinimumFreePagesToZero = 8; 00291 00292 // 00293 // System space sizes - MmNonPagedSystemStart to MM_NON_PAGED_SYSTEM_END 00294 // defines the ranges of PDEs which must be copied into a new process's 00295 // address space. 00296 // 00297 00298 PVOID MmNonPagedSystemStart; 00299 00300 LOGICAL MmProtectFreedNonPagedPool; 00301 00302 LOGICAL MmDynamicPfn = FALSE; 00303 00304 #if PFN_CONSISTENCY 00305 PMMPTE MiPfnStartPte; 00306 PFN_NUMBER MiPfnPtes; 00307 BOOLEAN MiPfnProtectionEnabled; 00308 PETHREAD MiPfnLockOwner; 00309 #endif 00310 00311 #ifdef MM_BUMP_COUNTER_MAX 00312 SIZE_T MmResTrack[MM_BUMP_COUNTER_MAX]; 00313 #endif 00314 00315 #ifdef MM_COMMIT_COUNTER_MAX 00316 SIZE_T MmTrackCommit[MM_COMMIT_COUNTER_MAX]; 00317 #endif 00318 00319 // 00320 // Set via the registry to identify which drivers are leaking locked pages. 00321 // 00322 00323 LOGICAL MmTrackLockedPages; 00324 00325 // 00326 // Set via the registry to identify drivers which unload without releasing 00327 // resources or still have active timers, etc. 00328 // 00329 00330 LOGICAL MmSnapUnloads = TRUE; 00331 00332 #if DBG 00333 PETHREAD MiExpansionLockOwner; 00334 #endif 00335 00336 // 00337 // Pool sizes. 00338 // 00339 00340 SIZE_T MmSizeOfNonPagedPoolInBytes; 00341 00342 SIZE_T MmMaximumNonPagedPoolInBytes; 00343 00344 SIZE_T MmMinimumNonPagedPoolSize = 256 * 1024; // 256k 00345 00346 ULONG MmMinAdditionNonPagedPoolPerMb = 32 * 1024; // 32k 00347 00348 SIZE_T MmDefaultMaximumNonPagedPool = 1024 * 1024; // 1mb 00349 00350 ULONG MmMaxAdditionNonPagedPoolPerMb = 400 * 1024; //400k 00351 00352 SIZE_T MmSizeOfPagedPoolInBytes = 32 * 1024 * 1024; // 32 MB. 00353 00354 PFN_NUMBER MmSizeOfNonPagedMustSucceed = 4 * PAGE_SIZE; // 4 pages 00355 00356 ULONG MmNumberOfSystemPtes; 00357 00358 ULONG MiRequestedSystemPtes; 00359 00360 ULONG MmLockPagesPercentage; 00361 00362 PFN_NUMBER MmLockPagesLimit; 00363 00364 PMMPTE MmFirstPteForPagedPool; 00365 00366 PMMPTE MmLastPteForPagedPool; 00367 00368 PMMPTE MmPagedPoolBasePde; 00369 00370 // 00371 // Pool bit maps and other related structures. 00372 // 00373 00374 PVOID MmPageAlignedPoolBase[2]; 00375 00376 PVOID MmNonPagedMustSucceed; 00377 00378 ULONG MmExpandedPoolBitPosition; 00379 00380 PFN_NUMBER MmNumberOfFreeNonPagedPool; 00381 00382 ULONG MmMustSucceedPoolBitPosition; 00383 00384 // 00385 // MmFirstFreeSystemPte contains the offset from the 00386 // Nonpaged system base to the first free system PTE. 00387 // Note that an offset of FFFFF indicates an empty list. 00388 // 00389 00390 MMPTE MmFirstFreeSystemPte[MaximumPtePoolTypes]; 00391 00392 // 00393 // System cache sizes. 00394 // 00395 00396 PMMWSL MmSystemCacheWorkingSetList = (PMMWSL)MM_SYSTEM_CACHE_WORKING_SET; 00397 00398 MMSUPPORT MmSystemCacheWs; 00399 00400 PMMWSLE MmSystemCacheWsle; 00401 00402 PVOID MmSystemCacheStart = (PVOID)MM_SYSTEM_CACHE_START; 00403 00404 PVOID MmSystemCacheEnd; 00405 00406 PRTL_BITMAP MmSystemCacheAllocationMap; 00407 00408 PRTL_BITMAP MmSystemCacheEndingMap; 00409 00410 // 00411 // This value should not be greater than 256MB in a system with 1GB of 00412 // system space. 00413 // 00414 00415 PFN_COUNT MmSizeOfSystemCacheInPages = 64 * 256; //64MB. 00416 00417 // 00418 // Default sizes for the system cache. 00419 // 00420 00421 PFN_NUMBER MmSystemCacheWsMinimum = 288; 00422 00423 PFN_NUMBER MmSystemCacheWsMaximum = 350; 00424 00425 // 00426 // Cells to track unused thread kernel stacks to avoid TB flushes 00427 // every time a thread terminates. 00428 // 00429 00430 ULONG MmNumberDeadKernelStacks; 00431 ULONG MmMaximumDeadKernelStacks = 5; 00432 PMMPFN MmFirstDeadKernelStack = (PMMPFN)NULL; 00433 00434 // 00435 // MmSystemPteBase contains the address of 1 PTE before 00436 // the first free system PTE (zero indicates an empty list). 00437 // The value of this field does not change once set. 00438 // 00439 00440 PMMPTE MmSystemPteBase; 00441 00442 PMMWSL MmWorkingSetList; 00443 00444 PMMWSLE MmWsle; 00445 00446 PMMADDRESS_NODE MmSectionBasedRoot; 00447 00448 PVOID MmHighSectionBase; 00449 00450 // 00451 // Section object type. 00452 // 00453 00454 POBJECT_TYPE MmSectionObjectType; 00455 00456 // 00457 // Section commit mutex. 00458 // 00459 00460 FAST_MUTEX MmSectionCommitMutex; 00461 00462 // 00463 // Section base address mutex. 00464 // 00465 00466 FAST_MUTEX MmSectionBasedMutex; 00467 00468 // 00469 // Resource for section extension. 00470 // 00471 00472 ERESOURCE MmSectionExtendResource; 00473 ERESOURCE MmSectionExtendSetResource; 00474 00475 // 00476 // Pagefile creation lock. 00477 // 00478 00479 FAST_MUTEX MmPageFileCreationLock; 00480 00481 MMDEREFERENCE_SEGMENT_HEADER MmDereferenceSegmentHeader; 00482 00483 LIST_ENTRY MmUnusedSegmentList; 00484 00485 KEVENT MmUnusedSegmentCleanup; 00486 00487 ULONG MmUnusedSegmentCount; 00488 00489 // 00490 // Maximum amount of paged pool to keep in unused segments. 00491 // 00492 00493 SIZE_T MmMaxUnusedSegmentPagedPoolUsage; 00494 00495 // 00496 // Amount of paged pool used by unused segments. 00497 // 00498 00499 SIZE_T MmUnusedSegmentPagedPoolUsage; 00500 SIZE_T MiUnusedSegmentPagedPoolUsage; 00501 00502 // 00503 // Amount to reduce paged pool by when it starts getting low. 00504 // 00505 00506 SIZE_T MmUnusedSegmentPagedPoolReduction; 00507 00508 // 00509 // Maximum amount of nonpaged pool to keep in unused segments. 00510 // 00511 00512 SIZE_T MmMaxUnusedSegmentNonPagedPoolUsage; 00513 00514 // 00515 // Amount of nonpaged pool used by unused segments. 00516 // 00517 00518 SIZE_T MmUnusedSegmentNonPagedPoolUsage; 00519 SIZE_T MiUnusedSegmentNonPagedPoolUsage; 00520 00521 // 00522 // Amount to reduce nonpaged pool by when it starts getting low. 00523 // 00524 00525 SIZE_T MmUnusedSegmentNonPagedPoolReduction; 00526 00527 // 00528 // Unused File Cache trim level - this is the percentage of pool consumed by 00529 // unused file segments. The minimum is 5%, the maximum (ie: largest caching) 00530 // is 40%. Under 20% is almost always the correct value. 00531 // 00532 00533 ULONG MmUnusedSegmentTrimLevel = 18; 00534 00535 MMWORKING_SET_EXPANSION_HEAD MmWorkingSetExpansionHead; 00536 00537 MMPAGE_FILE_EXPANSION MmAttemptForCantExtend; 00538 00539 // 00540 // Paging files 00541 // 00542 00543 MMMOD_WRITER_LISTHEAD MmPagingFileHeader; 00544 00545 MMMOD_WRITER_LISTHEAD MmMappedFileHeader; 00546 00547 PMMMOD_WRITER_MDL_ENTRY MmMappedFileMdl[MM_MAPPED_FILE_MDLS]; ; 00548 00549 LIST_ENTRY MmFreePagingSpaceLow; 00550 00551 ULONG MmNumberOfActiveMdlEntries; 00552 00553 PMMPAGING_FILE MmPagingFile[MAX_PAGE_FILES]; 00554 00555 ULONG MmNumberOfPagingFiles; 00556 00557 KEVENT MmModifiedPageWriterEvent; 00558 00559 KEVENT MmWorkingSetManagerEvent; 00560 00561 KEVENT MmCollidedFlushEvent; 00562 00563 // 00564 // Total number of committed pages. 00565 // 00566 00567 SIZE_T MmTotalCommittedPages; 00568 00569 // 00570 // Limit on committed pages. When MmTotalCommittedPages would become 00571 // greater than or equal to this number the paging files must be expanded. 00572 // 00573 00574 SIZE_T MmTotalCommitLimit; 00575 00576 SIZE_T MmTotalCommitLimitMaximum; 00577 00578 // 00579 // Number of pages to overcommit without expanding the paging file. 00580 // MmTotalCommitLimit = (total paging file space) + MmOverCommit. 00581 // 00582 00583 SIZE_T MmOverCommit; 00584 00585 // 00586 // Modified page writer. 00587 // 00588 00589 00590 // 00591 // Minimum number of free pages before working set trimming and 00592 // aggressive modified page writing is started. 00593 // 00594 00595 PFN_NUMBER MmMinimumFreePages = 26; 00596 00597 // 00598 // Stop writing modified pages when MmFreeGoal pages exist. 00599 // 00600 00601 PFN_NUMBER MmFreeGoal = 100; 00602 00603 // 00604 // Start writing pages if more than this number of pages 00605 // is on the modified page list. 00606 // 00607 00608 PFN_NUMBER MmModifiedPageMaximum; 00609 00610 // 00611 // Minimum number of modified pages required before the modified 00612 // page writer is started. 00613 // 00614 00615 PFN_NUMBER MmModifiedPageMinimum; 00616 00617 // 00618 // Amount of disk space that must be free after the paging file is 00619 // extended. 00620 // 00621 00622 ULONG MmMinimumFreeDiskSpace = 1024 * 1024; 00623 00624 // 00625 // Size to extend the paging file by. 00626 // 00627 00628 ULONG MmPageFileExtension = 128; //128 pages 00629 00630 // 00631 // Size to reduce the paging file by. 00632 // 00633 00634 ULONG MmMinimumPageFileReduction = 256; //256 pages (1mb) 00635 00636 // 00637 // Number of pages to write in a single I/O. 00638 // 00639 00640 ULONG MmModifiedWriteClusterSize = MM_MAXIMUM_WRITE_CLUSTER; 00641 00642 // 00643 // Number of pages to read in a single I/O if possible. 00644 // 00645 00646 ULONG MmReadClusterSize = 7; 00647 00648 // 00649 // Spin locks. 00650 // 00651 00652 // 00653 // Spinlock which guards PFN database. This spinlock is used by 00654 // memory management for accessing the PFN database. The I/O 00655 // system makes use of it for unlocking pages during I/O completion. 00656 // 00657 00658 // KSPIN_LOCK MmPfnLock; 00659 00660 // 00661 // Spinlock which guards the working set list for the system shared 00662 // address space (paged pool, system cache, pagable drivers). 00663 // 00664 00665 ERESOURCE MmSystemWsLock; 00666 00667 PETHREAD MmSystemLockOwner; 00668 00669 // 00670 // Spin lock for allowing working set expansion. 00671 // 00672 00673 KSPIN_LOCK MmExpansionLock; 00674 00675 // 00676 // Spin lock for protecting hyper space access. 00677 // 00678 00679 // 00680 // System process working set sizes. 00681 // 00682 00683 PFN_NUMBER MmSystemProcessWorkingSetMin = 50; 00684 00685 PFN_NUMBER MmSystemProcessWorkingSetMax = 450; 00686 00687 PFN_NUMBER MmMaximumWorkingSetSize; 00688 00689 PFN_NUMBER MmMinimumWorkingSetSize = 20; 00690 00691 00692 // 00693 // Page color for system working set. 00694 // 00695 00696 ULONG MmSystemPageColor; 00697 00698 // 00699 // Time constants 00700 // 00701 00702 LARGE_INTEGER MmSevenMinutes = {0, -1}; 00703 00704 // 00705 // note that the following constant is initialized to five seconds, 00706 // but is set to 3 on very small workstations. The constant used to 00707 // be called MmFiveSecondsAbsolute, but since its value changes depending on 00708 // the system type and size, I decided to change the name to reflect this 00709 // 00710 LARGE_INTEGER MmWorkingSetProtectionTime = {5 * 1000 * 1000 * 10, 0}; 00711 00712 LARGE_INTEGER MmOneSecond = {(ULONG)(-1 * 1000 * 1000 * 10), -1}; 00713 LARGE_INTEGER MmTwentySeconds = {(ULONG)(-20 * 1000 * 1000 * 10), -1}; 00714 LARGE_INTEGER MmShortTime = {(ULONG)(-10 * 1000 * 10), -1}; // 10 milliseconds 00715 LARGE_INTEGER MmHalfSecond = {(ULONG)(-5 * 100 * 1000 * 10), -1}; 00716 LARGE_INTEGER Mm30Milliseconds = {(ULONG)(-30 * 1000 * 10), -1}; 00717 00718 // 00719 // Parameters for user mode passed up via PEB in MmCreatePeb 00720 // 00721 ULONG MmCritsectTimeoutSeconds = 2592000; 00722 LARGE_INTEGER MmCriticalSectionTimeout; // Filled in by mminit.c 00723 SIZE_T MmHeapSegmentReserve = 1024 * 1024; 00724 SIZE_T MmHeapSegmentCommit = PAGE_SIZE * 2; 00725 SIZE_T MmHeapDeCommitTotalFreeThreshold = 64 * 1024; 00726 SIZE_T MmHeapDeCommitFreeBlockThreshold = PAGE_SIZE; 00727 00728 // 00729 // Set from ntos\config\CMDAT3.C Used by customers to disable paging 00730 // of executive on machines with lots of memory. Worth a few TPS on a 00731 // database server. 00732 // 00733 00734 ULONG MmDisablePagingExecutive; 00735 00736 BOOLEAN Mm64BitPhysicalAddress; 00737 00738 #if DBG 00739 ULONG MmDebug; 00740 #endif 00741 00742 // 00743 // Map a page protection from the Pte.Protect field into a protection mask. 00744 // 00745 00746 ULONG MmProtectToValue[32] = { 00747 PAGE_NOACCESS, 00748 PAGE_READONLY, 00749 PAGE_EXECUTE, 00750 PAGE_EXECUTE_READ, 00751 PAGE_READWRITE, 00752 PAGE_WRITECOPY, 00753 PAGE_EXECUTE_READWRITE, 00754 PAGE_EXECUTE_WRITECOPY, 00755 PAGE_NOACCESS, 00756 PAGE_NOCACHE | PAGE_READONLY, 00757 PAGE_NOCACHE | PAGE_EXECUTE, 00758 PAGE_NOCACHE | PAGE_EXECUTE_READ, 00759 PAGE_NOCACHE | PAGE_READWRITE, 00760 PAGE_NOCACHE | PAGE_WRITECOPY, 00761 PAGE_NOCACHE | PAGE_EXECUTE_READWRITE, 00762 PAGE_NOCACHE | PAGE_EXECUTE_WRITECOPY, 00763 PAGE_NOACCESS, 00764 PAGE_GUARD | PAGE_READONLY, 00765 PAGE_GUARD | PAGE_EXECUTE, 00766 PAGE_GUARD | PAGE_EXECUTE_READ, 00767 PAGE_GUARD | PAGE_READWRITE, 00768 PAGE_GUARD | PAGE_WRITECOPY, 00769 PAGE_GUARD | PAGE_EXECUTE_READWRITE, 00770 PAGE_GUARD | PAGE_EXECUTE_WRITECOPY, 00771 PAGE_NOACCESS, 00772 PAGE_NOCACHE | PAGE_GUARD | PAGE_READONLY, 00773 PAGE_NOCACHE | PAGE_GUARD | PAGE_EXECUTE, 00774 PAGE_NOCACHE | PAGE_GUARD | PAGE_EXECUTE_READ, 00775 PAGE_NOCACHE | PAGE_GUARD | PAGE_READWRITE, 00776 PAGE_NOCACHE | PAGE_GUARD | PAGE_WRITECOPY, 00777 PAGE_NOCACHE | PAGE_GUARD | PAGE_EXECUTE_READWRITE, 00778 PAGE_NOCACHE | PAGE_GUARD | PAGE_EXECUTE_WRITECOPY 00779 }; 00780 00781 ULONG MmProtectToPteMask[32] = { 00782 MM_PTE_NOACCESS, 00783 MM_PTE_READONLY | MM_PTE_CACHE, 00784 MM_PTE_EXECUTE | MM_PTE_CACHE, 00785 MM_PTE_EXECUTE_READ | MM_PTE_CACHE, 00786 MM_PTE_READWRITE | MM_PTE_CACHE, 00787 MM_PTE_WRITECOPY | MM_PTE_CACHE, 00788 MM_PTE_EXECUTE_READWRITE | MM_PTE_CACHE, 00789 MM_PTE_EXECUTE_WRITECOPY | MM_PTE_CACHE, 00790 MM_PTE_NOACCESS, 00791 MM_PTE_NOCACHE | MM_PTE_READONLY, 00792 MM_PTE_NOCACHE | MM_PTE_EXECUTE, 00793 MM_PTE_NOCACHE | MM_PTE_EXECUTE_READ, 00794 MM_PTE_NOCACHE | MM_PTE_READWRITE, 00795 MM_PTE_NOCACHE | MM_PTE_WRITECOPY, 00796 MM_PTE_NOCACHE | MM_PTE_EXECUTE_READWRITE, 00797 MM_PTE_NOCACHE | MM_PTE_EXECUTE_WRITECOPY, 00798 MM_PTE_NOACCESS, 00799 MM_PTE_GUARD | MM_PTE_READONLY | MM_PTE_CACHE, 00800 MM_PTE_GUARD | MM_PTE_EXECUTE | MM_PTE_CACHE, 00801 MM_PTE_GUARD | MM_PTE_EXECUTE_READ | MM_PTE_CACHE, 00802 MM_PTE_GUARD | MM_PTE_READWRITE | MM_PTE_CACHE, 00803 MM_PTE_GUARD | MM_PTE_WRITECOPY | MM_PTE_CACHE, 00804 MM_PTE_GUARD | MM_PTE_EXECUTE_READWRITE | MM_PTE_CACHE, 00805 MM_PTE_GUARD | MM_PTE_EXECUTE_WRITECOPY | MM_PTE_CACHE, 00806 MM_PTE_NOACCESS, 00807 MM_PTE_NOCACHE | MM_PTE_GUARD | MM_PTE_READONLY, 00808 MM_PTE_NOCACHE | MM_PTE_GUARD | MM_PTE_EXECUTE, 00809 MM_PTE_NOCACHE | MM_PTE_GUARD | MM_PTE_EXECUTE_READ, 00810 MM_PTE_NOCACHE | MM_PTE_GUARD | MM_PTE_READWRITE, 00811 MM_PTE_NOCACHE | MM_PTE_GUARD | MM_PTE_WRITECOPY, 00812 MM_PTE_NOCACHE | MM_PTE_GUARD | MM_PTE_EXECUTE_READWRITE, 00813 MM_PTE_NOCACHE | MM_PTE_GUARD | MM_PTE_EXECUTE_WRITECOPY 00814 }; 00815 00816 // 00817 // Conversion which takes a Pte.Protect and builds a new Pte.Protect which 00818 // is not copy-on-write. 00819 // 00820 00821 ULONG MmMakeProtectNotWriteCopy[32] = { 00822 MM_NOACCESS, 00823 MM_READONLY, 00824 MM_EXECUTE, 00825 MM_EXECUTE_READ, 00826 MM_READWRITE, 00827 MM_READWRITE, //not copy 00828 MM_EXECUTE_READWRITE, 00829 MM_EXECUTE_READWRITE, 00830 MM_NOACCESS, 00831 MM_NOCACHE | MM_READONLY, 00832 MM_NOCACHE | MM_EXECUTE, 00833 MM_NOCACHE | MM_EXECUTE_READ, 00834 MM_NOCACHE | MM_READWRITE, 00835 MM_NOCACHE | MM_READWRITE, 00836 MM_NOCACHE | MM_EXECUTE_READWRITE, 00837 MM_NOCACHE | MM_EXECUTE_READWRITE, 00838 MM_NOACCESS, 00839 MM_GUARD_PAGE | MM_READONLY, 00840 MM_GUARD_PAGE | MM_EXECUTE, 00841 MM_GUARD_PAGE | MM_EXECUTE_READ, 00842 MM_GUARD_PAGE | MM_READWRITE, 00843 MM_GUARD_PAGE | MM_READWRITE, 00844 MM_GUARD_PAGE | MM_EXECUTE_READWRITE, 00845 MM_GUARD_PAGE | MM_EXECUTE_READWRITE, 00846 MM_NOACCESS, 00847 MM_NOCACHE | MM_GUARD_PAGE | MM_READONLY, 00848 MM_NOCACHE | MM_GUARD_PAGE | MM_EXECUTE, 00849 MM_NOCACHE | MM_GUARD_PAGE | MM_EXECUTE_READ, 00850 MM_NOCACHE | MM_GUARD_PAGE | MM_READWRITE, 00851 MM_NOCACHE | MM_GUARD_PAGE | MM_READWRITE, 00852 MM_NOCACHE | MM_GUARD_PAGE | MM_EXECUTE_READWRITE, 00853 MM_NOCACHE | MM_GUARD_PAGE | MM_EXECUTE_READWRITE 00854 }; 00855 00856 // 00857 // Converts a protection code to an access right for section access. 00858 // This uses only the lower 3 bits of the 5 bit protection code. 00859 // 00860 00861 ACCESS_MASK MmMakeSectionAccess[8] = { SECTION_MAP_READ, 00862 SECTION_MAP_READ, 00863 SECTION_MAP_EXECUTE, 00864 SECTION_MAP_EXECUTE | SECTION_MAP_READ, 00865 SECTION_MAP_WRITE, 00866 SECTION_MAP_READ, 00867 SECTION_MAP_EXECUTE | SECTION_MAP_WRITE, 00868 SECTION_MAP_EXECUTE | SECTION_MAP_READ }; 00869 00870 // 00871 // Converts a protection code to an access right for file access. 00872 // This uses only the lower 3 bits of the 5 bit protection code. 00873 // 00874 00875 ACCESS_MASK MmMakeFileAccess[8] = { FILE_READ_DATA, 00876 FILE_READ_DATA, 00877 FILE_EXECUTE, 00878 FILE_EXECUTE | FILE_READ_DATA, 00879 FILE_WRITE_DATA | FILE_READ_DATA, 00880 FILE_READ_DATA, 00881 FILE_EXECUTE | FILE_WRITE_DATA | FILE_READ_DATA, 00882 FILE_EXECUTE | FILE_READ_DATA }; 00883 00884 MM_PAGED_POOL_INFO MmPagedPoolInfo; 00885 00886 // 00887 // Some Hydra variables. 00888 // 00889 00890 BOOLEAN MiHydra; 00891 00892 ULONG_PTR MmSessionBase; 00893 PMM_SESSION_SPACE MmSessionSpace; 00894 00895 LIST_ENTRY MiSessionWsList; 00896 00897 ULONG_PTR MiSystemViewStart; 00898 00899 // 00900 // Both retry level and initial count must both be initialized to the same 00901 // value. Note that the Driver Verifier can override these. 00902 // 00903 00904 ULONG MiIoRetryLevel = 25; 00905 ULONG MiFaultRetries = 25; 00906 ULONG MiUserIoRetryLevel = 10; 00907 ULONG MiUserFaultRetries = 10; 00908 00909 #ifdef ALLOC_DATA_PRAGMA 00910 #pragma data_seg("INIT") 00911 #endif 00912 00913 WCHAR MmVerifyDriverBuffer[MI_SUSPECT_DRIVER_BUFFER_LENGTH]; 00914 ULONG MmVerifyDriverBufferLength = sizeof(MmVerifyDriverBuffer); 00915 ULONG MmVerifyDriverBufferType = REG_NONE; 00916 ULONG MmVerifyDriverLevel = (ULONG)-1; 00917 00918 #ifdef ALLOC_DATA_PRAGMA 00919 #pragma data_seg() 00920 #endif

Generated on Sat May 15 19:40:48 2004 for test by doxygen 1.3.7