Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

193 lines
4.6 KiB

  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. data386.c
  5. Abstract:
  6. This module contains the private hardware specific global storage for
  7. the memory management subsystem.
  8. Author:
  9. Lou Perazzoli (loup) 22-Jan-1990
  10. Revision History:
  11. --*/
  12. #include "mi.h"
  13. //
  14. // A zero Pte.
  15. //
  16. const MMPTE ZeroPte = { 0 };
  17. //
  18. // A kernel zero PTE.
  19. //
  20. const MMPTE ZeroKernelPte = {0x0};
  21. MMPTE MmPteGlobal = {0x0}; // Set global bit later if processor supports Global Page
  22. //
  23. // Note - MM_PTE_GLOBAL_MASK is or'ed into ValidKernelPte during
  24. // initialization if the processor supports Global Page. Use
  25. // ValidKernelPteLocal if you don't want the global bit (ie: for session
  26. // space).
  27. //
  28. MMPTE ValidKernelPte = { MM_PTE_VALID_MASK |
  29. MM_PTE_WRITE_MASK |
  30. MM_PTE_DIRTY_MASK |
  31. MM_PTE_ACCESS_MASK };
  32. const MMPTE ValidKernelPteLocal = { MM_PTE_VALID_MASK |
  33. MM_PTE_WRITE_MASK |
  34. MM_PTE_DIRTY_MASK |
  35. MM_PTE_ACCESS_MASK };
  36. const MMPTE ValidUserPte = { MM_PTE_VALID_MASK |
  37. MM_PTE_WRITE_MASK |
  38. MM_PTE_OWNER_MASK |
  39. MM_PTE_DIRTY_MASK |
  40. MM_PTE_ACCESS_MASK };
  41. const MMPTE ValidPtePte = { MM_PTE_VALID_MASK |
  42. MM_PTE_WRITE_MASK |
  43. MM_PTE_DIRTY_MASK |
  44. MM_PTE_ACCESS_MASK };
  45. const MMPTE ValidPdePde = { MM_PTE_VALID_MASK |
  46. MM_PTE_WRITE_MASK |
  47. MM_PTE_DIRTY_MASK |
  48. MM_PTE_ACCESS_MASK };
  49. MMPTE ValidKernelPde = { MM_PTE_VALID_MASK |
  50. MM_PTE_WRITE_MASK |
  51. MM_PTE_DIRTY_MASK |
  52. MM_PTE_ACCESS_MASK };
  53. const MMPTE ValidKernelPdeLocal = { MM_PTE_VALID_MASK |
  54. MM_PTE_WRITE_MASK |
  55. MM_PTE_DIRTY_MASK |
  56. MM_PTE_ACCESS_MASK };
  57. // NOTE - MM_PTE_GLOBAL_MASK or'ed in later if processor supports Global Page
  58. MMPTE DemandZeroPde = { MM_READWRITE << 5 };
  59. const MMPTE DemandZeroPte = { MM_READWRITE << 5 };
  60. const MMPTE TransitionPde = { MM_PTE_WRITE_MASK |
  61. MM_PTE_OWNER_MASK |
  62. MM_PTE_TRANSITION_MASK |
  63. MM_READWRITE << 5 };
  64. #if !defined (_X86PAE_)
  65. MMPTE PrototypePte = { 0xFFFFF000 |
  66. MM_PTE_PROTOTYPE_MASK |
  67. MM_READWRITE << 5 };
  68. #else
  69. MMPTE PrototypePte = { (MI_PTE_LOOKUP_NEEDED << 32) |
  70. MM_PTE_PROTOTYPE_MASK |
  71. MM_READWRITE << 5 };
  72. #endif
  73. //
  74. // PTE which generates an access violation when referenced.
  75. //
  76. const MMPTE NoAccessPte = {MM_NOACCESS << 5};
  77. //
  78. // Pool start and end.
  79. //
  80. PVOID MmNonPagedPoolStart;
  81. PVOID MmNonPagedPoolEnd = (PVOID) MM_NONPAGED_POOL_END;
  82. PVOID MmPagedPoolStart = (PVOID) MM_DEFAULT_PAGED_POOL_START;
  83. PVOID MmPagedPoolEnd;
  84. PMMWSL MmWorkingSetList;
  85. ULONG MiMaximumWorkingSet =
  86. ((ULONG)((ULONG)2*1024*1024*1024 - 64*1024*1024) >> PAGE_SHIFT); //2Gb-64Mb
  87. //
  88. // Color tables for free and zeroed pages.
  89. //
  90. PMMCOLOR_TABLES MmFreePagesByColor[2];
  91. //
  92. // Color tables for modified pages destined for the paging file.
  93. //
  94. MMPFNLIST MmModifiedPageListByColor[MM_MAXIMUM_NUMBER_OF_COLORS] = {
  95. 0, ModifiedPageList, MM_EMPTY_LIST, MM_EMPTY_LIST};
  96. //
  97. // Count of the number of modified pages destined for the paging file.
  98. //
  99. ULONG MmTotalPagesForPagingFile = 0;
  100. //
  101. // Pte reserved for mapping pages for the debugger.
  102. //
  103. PMMPTE MmDebugPte = (MiGetPteAddress(MM_DEBUG_VA));
  104. //
  105. // 16 PTEs reserved for mapping MDLs (64k max).
  106. //
  107. PMMPTE MmCrashDumpPte = (MiGetPteAddress(MM_CRASH_DUMP_VA));
  108. //
  109. // Number of additional system PTEs present.
  110. //
  111. ULONG MiNumberOfExtraSystemPdes;
  112. ULONG MiMaximumSystemExtraSystemPdes;
  113. ULONG_PTR MiUseMaximumSystemSpace;
  114. ULONG_PTR MiUseMaximumSystemSpaceEnd;
  115. //
  116. // Size of extended system cache.
  117. //
  118. #if defined (_X86PAE_)
  119. PMMPTE MmSystemCacheWorkingSetListPte;
  120. #endif
  121. ULONG MiMaximumSystemCacheSizeExtra;
  122. PVOID MiSystemCacheStartExtra;
  123. PVOID MiSystemCacheEndExtra;
  124. ULONG MiExtraResourceStart;
  125. ULONG MiExtraResourceEnd;
  126. ULONG_PTR MmBootImageSize;