Source code of Windows XP (NT5)
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.

260 lines
8.5 KiB

  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. dataia64.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. Koichi Yamada (kyamada) 9-Jan-1996 : IA64 version based on i386 version
  12. --*/
  13. #include "mi.h"
  14. //
  15. // A zero Pte.
  16. //
  17. const MMPTE ZeroPte = { 0 };
  18. //
  19. // A kernel zero PTE.
  20. //
  21. const MMPTE ZeroKernelPte = {0x0};
  22. MMPTE ValidKernelPte = { MM_PTE_VALID_MASK |
  23. MM_PTE_CACHE |
  24. MM_PTE_WRITE_MASK |
  25. MM_PTE_EXECUTE_MASK |
  26. MM_PTE_ACCESS_MASK |
  27. MM_PTE_DIRTY_MASK |
  28. MM_PTE_EXC_DEFER};
  29. const MMPTE ValidKernelPteLocal = { MM_PTE_VALID_MASK |
  30. MM_PTE_CACHE |
  31. MM_PTE_WRITE_MASK |
  32. MM_PTE_ACCESS_MASK |
  33. MM_PTE_DIRTY_MASK |
  34. MM_PTE_EXC_DEFER};
  35. const MMPTE ValidUserPte = { MM_PTE_VALID_MASK |
  36. MM_PTE_CACHE |
  37. MM_PTE_WRITE_MASK |
  38. MM_PTE_OWNER_MASK |
  39. MM_PTE_ACCESS_MASK |
  40. MM_PTE_DIRTY_MASK |
  41. MM_PTE_EXC_DEFER};
  42. const MMPTE ValidPtePte = { MM_PTE_VALID_MASK |
  43. MM_PTE_CACHE |
  44. MM_PTE_WRITE_MASK |
  45. MM_PTE_ACCESS_MASK |
  46. MM_PTE_DIRTY_MASK };
  47. const MMPTE ValidPdePde = { MM_PTE_VALID_MASK |
  48. MM_PTE_CACHE |
  49. MM_PTE_WRITE_MASK |
  50. MM_PTE_ACCESS_MASK |
  51. MM_PTE_DIRTY_MASK };
  52. MMPTE ValidKernelPde = { MM_PTE_VALID_MASK |
  53. MM_PTE_CACHE |
  54. MM_PTE_WRITE_MASK |
  55. MM_PTE_ACCESS_MASK |
  56. MM_PTE_DIRTY_MASK };
  57. const MMPTE ValidKernelPdeLocal = { MM_PTE_VALID_MASK |
  58. MM_PTE_CACHE |
  59. MM_PTE_WRITE_MASK |
  60. MM_PTE_ACCESS_MASK |
  61. MM_PTE_DIRTY_MASK };
  62. MMPTE ValidPpePte = { MM_PTE_VALID_MASK |
  63. MM_PTE_CACHE |
  64. MM_PTE_WRITE_MASK |
  65. MM_PTE_ACCESS_MASK |
  66. MM_PTE_DIRTY_MASK };
  67. MMPTE DemandZeroPde = { MM_READWRITE << MM_PROTECT_FIELD_SHIFT };
  68. const MMPTE DemandZeroPte = { MM_READWRITE << MM_PROTECT_FIELD_SHIFT };
  69. const MMPTE TransitionPde = { MM_PTE_TRANSITION_MASK |
  70. MM_READWRITE << MM_PROTECT_FIELD_SHIFT };
  71. MMPTE PrototypePte = { MI_PTE_LOOKUP_NEEDED << 32 |
  72. MM_PTE_PROTOTYPE_MASK |
  73. MM_READWRITE << MM_PROTECT_FIELD_SHIFT };
  74. //
  75. // PTE which generates an access violation when referenced.
  76. //
  77. const MMPTE NoAccessPte = {MM_NOACCESS << MM_PROTECT_FIELD_SHIFT};
  78. //
  79. // Pool start and end.
  80. //
  81. PVOID MmNonPagedPoolStart;
  82. PVOID MmNonPagedPoolEnd = (PVOID)MM_NONPAGED_POOL_END;
  83. PVOID MmPagedPoolStart = (PVOID)MM_PAGED_POOL_START;
  84. PVOID MmPagedPoolEnd;
  85. ULONG_PTR MmKseg2Frame = 0;
  86. //
  87. // Color tables for free and zeroed pages.
  88. //
  89. #if MM_MAXIMUM_NUMBER_OF_COLORS > 1
  90. MMPFNLIST MmFreePagesByPrimaryColor[2][MM_MAXIMUM_NUMBER_OF_COLORS];
  91. #endif
  92. PMMCOLOR_TABLES MmFreePagesByColor[2];
  93. //
  94. // Color tables for modified pages destined for the paging file.
  95. //
  96. MMPFNLIST MmModifiedPageListByColor[MM_MAXIMUM_NUMBER_OF_COLORS] = {
  97. 0, ModifiedPageList, MM_EMPTY_LIST, MM_EMPTY_LIST};
  98. //
  99. // Count of the number of modified pages destined for the paging file.
  100. //
  101. PFN_NUMBER MmTotalPagesForPagingFile = 0;
  102. //
  103. // Pte reserved for mapping pages for the debugger.
  104. //
  105. PMMPTE MmDebugPte;
  106. //
  107. // 16 PTEs reserved for mapping MDLs (64k max).
  108. //
  109. PMMPTE MmCrashDumpPte;
  110. //
  111. // Maximum size of system cache
  112. //
  113. ULONG MiMaximumSystemCacheSize;
  114. //
  115. // Supported Page Size Information
  116. //
  117. ULONGLONG MmPageSizeInfo = 0;
  118. #if defined(_MIALT4K_)
  119. //
  120. // Map a IA32 compatible PTE protection from Pte.Protect field
  121. //
  122. ULONG MmProtectToPteMaskForIA32[32] = {
  123. MM_PTE_NOACCESS,
  124. MM_PTE_EXECUTE_READ | MM_PTE_CACHE,
  125. MM_PTE_EXECUTE_READ | MM_PTE_CACHE,
  126. MM_PTE_EXECUTE_READ | MM_PTE_CACHE,
  127. MM_PTE_EXECUTE_READWRITE | MM_PTE_CACHE,
  128. MM_PTE_EXECUTE_WRITECOPY | MM_PTE_CACHE,
  129. MM_PTE_EXECUTE_READWRITE | MM_PTE_CACHE,
  130. MM_PTE_EXECUTE_WRITECOPY | MM_PTE_CACHE,
  131. MM_PTE_NOACCESS,
  132. MM_PTE_NOCACHE | MM_PTE_EXECUTE_READ,
  133. MM_PTE_NOCACHE | MM_PTE_EXECUTE_READ,
  134. MM_PTE_NOCACHE | MM_PTE_EXECUTE_READ,
  135. MM_PTE_NOCACHE | MM_PTE_EXECUTE_READWRITE,
  136. MM_PTE_NOCACHE | MM_PTE_EXECUTE_WRITECOPY,
  137. MM_PTE_NOCACHE | MM_PTE_EXECUTE_READWRITE,
  138. MM_PTE_NOCACHE | MM_PTE_EXECUTE_WRITECOPY,
  139. MM_PTE_NOACCESS,
  140. MM_PTE_GUARD | MM_PTE_EXECUTE_READ | MM_PTE_CACHE,
  141. MM_PTE_GUARD | MM_PTE_EXECUTE_READ | MM_PTE_CACHE,
  142. MM_PTE_GUARD | MM_PTE_EXECUTE_READ | MM_PTE_CACHE,
  143. MM_PTE_GUARD | MM_PTE_EXECUTE_READWRITE | MM_PTE_CACHE,
  144. MM_PTE_GUARD | MM_PTE_EXECUTE_WRITECOPY | MM_PTE_CACHE,
  145. MM_PTE_GUARD | MM_PTE_EXECUTE_READWRITE | MM_PTE_CACHE,
  146. MM_PTE_GUARD | MM_PTE_EXECUTE_WRITECOPY | MM_PTE_CACHE,
  147. MM_PTE_NOACCESS,
  148. MM_PTE_NOCACHE | MM_PTE_GUARD | MM_PTE_EXECUTE_READ,
  149. MM_PTE_NOCACHE | MM_PTE_GUARD | MM_PTE_EXECUTE_READ,
  150. MM_PTE_NOCACHE | MM_PTE_GUARD | MM_PTE_EXECUTE_READ,
  151. MM_PTE_NOCACHE | MM_PTE_GUARD | MM_PTE_EXECUTE_READWRITE,
  152. MM_PTE_NOCACHE | MM_PTE_GUARD | MM_PTE_EXECUTE_WRITECOPY,
  153. MM_PTE_NOCACHE | MM_PTE_GUARD | MM_PTE_EXECUTE_READWRITE,
  154. MM_PTE_NOCACHE | MM_PTE_GUARD | MM_PTE_EXECUTE_WRITECOPY
  155. };
  156. ULONG MmProtectToPteMaskForSplit[32] = {
  157. MM_PTE_NOACCESS,
  158. MM_PTE_EXECUTE_READ | MM_PTE_CACHE,
  159. MM_PTE_EXECUTE_READ | MM_PTE_CACHE,
  160. MM_PTE_EXECUTE_READ | MM_PTE_CACHE,
  161. MM_PTE_EXECUTE_READ | MM_PTE_CACHE,
  162. MM_PTE_EXECUTE_WRITECOPY | MM_PTE_CACHE,
  163. MM_PTE_EXECUTE_READ | MM_PTE_CACHE,
  164. MM_PTE_EXECUTE_WRITECOPY | MM_PTE_CACHE,
  165. MM_PTE_NOACCESS,
  166. MM_PTE_NOCACHE | MM_PTE_EXECUTE_READ,
  167. MM_PTE_NOCACHE | MM_PTE_EXECUTE_READ,
  168. MM_PTE_NOCACHE | MM_PTE_EXECUTE_READ,
  169. MM_PTE_NOCACHE | MM_PTE_EXECUTE_READ,
  170. MM_PTE_NOCACHE | MM_PTE_EXECUTE_WRITECOPY,
  171. MM_PTE_NOCACHE | MM_PTE_EXECUTE_READWRITE,
  172. MM_PTE_NOCACHE | MM_PTE_EXECUTE_WRITECOPY,
  173. MM_PTE_NOACCESS,
  174. MM_PTE_GUARD | MM_PTE_EXECUTE_READ | MM_PTE_CACHE,
  175. MM_PTE_GUARD | MM_PTE_EXECUTE_READ | MM_PTE_CACHE,
  176. MM_PTE_GUARD | MM_PTE_EXECUTE_READ | MM_PTE_CACHE,
  177. MM_PTE_GUARD | MM_PTE_EXECUTE_READ | MM_PTE_CACHE,
  178. MM_PTE_GUARD | MM_PTE_EXECUTE_WRITECOPY | MM_PTE_CACHE,
  179. MM_PTE_GUARD | MM_PTE_EXECUTE_READ | MM_PTE_CACHE,
  180. MM_PTE_GUARD | MM_PTE_EXECUTE_WRITECOPY | MM_PTE_CACHE,
  181. MM_PTE_NOACCESS,
  182. MM_PTE_NOCACHE | MM_PTE_GUARD | MM_PTE_EXECUTE_READ,
  183. MM_PTE_NOCACHE | MM_PTE_GUARD | MM_PTE_EXECUTE_READ,
  184. MM_PTE_NOCACHE | MM_PTE_GUARD | MM_PTE_EXECUTE_READ,
  185. MM_PTE_NOCACHE | MM_PTE_GUARD | MM_PTE_EXECUTE_READ,
  186. MM_PTE_NOCACHE | MM_PTE_GUARD | MM_PTE_EXECUTE_WRITECOPY,
  187. MM_PTE_NOCACHE | MM_PTE_GUARD | MM_PTE_EXECUTE_READ,
  188. MM_PTE_NOCACHE | MM_PTE_GUARD | MM_PTE_EXECUTE_WRITECOPY
  189. };
  190. #endif