ReactOS  0.4.12-dev-396-g37af787
miarm.h
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Kernel
3  * LICENSE: BSD - See COPYING.ARM in the top level directory
4  * FILE: ntoskrnl/mm/ARM3/miarm.h
5  * PURPOSE: ARM Memory Manager Header
6  * PROGRAMMERS: ReactOS Portable Systems Group
7  */
8 
9 #pragma once
10 
11 #define MI_LOWEST_VAD_ADDRESS (PVOID)MM_LOWEST_USER_ADDRESS
12 
13 /* Make the code cleaner with some definitions for size multiples */
14 #define _1KB (1024u)
15 #define _1MB (1024 * _1KB)
16 #define _1GB (1024 * _1MB)
17 
18 /* Everyone loves 64K */
19 #define _64K (64 * _1KB)
20 
21 /* Area mapped by a PDE */
22 #define PDE_MAPPED_VA (PTE_COUNT * PAGE_SIZE)
23 
24 /* Size of a page table */
25 #define PT_SIZE (PTE_COUNT * sizeof(MMPTE))
26 
27 /* Size of a page directory */
28 #define PD_SIZE (PDE_COUNT * sizeof(MMPDE))
29 
30 /* Stop using these! */
31 #define PD_COUNT PPE_PER_PAGE
32 #define PDE_COUNT PDE_PER_PAGE
33 #define PTE_COUNT PTE_PER_PAGE
34 
35 /* Size of all page directories for a process */
36 #define SYSTEM_PD_SIZE (PD_COUNT * PD_SIZE)
37 #ifdef _M_IX86
39 #endif
40 
41 //
42 // Protection Bits part of the internal memory manager Protection Mask, from:
43 // http://reactos.org/wiki/Techwiki:Memory_management_in_the_Windows_XP_kernel
44 // https://www.reactos.org/wiki/Techwiki:Memory_Protection_constants
45 // and public assertions.
46 //
47 #define MM_ZERO_ACCESS 0
48 #define MM_READONLY 1
49 #define MM_EXECUTE 2
50 #define MM_EXECUTE_READ 3
51 #define MM_READWRITE 4
52 #define MM_WRITECOPY 5
53 #define MM_EXECUTE_READWRITE 6
54 #define MM_EXECUTE_WRITECOPY 7
55 #define MM_PROTECT_ACCESS 7
56 
57 //
58 // These are flags on top of the actual protection mask
59 //
60 #define MM_NOCACHE 0x08
61 #define MM_GUARDPAGE 0x10
62 #define MM_WRITECOMBINE 0x18
63 #define MM_PROTECT_SPECIAL 0x18
64 
65 //
66 // These are special cases
67 //
68 #define MM_DECOMMIT (MM_ZERO_ACCESS | MM_GUARDPAGE)
69 #define MM_NOACCESS (MM_ZERO_ACCESS | MM_WRITECOMBINE)
70 #define MM_OUTSWAPPED_KSTACK (MM_EXECUTE_WRITECOPY | MM_WRITECOMBINE)
71 #define MM_INVALID_PROTECTION 0xFFFFFFFF
72 
73 //
74 // Specific PTE Definitions that map to the Memory Manager's Protection Mask Bits
75 // The Memory Manager's definition define the attributes that must be preserved
76 // and these PTE definitions describe the attributes in the hardware sense. This
77 // helps deal with hardware differences between the actual boolean expression of
78 // the argument.
79 //
80 // For example, in the logical attributes, we want to express read-only as a flag
81 // but on x86, it is writability that must be set. On the other hand, on x86, just
82 // like in the kernel, it is disabling the caches that requires a special flag,
83 // while on certain architectures such as ARM, it is enabling the cache which
84 // requires a flag.
85 //
86 #if defined(_M_IX86)
87 //
88 // Access Flags
89 //
90 #define PTE_READONLY 0 // Doesn't exist on x86
91 #define PTE_EXECUTE 0 // Not worrying about NX yet
92 #define PTE_EXECUTE_READ 0 // Not worrying about NX yet
93 #define PTE_READWRITE 0x2
94 #define PTE_WRITECOPY 0x200
95 #define PTE_EXECUTE_READWRITE 0x2 // Not worrying about NX yet
96 #define PTE_EXECUTE_WRITECOPY 0x200
97 #define PTE_PROTOTYPE 0x400
98 
99 //
100 // State Flags
101 //
102 #define PTE_VALID 0x1
103 #define PTE_ACCESSED 0x20
104 #define PTE_DIRTY 0x40
105 
106 //
107 // Cache flags
108 //
109 #define PTE_ENABLE_CACHE 0
110 #define PTE_DISABLE_CACHE 0x10
111 #define PTE_WRITECOMBINED_CACHE 0x10
112 #define PTE_PROTECT_MASK 0x612
113 #elif defined(_M_AMD64)
114 //
115 // Access Flags
116 //
117 #define PTE_READONLY 0x8000000000000000ULL
118 #define PTE_EXECUTE 0x0000000000000000ULL
119 #define PTE_EXECUTE_READ PTE_EXECUTE /* EXECUTE implies READ on x64 */
120 #define PTE_READWRITE 0x8000000000000002ULL
121 #define PTE_WRITECOPY 0x8000000000000200ULL
122 #define PTE_EXECUTE_READWRITE 0x0000000000000002ULL
123 #define PTE_EXECUTE_WRITECOPY 0x0000000000000200ULL
124 #define PTE_PROTOTYPE 0x0000000000000400ULL
125 
126 //
127 // State Flags
128 //
129 #define PTE_VALID 0x0000000000000001ULL
130 #define PTE_ACCESSED 0x0000000000000020ULL
131 #define PTE_DIRTY 0x0000000000000040ULL
132 
133 //
134 // Cache flags
135 //
136 #define PTE_ENABLE_CACHE 0x0000000000000000ULL
137 #define PTE_DISABLE_CACHE 0x0000000000000010ULL
138 #define PTE_WRITECOMBINED_CACHE 0x0000000000000010ULL
139 #define PTE_PROTECT_MASK 0x8000000000000612ULL
140 #elif defined(_M_ARM)
141 #define PTE_READONLY 0x200
142 #define PTE_EXECUTE 0 // Not worrying about NX yet
143 #define PTE_EXECUTE_READ 0 // Not worrying about NX yet
144 #define PTE_READWRITE 0 // Doesn't exist on ARM
145 #define PTE_WRITECOPY 0 // Doesn't exist on ARM
146 #define PTE_EXECUTE_READWRITE 0 // Not worrying about NX yet
147 #define PTE_EXECUTE_WRITECOPY 0 // Not worrying about NX yet
148 #define PTE_PROTOTYPE 0x400 // Using the Shared bit
149 
150 //
151 // Cache flags
152 //
153 #define PTE_ENABLE_CACHE 0
154 #define PTE_DISABLE_CACHE 0x10
155 #define PTE_WRITECOMBINED_CACHE 0x10
156 #define PTE_PROTECT_MASK 0x610
157 #else
158 #error Define these please!
159 #endif
160 
161 //
162 // Mask for image section page protection
163 //
164 #define IMAGE_SCN_PROTECTION_MASK (IMAGE_SCN_MEM_WRITE | IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_EXECUTE)
165 
166 extern const ULONG_PTR MmProtectToPteMask[32];
167 extern const ULONG MmProtectToValue[32];
168 
169 //
170 // Assertions for session images, addresses, and PTEs
171 //
172 #define MI_IS_SESSION_IMAGE_ADDRESS(Address) \
173  (((Address) >= MiSessionImageStart) && ((Address) < MiSessionImageEnd))
174 
175 #define MI_IS_SESSION_ADDRESS(Address) \
176  (((Address) >= MmSessionBase) && ((Address) < MiSessionSpaceEnd))
177 
178 #define MI_IS_SESSION_PTE(Pte) \
179  ((((PMMPTE)Pte) >= MiSessionBasePte) && (((PMMPTE)Pte) < MiSessionLastPte))
180 
181 #define MI_IS_PAGE_TABLE_ADDRESS(Address) \
182  (((PVOID)(Address) >= (PVOID)PTE_BASE) && ((PVOID)(Address) <= (PVOID)PTE_TOP))
183 
184 #define MI_IS_SYSTEM_PAGE_TABLE_ADDRESS(Address) \
185  (((Address) >= (PVOID)MiAddressToPte(MmSystemRangeStart)) && ((Address) <= (PVOID)PTE_TOP))
186 
187 #define MI_IS_PAGE_TABLE_OR_HYPER_ADDRESS(Address) \
188  (((PVOID)(Address) >= (PVOID)PTE_BASE) && ((PVOID)(Address) <= (PVOID)MmHyperSpaceEnd))
189 
190 //
191 // Creates a software PTE with the given protection
192 //
193 #define MI_MAKE_SOFTWARE_PTE(p, x) ((p)->u.Long = (x << MM_PTE_SOFTWARE_PROTECTION_BITS))
194 
195 //
196 // Marks a PTE as deleted
197 //
198 #define MI_SET_PFN_DELETED(x) ((x)->PteAddress = (PMMPTE)((ULONG_PTR)(x)->PteAddress | 1))
199 #define MI_IS_PFN_DELETED(x) ((ULONG_PTR)((x)->PteAddress) & 1)
200 
201 //
202 // Special values for LoadedImports
203 //
204 #ifdef _WIN64
205 #define MM_SYSLDR_NO_IMPORTS (PVOID)0xFFFFFFFFFFFFFFFEULL
206 #define MM_SYSLDR_BOOT_LOADED (PVOID)0xFFFFFFFFFFFFFFFFULL
207 #else
208 #define MM_SYSLDR_NO_IMPORTS (PVOID)0xFFFFFFFE
209 #define MM_SYSLDR_BOOT_LOADED (PVOID)0xFFFFFFFF
210 #endif
211 #define MM_SYSLDR_SINGLE_ENTRY 0x1
212 
213 //
214 // Number of initial session IDs
215 //
216 #define MI_INITIAL_SESSION_IDS 64
217 
218 #if defined(_M_IX86) || defined(_M_ARM)
219 //
220 // PFN List Sentinel
221 //
222 #define LIST_HEAD 0xFFFFFFFF
223 
224 //
225 // Because GCC cannot automatically downcast 0xFFFFFFFF to lesser-width bits,
226 // we need a manual definition suited to the number of bits in the PteFrame.
227 // This is used as a LIST_HEAD for the colored list
228 //
229 #define COLORED_LIST_HEAD ((1 << 25) - 1) // 0x1FFFFFF
230 #elif defined(_M_AMD64)
231 #define LIST_HEAD 0xFFFFFFFFFFFFFFFFLL
232 #define COLORED_LIST_HEAD ((1ULL << 57) - 1) // 0x1FFFFFFFFFFFFFFLL
233 #else
234 #error Define these please!
235 #endif
236 
237 //
238 // Special IRQL value (found in assertions)
239 //
240 #define MM_NOIRQL (KIRQL)0xFFFFFFFF
241 
242 //
243 // Returns the color of a page
244 //
245 #define MI_GET_PAGE_COLOR(x) ((x) & MmSecondaryColorMask)
246 #define MI_GET_NEXT_COLOR() (MI_GET_PAGE_COLOR(++MmSystemPageColor))
247 #define MI_GET_NEXT_PROCESS_COLOR(x) (MI_GET_PAGE_COLOR(++(x)->NextPageColor))
248 
249 //
250 // Prototype PTEs that don't yet have a pagefile association
251 //
252 #ifdef _WIN64
253 #define MI_PTE_LOOKUP_NEEDED 0xffffffffULL
254 #else
255 #define MI_PTE_LOOKUP_NEEDED 0xFFFFF
256 #endif
257 
258 //
259 // Number of session data and tag pages
260 //
261 #define MI_SESSION_DATA_PAGES_MAXIMUM (MM_ALLOCATION_GRANULARITY / PAGE_SIZE)
262 #define MI_SESSION_TAG_PAGES_MAXIMUM (MM_ALLOCATION_GRANULARITY / PAGE_SIZE)
263 
264 //
265 // Used by MiCheckSecuredVad
266 //
267 #define MM_READ_WRITE_ALLOWED 11
268 #define MM_READ_ONLY_ALLOWED 10
269 #define MM_NO_ACCESS_ALLOWED 01
270 #define MM_DELETE_CHECK 85
271 
272 //
273 // System views are binned into 64K chunks
274 //
275 #define MI_SYSTEM_VIEW_BUCKET_SIZE _64K
276 
277 //
278 // FIXFIX: These should go in ex.h after the pool merge
279 //
280 #ifdef _WIN64
281 #define POOL_BLOCK_SIZE 16
282 #else
283 #define POOL_BLOCK_SIZE 8
284 #endif
285 #define POOL_LISTS_PER_PAGE (PAGE_SIZE / POOL_BLOCK_SIZE)
286 #define BASE_POOL_TYPE_MASK 1
287 #define POOL_MAX_ALLOC (PAGE_SIZE - (sizeof(POOL_HEADER) + POOL_BLOCK_SIZE))
288 
289 //
290 // Pool debugging/analysis/tracing flags
291 //
292 #define POOL_FLAG_CHECK_TIMERS 0x1
293 #define POOL_FLAG_CHECK_WORKERS 0x2
294 #define POOL_FLAG_CHECK_RESOURCES 0x4
295 #define POOL_FLAG_VERIFIER 0x8
296 #define POOL_FLAG_CHECK_DEADLOCK 0x10
297 #define POOL_FLAG_SPECIAL_POOL 0x20
298 #define POOL_FLAG_DBGPRINT_ON_FAILURE 0x40
299 #define POOL_FLAG_CRASH_ON_FAILURE 0x80
300 
301 //
302 // BAD_POOL_HEADER codes during pool bugcheck
303 //
304 #define POOL_CORRUPTED_LIST 3
305 #define POOL_SIZE_OR_INDEX_MISMATCH 5
306 #define POOL_ENTRIES_NOT_ALIGNED_PREVIOUS 6
307 #define POOL_HEADER_NOT_ALIGNED 7
308 #define POOL_HEADER_IS_ZERO 8
309 #define POOL_ENTRIES_NOT_ALIGNED_NEXT 9
310 #define POOL_ENTRY_NOT_FOUND 10
311 
312 //
313 // BAD_POOL_CALLER codes during pool bugcheck
314 //
315 #define POOL_ENTRY_CORRUPTED 1
316 #define POOL_ENTRY_ALREADY_FREE 6
317 #define POOL_ENTRY_NOT_ALLOCATED 7
318 #define POOL_ALLOC_IRQL_INVALID 8
319 #define POOL_FREE_IRQL_INVALID 9
320 #define POOL_BILLED_PROCESS_INVALID 13
321 #define POOL_HEADER_SIZE_INVALID 32
322 
323 typedef struct _POOL_DESCRIPTOR
324 {
339 
340 typedef struct _POOL_HEADER
341 {
342  union
343  {
344  struct
345  {
346 #ifdef _WIN64
348  USHORT PoolIndex:8;
349  USHORT BlockSize:8;
350  USHORT PoolType:8;
351 #else
353  USHORT PoolIndex:7;
354  USHORT BlockSize:9;
355  USHORT PoolType:7;
356 #endif
357  };
358  ULONG Ulong1;
359  };
360 #ifdef _WIN64
361  ULONG PoolTag;
362 #endif
363  union
364  {
365 #ifdef _WIN64
366  PEPROCESS ProcessBilled;
367 #else
368  ULONG PoolTag;
369 #endif
370  struct
371  {
374  };
375  };
377 
380 
381 typedef struct _POOL_TRACKER_TABLE
382 {
391 
393 {
399 
404 
405 //
406 // END FIXFIX
407 //
408 
410 {
414 
416 {
421 
423 {
429 
430 typedef struct _PHYSICAL_MEMORY_RUN
431 {
435 
437 {
442 
443 typedef struct _MMCOLOR_TABLES
444 {
449 
450 typedef struct _MI_LARGE_PAGE_RANGES
451 {
455 
456 typedef struct _MMVIEW
457 {
460 } MMVIEW, *PMMVIEW;
461 
462 typedef struct _MMSESSION
463 {
474 
476 {
481 
482 typedef struct _MM_SESSION_SPACE
483 {
486  union
487  {
490  } u;
518 #if defined (_M_AMD64)
519  MMPDE PageDirectory;
520 #else
522 #endif
523 #if defined (_M_AMD64)
524  PMMPTE SpecialPoolFirstPte;
525  PMMPTE SpecialPoolLastPte;
526  PMMPTE NextPdeForSpecialPoolExpansion;
527  PMMPTE LastPdeForSpecialPoolExpansion;
528  PFN_NUMBER SpecialPagesInUse;
529 #endif
532 
534 extern MMPTE HyperTemplatePte;
535 extern MMPDE ValidKernelPde;
536 extern MMPTE ValidKernelPte;
539 extern MMPDE DemandZeroPde;
540 extern MMPTE DemandZeroPte;
541 extern MMPTE PrototypePte;
542 extern MMPTE MmDecommittedPte;
544 extern BOOLEAN MmZeroPageFile;
547 extern BOOLEAN MmTrackPtes;
548 extern BOOLEAN MmDynamicPfn;
549 extern BOOLEAN MmMirroring;
550 extern BOOLEAN MmMakeLowMemory;
556 extern WCHAR MmVerifyDriverBuffer[512];
557 extern WCHAR MmLargePageDriverBuffer[512];
569 extern PVOID MmNonPagedPoolEnd;
571 extern PVOID MmPagedPoolStart;
572 extern PVOID MmPagedPoolEnd;
573 extern PVOID MmSessionBase;
574 extern SIZE_T MmSessionSize;
579 extern SIZE_T MmBootImageSize;
586 extern RTL_BITMAP MiPfnBitMap;
592 extern PVOID MiSystemViewStart;
593 extern SIZE_T MmSystemViewSize;
595 extern PVOID MiSessionSpaceEnd;
598 extern PMMPTE MiSessionBasePte;
599 extern PMMPTE MiSessionLastPte;
601 extern PMMPDE MmSystemPagePtes;
603 extern PVOID MmSystemCacheEnd;
606 extern ULONG MmSpecialPoolTag;
607 extern PVOID MmHyperSpaceEnd;
613 extern ULONG MmSecondaryColors;
617 extern ULONG MmLargeStackSize;
620 extern ULONG MmProductType;
644 extern PVOID MiSessionImageEnd;
645 extern PMMPTE MiHighestUserPte;
646 extern PMMPDE MiHighestUserPde;
652 extern ULONG MmSystemPageColor;
654 extern PMMWSL MmWorkingSetList;
660 extern PVOID MiSessionPoolEnd; // 0xBE000000
661 extern PVOID MiSessionPoolStart; // 0xBD000000
662 extern PVOID MiSessionViewStart; // 0xBE000000
663 extern PVOID MiSessionSpaceWs;
668 extern PVOID MmHighSectionBase;
675 
677 BOOLEAN
679 {
680  return ((MemoryType == LoaderFree) ||
681  (MemoryType == LoaderLoadedProgram) ||
682  (MemoryType == LoaderFirmwareTemporary) ||
683  (MemoryType == LoaderOsloaderStack));
684 }
685 
687 BOOLEAN
689 {
690  return ((MemoryType == LoaderFirmwarePermanent) ||
691  (MemoryType == LoaderSpecialMemory) ||
692  (MemoryType == LoaderHALCachedMemory) ||
693  (MemoryType == LoaderBBTMemory));
694 }
695 
696 #ifdef _M_AMD64
698 BOOLEAN
699 MiIsUserPxe(PVOID Address)
700 {
701  return ((ULONG_PTR)Address >> 7) == 0x1FFFFEDF6FB7DA0ULL;
702 }
703 
705 BOOLEAN
706 MiIsUserPpe(PVOID Address)
707 {
708  return ((ULONG_PTR)Address >> 16) == 0xFFFFF6FB7DA0ULL;
709 }
710 
712 BOOLEAN
714 {
715  return ((ULONG_PTR)Address >> 25) == 0x7FFFFB7DA0ULL;
716 }
717 
719 BOOLEAN
721 {
722  return ((ULONG_PTR)Address >> 34) == 0x3FFFFDA0ULL;
723 }
724 #else
726 BOOLEAN
728 {
729  return ((Address >= (PVOID)MiAddressToPde(NULL)) &&
731 }
732 
734 BOOLEAN
736 {
737  return (Address <= (PVOID)MiHighestUserPte);
738 }
739 #endif
740 
741 //
742 // Figures out the hardware bits for a PTE
743 //
745 ULONG_PTR
747 {
748  MMPTE TempPte;
749 
750  /* Start fresh */
751  TempPte.u.Long = 0;
752 
753  /* Make it valid and accessed */
754  TempPte.u.Hard.Valid = TRUE;
756 
757  /* Is this for user-mode? */
758  if (
759 #if (_MI_PAGING_LEVELS == 4)
760  MiIsUserPxe(PointerPte) ||
761 #endif
762 #if (_MI_PAGING_LEVELS >= 3)
763  MiIsUserPpe(PointerPte) ||
764 #endif
765  MiIsUserPde(PointerPte) ||
766  MiIsUserPte(PointerPte))
767  {
768  /* Set the owner bit */
770  }
771 
772  /* FIXME: We should also set the global bit */
773 
774  /* Return the protection */
775  return TempPte.u.Long;
776 }
777 
778 //
779 // Creates a valid kernel PTE with the given protection
780 //
782 VOID
784  IN PMMPTE MappingPte,
785  IN ULONG_PTR ProtectionMask,
786  IN PFN_NUMBER PageFrameNumber)
787 {
788  /* Only valid for kernel, non-session PTEs */
789  ASSERT(MappingPte > MiHighestUserPte);
790  ASSERT(!MI_IS_SESSION_PTE(MappingPte));
791  ASSERT((MappingPte < (PMMPTE)PDE_BASE) || (MappingPte > (PMMPTE)PDE_TOP));
792 
793  /* Start fresh */
794  *NewPte = ValidKernelPte;
795 
796  /* Set the protection and page */
797  NewPte->u.Hard.PageFrameNumber = PageFrameNumber;
798  NewPte->u.Long |= MmProtectToPteMask[ProtectionMask];
799 }
800 
801 //
802 // Creates a valid PTE with the given protection
803 //
805 VOID
807  IN PMMPTE MappingPte,
808  IN ULONG_PTR ProtectionMask,
809  IN PFN_NUMBER PageFrameNumber)
810 {
811  /* Set the protection and page */
812  NewPte->u.Long = MiDetermineUserGlobalPteMask(MappingPte);
813  NewPte->u.Long |= MmProtectToPteMask[ProtectionMask];
814  NewPte->u.Hard.PageFrameNumber = PageFrameNumber;
815 }
816 
817 //
818 // Creates a valid user PTE with the given protection
819 //
821 VOID
823  IN PMMPTE MappingPte,
824  IN ULONG_PTR ProtectionMask,
825  IN PFN_NUMBER PageFrameNumber)
826 {
827  /* Only valid for kernel, non-session PTEs */
828  ASSERT(MappingPte <= MiHighestUserPte);
829 
830  /* Start fresh */
831  NewPte->u.Long = 0;
832 
833  /* Set the protection and page */
834  NewPte->u.Hard.Valid = TRUE;
835  NewPte->u.Hard.Owner = TRUE;
836  NewPte->u.Hard.PageFrameNumber = PageFrameNumber;
837  NewPte->u.Long |= MmProtectToPteMask[ProtectionMask];
838 }
839 
840 #ifndef _M_AMD64
841 //
842 // Builds a Prototype PTE for the address of the PTE
843 //
845 VOID
847  IN PMMPTE PointerPte)
848 {
850 
851  /* Mark this as a prototype */
852  NewPte->u.Long = 0;
853  NewPte->u.Proto.Prototype = 1;
854 
855  /*
856  * Prototype PTEs are only valid in paged pool by design, this little trick
857  * lets us only use 30 bits for the adress of the PTE, as long as the area
858  * stays 1024MB At most.
859  */
860  Offset = (ULONG_PTR)PointerPte - (ULONG_PTR)MmPagedPoolStart;
861 
862  /*
863  * 7 bits go in the "low" (but we assume the bottom 2 are zero)
864  * and the other 21 bits go in the "high"
865  */
866  NewPte->u.Proto.ProtoAddressLow = (Offset & 0x1FC) >> 2;
867  NewPte->u.Proto.ProtoAddressHigh = (Offset & 0x3FFFFE00) >> 9;
868 }
869 
870 //
871 // Builds a Subsection PTE for the address of the Segment
872 //
874 VOID
876  IN PVOID Segment)
877 {
879 
880  /* Mark this as a prototype */
881  NewPte->u.Long = 0;
882  NewPte->u.Subsect.Prototype = 1;
883 
884  /*
885  * Segments are only valid either in nonpaged pool. We store the 20 bit
886  * difference either from the top or bottom of nonpaged pool, giving a
887  * maximum of 128MB to each delta, meaning nonpaged pool cannot exceed
888  * 256MB.
889  */
890  if ((ULONG_PTR)Segment < ((ULONG_PTR)MmSubsectionBase + (128 * _1MB)))
891  {
893  NewPte->u.Subsect.WhichPool = PagedPool;
894  }
895  else
896  {
898  NewPte->u.Subsect.WhichPool = NonPagedPool;
899  }
900 
901  /*
902  * 4 bits go in the "low" (but we assume the bottom 3 are zero)
903  * and the other 20 bits go in the "high"
904  */
905  NewPte->u.Subsect.SubsectionAddressLow = (Offset & 0x78) >> 3;
906  NewPte->u.Subsect.SubsectionAddressHigh = (Offset & 0xFFFFF80) >> 7;
907 }
908 
910 BOOLEAN
912 {
914  return ((PointerPte->u.Long & 0xFFFFFC01) != 0);
915 }
916 
917 #endif
918 
920 VOID
922  _In_ PFN_NUMBER Page,
923  _In_ ULONG Protection)
924 {
925  NewPte->u.Long = 0;
926  NewPte->u.Trans.Transition = 1;
927  NewPte->u.Trans.Protection = Protection;
928  NewPte->u.Trans.PageFrameNumber = Page;
929 }
930 
931 //
932 // Returns if the page is physically resident (ie: a large page)
933 // FIXFIX: CISC/x86 only?
934 //
936 BOOLEAN
938 {
939  PMMPDE PointerPde;
940 
941  /* Large pages are never paged out, always physically resident */
942  PointerPde = MiAddressToPde(Address);
943  return ((PointerPde->u.Hard.LargePage) && (PointerPde->u.Hard.Valid));
944 }
945 
946 //
947 // Writes a valid PTE
948 //
950 VOID
952  IN MMPTE TempPte)
953 {
954  /* Write the valid PTE */
955  ASSERT(PointerPte->u.Hard.Valid == 0);
956  ASSERT(TempPte.u.Hard.Valid == 1);
957  *PointerPte = TempPte;
958 }
959 
960 //
961 // Updates a valid PTE
962 //
964 VOID
966  IN MMPTE TempPte)
967 {
968  /* Write the valid PTE */
969  ASSERT(PointerPte->u.Hard.Valid == 1);
970  ASSERT(TempPte.u.Hard.Valid == 1);
971  ASSERT(PointerPte->u.Hard.PageFrameNumber == TempPte.u.Hard.PageFrameNumber);
972  *PointerPte = TempPte;
973 }
974 
975 //
976 // Writes an invalid PTE
977 //
979 VOID
981  IN MMPTE InvalidPte)
982 {
983  /* Write the invalid PTE */
984  ASSERT(InvalidPte.u.Hard.Valid == 0);
985  ASSERT(InvalidPte.u.Long != 0);
986  *PointerPte = InvalidPte;
987 }
988 
989 //
990 // Erase the PTE completely
991 //
993 VOID
994 MI_ERASE_PTE(IN PMMPTE PointerPte)
995 {
996  /* Zero out the PTE */
997  ASSERT(PointerPte->u.Long != 0);
998  PointerPte->u.Long = 0;
999 }
1000 
1001 //
1002 // Writes a valid PDE
1003 //
1005 VOID
1007  IN MMPDE TempPde)
1008 {
1009  /* Write the valid PDE */
1010  ASSERT(PointerPde->u.Hard.Valid == 0);
1011  ASSERT(TempPde.u.Hard.Valid == 1);
1012  *PointerPde = TempPde;
1013 }
1014 
1015 //
1016 // Writes an invalid PDE
1017 //
1019 VOID
1021  IN MMPDE InvalidPde)
1022 {
1023  /* Write the invalid PDE */
1024  ASSERT(InvalidPde.u.Hard.Valid == 0);
1025  ASSERT(InvalidPde.u.Long != 0);
1026  *PointerPde = InvalidPde;
1027 }
1028 
1029 //
1030 // Checks if the thread already owns a working set
1031 //
1033 BOOLEAN
1035 {
1036  /* If any of these are held, return TRUE */
1043 }
1044 
1045 //
1046 // Checks if the process owns the working set lock
1047 //
1049 BOOLEAN
1051 {
1052  /* Check if this process is the owner, and that the thread owns the WS */
1053  if (PsGetCurrentThread()->OwnsProcessWorkingSetExclusive == 0)
1054  {
1055  DPRINT("Thread: %p is not an owner\n", PsGetCurrentThread());
1056  }
1057  if (KeGetCurrentThread()->ApcState.Process != &Process->Pcb)
1058  {
1059  DPRINT("Current thread %p is attached to another process %p\n", PsGetCurrentThread(), Process);
1060  }
1061  return ((KeGetCurrentThread()->ApcState.Process == &Process->Pcb) &&
1062  ((PsGetCurrentThread()->OwnsProcessWorkingSetExclusive) ||
1063  (PsGetCurrentThread()->OwnsProcessWorkingSetShared)));
1064 }
1065 
1066 //
1067 // New ARM3<->RosMM PAGE Architecture
1068 //
1070 BOOLEAN
1072 {
1073  PROS_SECTION_OBJECT RosSection = Section;
1074  if ((RosSection->Type == 'SC') && (RosSection->Size == 'TN')) return TRUE;
1075  return FALSE;
1076 }
1077 
1078 #define MI_IS_ROS_PFN(x) ((x)->u4.AweAllocation == TRUE)
1079 
1080 VOID
1081 NTAPI
1083  IN PMMPFN Pfn1,
1084  IN PFN_NUMBER PageFrameIndex
1085 );
1086 
1088 BOOLEAN
1090 {
1091  return (Process->Vm.Flags.AcquiredUnsafe == TRUE);
1092 }
1093 
1094 //
1095 // Locks the working set for the given process
1096 //
1098 VOID
1100  IN PETHREAD Thread)
1101 {
1102  /* Shouldn't already be owning the process working set */
1105 
1106  /* Block APCs, make sure that still nothing is already held */
1109 
1110  /* Lock the working set */
1111  ExAcquirePushLockExclusive(&Process->Vm.WorkingSetMutex);
1112 
1113  /* Now claim that we own the lock */
1117 }
1118 
1120 VOID
1122  IN PETHREAD Thread)
1123 {
1124  /* Shouldn't already be owning the process working set */
1127 
1128  /* Block APCs, make sure that still nothing is already held */
1131 
1132  /* Lock the working set */
1133  ExAcquirePushLockShared(&Process->Vm.WorkingSetMutex);
1134 
1135  /* Now claim that we own the lock */
1140 }
1141 
1143 VOID
1145  IN PETHREAD Thread)
1146 {
1147  /* Shouldn't already be owning the process working set */
1149 
1150  /* APCs must be blocked, make sure that still nothing is already held */
1153 
1154  /* Lock the working set */
1155  ExAcquirePushLockExclusive(&Process->Vm.WorkingSetMutex);
1156 
1157  /* Now claim that we own the lock */
1159  Process->Vm.Flags.AcquiredUnsafe = 1;
1162 }
1163 
1164 //
1165 // Unlocks the working set for the given process
1166 //
1168 VOID
1170  IN PETHREAD Thread)
1171 {
1172  /* Make sure we are the owner of a safe acquisition */
1175 
1176  /* The thread doesn't own it anymore */
1179 
1180  /* Release the lock and re-enable APCs */
1181  ExReleasePushLockExclusive(&Process->Vm.WorkingSetMutex);
1183 }
1184 
1185 //
1186 // Unlocks the working set for the given process
1187 //
1189 VOID
1191  IN PETHREAD Thread)
1192 {
1193  /* Make sure we are the owner of a safe acquisition (because shared) */
1196 
1197  /* Ensure we are in a shared acquisition */
1200 
1201  /* Don't claim the lock anylonger */
1203 
1204  /* Release the lock and re-enable APCs */
1205  ExReleasePushLockShared(&Process->Vm.WorkingSetMutex);
1207 }
1208 
1209 //
1210 // Unlocks the working set for the given process
1211 //
1213 VOID
1215  IN PETHREAD Thread)
1216 {
1217  /* Make sure we are the owner of an unsafe acquisition */
1222 
1223  /* No longer unsafe */
1224  Process->Vm.Flags.AcquiredUnsafe = 0;
1225 
1226  /* The thread doesn't own it anymore */
1229 
1230  /* Release the lock but don't touch APC state */
1231  ExReleasePushLockExclusive(&Process->Vm.WorkingSetMutex);
1233 }
1234 
1235 //
1236 // Locks the working set
1237 //
1239 VOID
1241  IN PMMSUPPORT WorkingSet)
1242 {
1243  /* Block APCs */
1245 
1246  /* Working set should be in global memory */
1247  ASSERT(MI_IS_SESSION_ADDRESS((PVOID)WorkingSet) == FALSE);
1248 
1249  /* Thread shouldn't already be owning something */
1251 
1252  /* Lock this working set */
1253  ExAcquirePushLockExclusive(&WorkingSet->WorkingSetMutex);
1254 
1255  /* Which working set is this? */
1256  if (WorkingSet == &MmSystemCacheWs)
1257  {
1258  /* Own the system working set */
1262  }
1263  else if (WorkingSet->Flags.SessionSpace)
1264  {
1265  /* Own the session working set */
1269  }
1270  else
1271  {
1272  /* Own the process working set */
1276  }
1277 }
1278 
1279 //
1280 // Unlocks the working set
1281 //
1283 VOID
1285  IN PMMSUPPORT WorkingSet)
1286 {
1287  /* Working set should be in global memory */
1288  ASSERT(MI_IS_SESSION_ADDRESS((PVOID)WorkingSet) == FALSE);
1289 
1290  /* Which working set is this? */
1291  if (WorkingSet == &MmSystemCacheWs)
1292  {
1293  /* Release the system working set */
1297  }
1298  else if (WorkingSet->Flags.SessionSpace)
1299  {
1300  /* Release the session working set */
1304  }
1305  else
1306  {
1307  /* Release the process working set */
1311  }
1312 
1313  /* Release the working set lock */
1314  ExReleasePushLockExclusive(&WorkingSet->WorkingSetMutex);
1315 
1316  /* Unblock APCs */
1318 }
1319 
1321 VOID
1323  IN PETHREAD Thread,
1324  OUT PBOOLEAN Safe,
1325  OUT PBOOLEAN Shared)
1326 {
1328 
1329  /* Check if the current owner is unsafe */
1330  if (MI_IS_WS_UNSAFE(Process))
1331  {
1332  /* Release unsafely */
1334  *Safe = FALSE;
1335  *Shared = FALSE;
1336  }
1337  else if (Thread->OwnsProcessWorkingSetExclusive == 1)
1338  {
1339  /* Owner is safe and exclusive, release normally */
1341  *Safe = TRUE;
1342  *Shared = FALSE;
1343  }
1344  else
1345  {
1346  /* Owner is shared (implies safe), release normally */
1348  *Safe = TRUE;
1349  *Shared = TRUE;
1350  }
1351 }
1352 
1354 VOID
1356  IN PETHREAD Thread,
1357  IN BOOLEAN Safe,
1358  IN BOOLEAN Shared)
1359 {
1360  /* Check if this was a safe lock or not */
1361  if (Safe)
1362  {
1363  if (Shared)
1364  {
1365  /* Reacquire safely & shared */
1367  }
1368  else
1369  {
1370  /* Reacquire safely */
1372  }
1373  }
1374  else
1375  {
1376  /* Unsafe lock cannot be shared */
1377  ASSERT(Shared == FALSE);
1378  /* Reacquire unsafely */
1380  }
1381 }
1382 
1384 KIRQL
1386 {
1387  KIRQL OldIrql;
1388 
1393  return OldIrql;
1394 }
1395 
1397 VOID
1399 {
1404 }
1405 
1406 //
1407 // Returns the ProtoPTE inside a VAD for the given VPN
1408 //
1410 PMMPTE
1412  IN ULONG_PTR Vpn)
1413 {
1414  PMMPTE ProtoPte;
1415 
1416  /* Find the offset within the VAD's prototype PTEs */
1417  ProtoPte = Vad->FirstPrototypePte + (Vpn - Vad->StartingVpn);
1418  ASSERT(ProtoPte <= Vad->LastContiguousPte);
1419  return ProtoPte;
1420 }
1421 
1422 //
1423 // Returns the PFN Database entry for the given page number
1424 // Warning: This is not necessarily a valid PFN database entry!
1425 //
1427 PMMPFN
1429 {
1430  /* Get the entry */
1431  return &MmPfnDatabase[Pfn];
1432 };
1433 
1434 //
1435 // Drops a locked page without dereferencing it
1436 //
1438 VOID
1440 {
1441  /* This page shouldn't be locked, but it should be valid */
1442  ASSERT(Pfn1->u3.e2.ReferenceCount != 0);
1443  ASSERT(Pfn1->u2.ShareCount == 0);
1444 
1445  /* Is this the last reference to the page */
1446  if (Pfn1->u3.e2.ReferenceCount == 1)
1447  {
1448  /* It better not be valid */
1449  ASSERT(Pfn1->u3.e1.PageLocation != ActiveAndValid);
1450 
1451  /* Is it a prototype PTE? */
1452  if ((Pfn1->u3.e1.PrototypePte == 1) &&
1453  (Pfn1->OriginalPte.u.Soft.Prototype == 1))
1454  {
1455  /* FIXME: We should return commit */
1456  DPRINT1("Not returning commit for prototype PTE\n");
1457  }
1458 
1459  /* Update the counter */
1461  }
1462 }
1463 
1464 //
1465 // Drops a locked page and dereferences it
1466 //
1468 VOID
1470 {
1471  USHORT RefCount, OldRefCount;
1472  PFN_NUMBER PageFrameIndex;
1473 
1474  /* Loop while we decrement the page successfully */
1475  do
1476  {
1477  /* There should be at least one reference */
1478  OldRefCount = Pfn1->u3.e2.ReferenceCount;
1479  ASSERT(OldRefCount != 0);
1480 
1481  /* Are we the last one */
1482  if (OldRefCount == 1)
1483  {
1484  /* The page shoudln't be shared not active at this point */
1485  ASSERT(Pfn1->u3.e2.ReferenceCount == 1);
1486  ASSERT(Pfn1->u3.e1.PageLocation != ActiveAndValid);
1487  ASSERT(Pfn1->u2.ShareCount == 0);
1488 
1489  /* Is it a prototype PTE? */
1490  if ((Pfn1->u3.e1.PrototypePte == 1) &&
1491  (Pfn1->OriginalPte.u.Soft.Prototype == 1))
1492  {
1493  /* FIXME: We should return commit */
1494  DPRINT1("Not returning commit for prototype PTE\n");
1495  }
1496 
1497  /* Update the counter, and drop a reference the long way */
1499  PageFrameIndex = MiGetPfnEntryIndex(Pfn1);
1500  MiDecrementReferenceCount(Pfn1, PageFrameIndex);
1501  return;
1502  }
1503 
1504  /* Drop a reference the short way, and that's it */
1505  RefCount = InterlockedCompareExchange16((PSHORT)&Pfn1->u3.e2.ReferenceCount,
1506  OldRefCount - 1,
1507  OldRefCount);
1508  ASSERT(RefCount != 0);
1509  } while (OldRefCount != RefCount);
1510 
1511  /* If we got here, there should be more than one reference */
1512  ASSERT(RefCount > 1);
1513  if (RefCount == 2)
1514  {
1515  /* Is it still being shared? */
1516  if (Pfn1->u2.ShareCount >= 1)
1517  {
1518  /* Then it should be valid */
1519  ASSERT(Pfn1->u3.e1.PageLocation == ActiveAndValid);
1520 
1521  /* Is it a prototype PTE? */
1522  if ((Pfn1->u3.e1.PrototypePte == 1) &&
1523  (Pfn1->OriginalPte.u.Soft.Prototype == 1))
1524  {
1525  /* We don't handle ethis */
1526  ASSERT(FALSE);
1527  }
1528 
1529  /* Update the counter */
1531  }
1532  }
1533 }
1534 
1535 //
1536 // References a locked page and updates the counter
1537 // Used in MmProbeAndLockPages to handle different edge cases
1538 //
1540 VOID
1542 {
1543  USHORT RefCount, OldRefCount;
1544 
1545  /* Sanity check */
1546  ASSERT(Pfn1->u3.e2.ReferenceCount != 0);
1547 
1548  /* Does ARM3 own the page? */
1549  if (MI_IS_ROS_PFN(Pfn1))
1550  {
1551  /* ReactOS Mm doesn't track share count */
1552  ASSERT(Pfn1->u3.e1.PageLocation == ActiveAndValid);
1553  }
1554  else
1555  {
1556  /* On ARM3 pages, we should see a valid share count */
1557  ASSERT((Pfn1->u2.ShareCount != 0) && (Pfn1->u3.e1.PageLocation == ActiveAndValid));
1558 
1559  /* Is it a prototype PTE? */
1560  if ((Pfn1->u3.e1.PrototypePte == 1) &&
1561  (Pfn1->OriginalPte.u.Soft.Prototype == 1))
1562  {
1563  /* FIXME: We should charge commit */
1564  DPRINT1("Not charging commit for prototype PTE\n");
1565  }
1566  }
1567 
1568  /* More locked pages! */
1570 
1571  /* Loop trying to update the reference count */
1572  do
1573  {
1574  /* Get the current reference count, make sure it's valid */
1575  OldRefCount = Pfn1->u3.e2.ReferenceCount;
1576  ASSERT(OldRefCount != 0);
1577  ASSERT(OldRefCount < 2500);
1578 
1579  /* Bump it up by one */
1580  RefCount = InterlockedCompareExchange16((PSHORT)&Pfn1->u3.e2.ReferenceCount,
1581  OldRefCount + 1,
1582  OldRefCount);
1583  ASSERT(RefCount != 0);
1584  } while (OldRefCount != RefCount);
1585 
1586  /* Was this the first lock attempt? If not, undo our bump */
1587  if (OldRefCount != 1) InterlockedDecrementSizeT(&MmSystemLockPagesCount);
1588 }
1589 
1590 //
1591 // References a locked page and updates the counter
1592 // Used in all other cases except MmProbeAndLockPages
1593 //
1595 VOID
1597 {
1598  USHORT NewRefCount;
1599 
1600  /* Is it a prototype PTE? */
1601  if ((Pfn1->u3.e1.PrototypePte == 1) &&
1602  (Pfn1->OriginalPte.u.Soft.Prototype == 1))
1603  {
1604  /* FIXME: We should charge commit */
1605  DPRINT1("Not charging commit for prototype PTE\n");
1606  }
1607 
1608  /* More locked pages! */
1610 
1611  /* Update the reference count */
1612  NewRefCount = InterlockedIncrement16((PSHORT)&Pfn1->u3.e2.ReferenceCount);
1613  if (NewRefCount == 2)
1614  {
1615  /* Is it locked or shared? */
1616  if (Pfn1->u2.ShareCount)
1617  {
1618  /* It's shared, so make sure it's active */
1619  ASSERT(Pfn1->u3.e1.PageLocation == ActiveAndValid);
1620  }
1621  else
1622  {
1623  /* It's locked, so we shouldn't lock again */
1625  }
1626  }
1627  else
1628  {
1629  /* Someone had already locked the page, so undo our bump */
1630  ASSERT(NewRefCount < 2500);
1632  }
1633 }
1634 
1635 //
1636 // References a locked page and updates the counter
1637 // Used in all other cases except MmProbeAndLockPages
1638 //
1640 VOID
1642 {
1643  USHORT NewRefCount;
1644 
1645  /* Make sure the page isn't used yet */
1646  ASSERT(Pfn1->u2.ShareCount == 0);
1647  ASSERT(Pfn1->u3.e1.PageLocation != ActiveAndValid);
1648 
1649  /* Is it a prototype PTE? */
1650  if ((Pfn1->u3.e1.PrototypePte == 1) &&
1651  (Pfn1->OriginalPte.u.Soft.Prototype == 1))
1652  {
1653  /* FIXME: We should charge commit */
1654  DPRINT1("Not charging commit for prototype PTE\n");
1655  }
1656 
1657  /* More locked pages! */
1659 
1660  /* Update the reference count */
1661  NewRefCount = InterlockedIncrement16((PSHORT)&Pfn1->u3.e2.ReferenceCount);
1662  if (NewRefCount != 1)
1663  {
1664  /* Someone had already locked the page, so undo our bump */
1665  ASSERT(NewRefCount < 2500);
1667  }
1668 }
1669 
1671 VOID
1673 {
1674  PUSHORT RefCount;
1675 
1677 
1678  *RefCount += 1;
1679  ASSERT(*RefCount <= PTE_PER_PAGE);
1680 }
1681 
1683 VOID
1685 {
1686  PUSHORT RefCount;
1687 
1689 
1690  *RefCount -= 1;
1691  ASSERT(*RefCount < PTE_PER_PAGE);
1692 }
1693 
1695 USHORT
1697 {
1698  PUSHORT RefCount;
1699 
1701 
1702  return *RefCount;
1703 }
1704 
1706 BOOLEAN
1707 NTAPI
1709  IN ULONG Phase,
1710  IN PLOADER_PARAMETER_BLOCK LoaderBlock
1711 );
1712 
1714 VOID
1715 NTAPI
1717 
1719 NTSTATUS
1720 NTAPI
1722  IN PLOADER_PARAMETER_BLOCK LoaderBlock
1723 );
1724 
1726 VOID
1727 NTAPI
1729  VOID
1730 );
1731 
1733 VOID
1734 NTAPI
1736  IN PLOADER_PARAMETER_BLOCK LoaderBlock
1737 );
1738 
1740 VOID
1741 NTAPI
1743  VOID
1744 );
1745 
1747 VOID
1748 NTAPI
1750  IN PLOADER_PARAMETER_BLOCK LoaderBlock
1751 );
1752 
1753 VOID
1754 NTAPI
1756  VOID
1757 );
1758 
1759 VOID
1760 NTAPI
1762  VOID
1763 );
1764 
1766 BOOLEAN
1767 NTAPI
1769  VOID
1770 );
1771 
1773 PFN_NUMBER
1774 NTAPI
1776  IN PFN_NUMBER PageCount
1777 );
1778 
1781 NTAPI
1783  IN PLOADER_PARAMETER_BLOCK LoaderBlock,
1784  IN PBOOLEAN IncludeType
1785 );
1786 
1787 PFN_NUMBER
1788 NTAPI
1790  IN PLOADER_PARAMETER_BLOCK LoaderBlock,
1791  IN PBOOLEAN IncludeType
1792 );
1793 
1794 VOID
1795 FASTCALL
1797  IN PVOID AddressStart,
1798  IN PVOID AddressEnd
1799 );
1800 
1801 NTSTATUS
1802 NTAPI
1806  IN OUT PSIZE_T NumberOfBytesToProtect,
1807  IN ULONG NewAccessProtection,
1808  OUT PULONG OldAccessProtection OPTIONAL
1809 );
1810 
1811 NTSTATUS
1812 NTAPI
1814  IN ULONG FaultCode,
1815  IN PVOID Address,
1817  IN PVOID TrapInformation
1818 );
1819 
1820 NTSTATUS
1821 FASTCALL
1823  IN PVOID Address
1824 );
1825 
1827 VOID
1828 NTAPI
1830  VOID
1831 );
1832 
1834 VOID
1835 NTAPI
1837  VOID
1838 );
1839 
1841 VOID
1842 NTAPI
1844  VOID
1845 );
1846 
1848 VOID //
1849 NTAPI //
1850 InitializePool( //
1851  IN POOL_TYPE PoolType,// FIXFIX: This should go in ex.h after the pool merge
1852  IN ULONG Threshold //
1853 ); //
1854 
1855 // FIXFIX: THIS ONE TOO
1857 VOID
1858 NTAPI
1860  IN PPOOL_DESCRIPTOR PoolDescriptor,
1862  IN ULONG PoolIndex,
1863  IN ULONG Threshold,
1864  IN PVOID PoolLock
1865 );
1866 
1867 NTSTATUS
1868 NTAPI
1870  VOID
1871 );
1872 
1874 VOID
1875 NTAPI
1877  IN PMMPTE StartingPte,
1878  IN ULONG NumberOfPtes,
1880 );
1881 
1882 PMMPTE
1883 NTAPI
1885  IN ULONG NumberOfPtes,
1886  IN MMSYSTEM_PTE_POOL_TYPE SystemPtePoolType
1887 );
1888 
1889 VOID
1890 NTAPI
1892  IN PMMPTE StartingPte,
1893  IN ULONG NumberOfPtes,
1894  IN MMSYSTEM_PTE_POOL_TYPE SystemPtePoolType
1895 );
1896 
1897 
1898 PFN_NUMBER
1899 NTAPI
1901  IN PFN_NUMBER LowestPfn,
1902  IN PFN_NUMBER HighestPfn,
1903  IN PFN_NUMBER BoundaryPfn,
1904  IN PFN_NUMBER SizeInPages,
1906 );
1907 
1908 PVOID
1909 NTAPI
1912  IN PFN_NUMBER BaseAddressPages,
1913  IN PFN_NUMBER SizeInPages,
1914  IN PFN_NUMBER LowestPfn,
1915  IN PFN_NUMBER HighestPfn,
1916  IN PFN_NUMBER BoundaryPfn,
1917  IN MI_PFN_CACHE_ATTRIBUTE CacheAttribute
1918 );
1919 
1920 PMDL
1921 NTAPI
1923  IN PHYSICAL_ADDRESS LowAddress,
1927  IN MI_PFN_CACHE_ATTRIBUTE CacheAttribute,
1928  IN ULONG Flags
1929 );
1930 
1931 VOID
1932 NTAPI
1934  IN PMMPFNLIST ListHead,
1935  IN PFN_NUMBER PageFrameIndex
1936 );
1937 
1938 VOID
1939 NTAPI
1941  IN PMMPFN Entry
1942 );
1943 
1944 VOID
1945 NTAPI
1947  IN PMMPFN Pfn
1948 );
1949 
1950 VOID
1951 NTAPI
1953  IN PFN_NUMBER PageFrameIndex,
1954  IN PMMPTE PointerPte,
1955  IN BOOLEAN Modified
1956 );
1957 
1958 NTSTATUS
1959 NTAPI
1961  OUT PPFN_NUMBER PageFrameIndex,
1962  IN PMMPDE PointerPde,
1963  IN PFN_NUMBER ContainingPageFrame,
1964  IN BOOLEAN SessionAllocation
1965 );
1966 
1967 VOID
1968 NTAPI
1970  IN PFN_NUMBER PageFrameIndex,
1971  IN PMMPTE PointerPte,
1972  IN MMPTE TempPte
1973 );
1974 
1975 VOID
1976 NTAPI
1978  IN PFN_NUMBER PageFrameIndex,
1979  IN PVOID PteAddress,
1980  IN PFN_NUMBER PteFrame
1981 );
1982 
1983 VOID
1984 NTAPI
1986  IN PMMPFN Pfn1,
1987  IN PFN_NUMBER PageFrameIndex
1988 );
1989 
1990 PFN_NUMBER
1991 NTAPI
1993  IN ULONG Color
1994 );
1995 
1996 PFN_NUMBER
1997 NTAPI
1999  IN ULONG Color
2000 );
2001 
2002 VOID
2003 NTAPI
2005  IN PFN_NUMBER PageFrameIndex
2006 );
2007 
2008 VOID
2009 NTAPI
2011  IN PFN_NUMBER PageFrameIndex
2012 );
2013 
2014 PFN_COUNT
2015 NTAPI
2017  IN PMMPTE PointerPte,
2018  IN PFN_NUMBER PageCount,
2019  IN ULONG Flags,
2020  OUT PPFN_NUMBER ValidPages
2021 );
2022 
2023 ULONG
2024 NTAPI
2026  IN PMMPTE PointerPte
2027 );
2028 
2030 NTAPI
2032  IN PVOID Address
2033 );
2034 
2036 VOID
2037 NTAPI
2039  VOID
2040 );
2041 
2043 VOID
2044 NTAPI
2046  VOID
2047 );
2048 
2050 VOID
2051 NTAPI
2053  VOID
2054 );
2055 
2056 BOOLEAN
2057 NTAPI
2058 MiIsPfnInUse(
2059  IN PMMPFN Pfn1
2060 );
2061 
2062 PMMVAD
2063 NTAPI
2066 );
2067 
2069 NTAPI
2071  IN ULONG_PTR StartVpn,
2072  IN ULONG_PTR EndVpn,
2074  OUT PMMADDRESS_NODE *NodeOrParent
2075 );
2076 
2078 NTAPI
2080  IN SIZE_T Length,
2081  IN ULONG_PTR BoundaryAddress,
2086 );
2087 
2088 NTSTATUS
2089 NTAPI
2091  IN SIZE_T Length,
2092  IN ULONG_PTR BoundaryAddress,
2096 );
2097 
2099 NTAPI
2101  IN SIZE_T Length,
2104  OUT PMMADDRESS_NODE *PreviousVad,
2106 );
2107 
2108 NTSTATUS
2109 NTAPI
2111  IN PMMVAD Vad,
2112  IN PVOID Base,
2113  IN SIZE_T Size,
2114  IN ULONG ProtectionMask
2115 );
2116 
2117 VOID
2118 NTAPI
2119 MiInsertVad(
2120  _Inout_ PMMVAD Vad,
2121  _Inout_ PMM_AVL_TABLE VadRoot);
2122 
2123 NTSTATUS
2124 NTAPI
2126  _Inout_ PMMVAD Vad,
2129  _In_ ULONG_PTR HighestAddress,
2132 
2133 VOID
2134 NTAPI
2136  IN PSECTION Section
2137 );
2138 
2139 NTSTATUS
2140 NTAPI
2144  IN ULONG Flags
2145 );
2146 
2147 NTSTATUS
2148 NTAPI
2152  IN BOOLEAN SkipDebuggerNotify
2153 );
2154 
2155 VOID
2156 NTAPI
2157 MiInsertNode(
2159  IN PMMADDRESS_NODE NewNode,
2162 );
2163 
2164 VOID
2165 NTAPI
2166 MiRemoveNode(
2169 );
2170 
2172 NTAPI
2175 );
2176 
2178 NTAPI
2181 );
2182 
2183 BOOLEAN
2184 NTAPI
2186  IN PMMSESSION InputSession OPTIONAL
2187 );
2188 
2189 VOID
2190 NTAPI
2192  VOID
2193 );
2194 
2195 VOID
2196 NTAPI
2198  IN PMM_SESSION_SPACE SessionGlobal
2199 );
2200 
2201 VOID
2202 NTAPI
2204  IN PEPROCESS NewProcess
2205 );
2206 
2207 NTSTATUS
2208 NTAPI
2210  IN PVOID StartVa,
2211  IN PVOID EndVa
2212 );
2213 
2214 ULONG
2215 NTAPI
2217  IN ULONG Protect
2218 );
2219 
2220 VOID
2221 NTAPI
2223  IN ULONG_PTR Va,
2224  IN ULONG_PTR EndingAddress,
2225  IN PMMVAD Vad
2226 );
2227 
2228 VOID
2229 NTAPI
2230 MiDeletePte(
2231  IN PMMPTE PointerPte,
2235 );
2236 
2237 ULONG
2238 NTAPI
2240  IN PVOID PageTableVirtualAddress,
2242 );
2243 
2244 ULONG
2245 NTAPI
2248  IN KIRQL OldIrql
2249 );
2250 
2251 VOID
2252 NTAPI
2255  IN PMMVAD Vad
2256 );
2257 
2259 NTAPI
2261  IN PMMVAD Vad,
2262  IN ULONG_PTR Vpn
2263 );
2264 
2265 VOID
2266 NTAPI
2268  PVOID ObjectBody
2269 );
2270 
2271 NTSTATUS
2272 NTAPI
2276  OUT PVOID MemoryInformation,
2277  IN SIZE_T MemoryInformationLength,
2279 );
2280 
2281 NTSTATUS
2282 NTAPI
2285 );
2286 
2287 POOL_TYPE
2288 NTAPI
2290  IN PVOID PoolAddress
2291 );
2292 
2293 VOID
2294 NTAPI
2296  IN PMMPDE PointerPde,
2297  IN PEPROCESS TargetProcess,
2298  IN KIRQL OldIrql
2299 );
2300 
2301 VOID
2302 NTAPI
2304  _In_ PVOID ImageBase);
2305 
2306 //
2307 // MiRemoveZeroPage will use inline code to zero out the page manually if only
2308 // free pages are available. In some scenarios, we don't/can't run that piece of
2309 // code and would rather only have a real zero page. If we can't have a zero page,
2310 // then we'd like to have our own code to grab a free page and zero it out, by
2311 // using MiRemoveAnyPage. This macro implements this.
2312 //
2314 PFN_NUMBER
2316 {
2318  return 0;
2319 }
2320 
2321 #if (_MI_PAGING_LEVELS == 2)
2323 BOOLEAN
2324 MiSynchronizeSystemPde(PMMPDE PointerPde)
2325 {
2326  MMPDE SystemPde;
2327  ULONG Index;
2328 
2329  /* Get the Index from the PDE */
2330  Index = ((ULONG_PTR)PointerPde & (SYSTEM_PD_SIZE - 1)) / sizeof(MMPTE);
2331 
2332  /* Copy the PDE from the double-mapped system page directory */
2333  SystemPde = MmSystemPagePtes[Index];
2334  *PointerPde = SystemPde;
2335 
2336  /* Make sure we re-read the PDE and PTE */
2338 
2339  /* Return, if we had success */
2340  return SystemPde.u.Hard.Valid != 0;
2341 }
2342 #endif
2343 
2344 /* EOF */
PVOID MiSessionImageStart
Definition: init.c:29
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
signed char * PCHAR
Definition: retypes.h:7
PFN_NUMBER MmResidentAvailableAtInit
Definition: freelist.c:28
PFN_NUMBER MiNumberOfFreePages
Definition: mminit.c:384
struct _PHYSICAL_MEMORY_DESCRIPTOR * PPHYSICAL_MEMORY_DESCRIPTOR
MMSUPPORT Vm
Definition: miarm.h:514
ULONG MmProcessColorSeed
Definition: procsup.c:20
FORCEINLINE VOID MI_ERASE_PTE(IN PMMPTE PointerPte)
Definition: miarm.h:994
ULONG_PTR MmSubsectionBase
Definition: section.c:138
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:39
FORCEINLINE VOID ExAcquirePushLockExclusive(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1008
Definition: bidi.c:477
INIT_FUNCTION PPHYSICAL_MEMORY_DESCRIPTOR NTAPI MmInitializeMemoryLimits(IN PLOADER_PARAMETER_BLOCK LoaderBlock, IN PBOOLEAN IncludeType)
Definition: mminit.c:1622
ULONG SessionId
Definition: miarm.h:491
LIST_ENTRY ProcessList
Definition: miarm.h:492
VOID NTAPI MiInitializePfn(IN PFN_NUMBER PageFrameIndex, IN PMMPTE PointerPte, IN BOOLEAN Modified)
Definition: pfnlist.c:969
#define IN
Definition: typedefs.h:38
MMPTE ValidKernelPte
Definition: init.c:31
ASMGENDATA Table[]
Definition: genincdata.c:61
#define _MI_PAGING_LEVELS
Definition: mm.h:6
TABLE_SEARCH_RESULT NTAPI MiFindEmptyAddressRangeDownTree(IN SIZE_T Length, IN ULONG_PTR BoundaryAddress, IN ULONG_PTR Alignment, IN PMM_AVL_TABLE Table, OUT PULONG_PTR Base, OUT PMMADDRESS_NODE *Parent)
Definition: vadnode.c:597
#define TRUE
Definition: types.h:120
MMPFNLIST MmStandbyPageListByPriority[8]
Definition: pfnlist.c:44
MM_AVL_TABLE MmSectionBasedRoot
Definition: section.c:109
SIZE_T NonPageablePages
Definition: miarm.h:495
BOOLEAN MmMirroring
Definition: pfnlist.c:35
_MI_PFN_CACHE_ATTRIBUTE
Definition: miarm.h:422
USHORT PoolTagHash
VOID NTAPI MiSessionRemoveProcess(VOID)
Definition: session.c:396
PVOID Blink
Definition: miarm.h:446
PVOID PagedPoolStart
Definition: miarm.h:497
PVOID MmNonPagedPoolStart
Definition: init.c:24
ULONG NTAPI MiMakeSystemAddressValidPfn(IN PVOID VirtualAddress, IN KIRQL OldIrql)
Definition: virtual.c:257
PFN_NUMBER StartFrame
Definition: miarm.h:452
LONG ReferenceCount
Definition: miarm.h:485
VOID NTAPI MiInsertPageInFreeList(IN PFN_NUMBER PageFrameIndex)
Definition: pfnlist.c:604
PVOID MiSessionImageEnd
Definition: init.c:28
FORCEINLINE VOID MiUnlockProcessWorkingSetUnsafe(IN PEPROCESS Process, IN PETHREAD Thread)
Definition: miarm.h:1214
BOOLEAN MmZeroPageFile
Definition: pagefile.c:58
INIT_FUNCTION VOID NTAPI MiSyncCachedRanges(VOID)
Definition: largepag.c:54
#define MiAddressToPde(x)
Definition: mmx86.c:20
BOOLEAN NTAPI KeAreAllApcsDisabled(VOID)
Definition: apc.c:985
FORCEINLINE KIRQL MiAcquireExpansionLock(VOID)
Definition: miarm.h:1385
VOID NTAPI MiUnlinkPageFromList(IN PMMPFN Pfn)
Definition: pfnlist.c:264
PFN_NUMBER MmMinimumFreePages
Definition: mminit.c:314
_In_ ULONG Mode
Definition: hubbusif.h:303
FORCEINLINE VOID MiDereferencePfnAndDropLockCount(IN PMMPFN Pfn1)
Definition: miarm.h:1469
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81
SIZE_T MmMinimumNonPagedPoolSize
Definition: mminit.c:39
ULONG MmSystemPageColor
Definition: pfnlist.c:36
PKEVENT MiHighNonPagedPoolEvent
Definition: mminit.c:297
KGUARDED_MUTEX MmSectionBasedMutex
Definition: section.c:110
USHORT UsedPageTableEntries[768]
Definition: mmtypes.h:870
INIT_FUNCTION VOID NTAPI MiComputeColorInformation(VOID)
Definition: mminit.c:508
#define MI_MAKE_ACCESSED_PAGE(x)
Definition: mm.h:97
ULONG OwnsSystemWorkingSetShared
Definition: pstypes.h:1155
signed short * PSHORT
Definition: retypes.h:6
PMMPDE PageTables
Definition: miarm.h:521
_MMSYSTEM_PTE_POOL_TYPE
Definition: miarm.h:415
PMMPTE MmSystemPtesEnd[MaximumPtePoolTypes]
Definition: syspte.c:23
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T _In_ SECTION_INHERIT _In_ ULONG _In_ ULONG Protect
Definition: zwfuncs.h:214
FORCEINLINE VOID MiUnlockProcessWorkingSetShared(IN PEPROCESS Process, IN PETHREAD Thread)
Definition: miarm.h:1190
VOID NTAPI MiReleaseProcessReferenceToSessionDataPage(IN PMM_SESSION_SPACE SessionGlobal)
Definition: session.c:210
ULONG PFN_COUNT
Definition: mmtypes.h:102
LONG ProcessReferenceToSession
Definition: miarm.h:508
#define MI_MAKE_OWNER_PAGE(x)
Definition: mm.h:110
__wchar_t WCHAR
Definition: xmlstorage.h:180
PMMPTE NTAPI MiReserveSystemPtes(IN ULONG NumberOfPtes, IN MMSYSTEM_PTE_POOL_TYPE SystemPtePoolType)
Definition: syspte.c:246
struct _MMCOLOR_TABLES MMCOLOR_TABLES
#define MI_IS_SESSION_ADDRESS(Address)
Definition: miarm.h:175
SIZE_T MmSessionViewSize
Definition: init.c:35
POOL_TYPE NTAPI MmDeterminePoolType(IN PVOID PoolAddress)
Definition: pool.c:406
VOID NTAPI MiWriteProtectSystemImage(_In_ PVOID ImageBase)
Definition: sysldr.c:2380
FORCEINLINE BOOLEAN MI_IS_MAPPED_PTE(PMMPTE PointerPte)
Definition: miarm.h:911
ULONG MmMaxAdditionNonPagedPoolPerMb
Definition: mminit.c:42
enum _TABLE_SEARCH_RESULT TABLE_SEARCH_RESULT
ULONG MmTotalFreeSystemPtes[MaximumPtePoolTypes]
Definition: syspte.c:25
NTSTATUS NTAPI MiInitializeAndChargePfn(OUT PPFN_NUMBER PageFrameIndex, IN PMMPDE PointerPde, IN PFN_NUMBER ContainingPageFrame, IN BOOLEAN SessionAllocation)
Definition: pfnlist.c:1093
LONG NTSTATUS
Definition: precomp.h:26
PFN_NUMBER PageCount
Definition: miarm.h:433
PMMPTE MiSessionLastPte
Definition: mminit.c:146
VOID NTAPI MiDeleteARM3Section(PVOID ObjectBody)
Definition: section.c:3246
PFN_NUMBER MmHighMemoryThreshold
Definition: mminit.c:301
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2327
struct _MI_LARGE_PAGE_RANGES MI_LARGE_PAGE_RANGES
FORCEINLINE VOID MiReferenceUnusedPageAndBumpLockCount(IN PMMPFN Pfn1)
Definition: miarm.h:1641
PLDR_DATA_TABLE_ENTRY NTAPI MiLookupDataTableEntry(IN PVOID Address)
Definition: sysldr.c:3280
INIT_FUNCTION NTSTATUS NTAPI MiInitMachineDependent(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: init.c:672
SIZE_T MmSessionImageSize
Definition: init.c:37
HARDWARE_PDE_ARMV6 TempPde
Definition: winldr.c:77
PMM_SESSION_SPACE MmSessionSpace
Definition: session.c:21
PMMPDE MiHighestUserPde
Definition: mminit.c:234
FORCEINLINE USHORT MiQueryPageTableReferences(IN PVOID Address)
Definition: miarm.h:1696
#define SESSION_POOL_LOOKASIDES
Definition: mm.h:81
KSPIN_LOCK MmExpansionLock
Definition: session.c:32
FORCEINLINE VOID MiLockProcessWorkingSet(IN PEPROCESS Process, IN PETHREAD Thread)
Definition: miarm.h:1099
RTL_BITMAP MiPfnBitMap
Definition: init.c:44
SIZE_T TotalBytes
Definition: miarm.h:335
INIT_FUNCTION VOID NTAPI MiMapPfnDatabase(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: mminit.c:672
PCHAR SystemSpaceViewStart
Definition: miarm.h:466
VOID NTAPI MiInitializePfnForOtherProcess(IN PFN_NUMBER PageFrameIndex, IN PVOID PteAddress, IN PFN_NUMBER PteFrame)
Definition: pfnlist.c:1280
PFN_NUMBER NumberOfPages
Definition: miarm.h:439
PVOID MiSessionSpaceWs
Definition: mminit.c:130
#define PD_COUNT
Definition: miarm.h:31
DWORD LCID
Definition: nls.h:13
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:724
MEMORY_ALLOCATION_DESCRIPTOR MxOldFreeDescriptor
Definition: init.c:47
ULONG SystemSpaceHashEntries
Definition: miarm.h:469
PFN_COUNT MiExpansionPoolPagesInitialCharge
Definition: pool.c:21
ULONG BitmapFailures
Definition: miarm.h:471
NTSTATUS NTAPI MiFindEmptyAddressRangeDownBasedTree(IN SIZE_T Length, IN ULONG_PTR BoundaryAddress, IN ULONG_PTR Alignment, IN PMM_AVL_TABLE Table, OUT PULONG_PTR Base)
Definition: vadnode.c:713
ULONG MmLargePageDriverBufferLength
Definition: largepag.c:25
NTSTATUS FASTCALL MiCheckPdeForPagedPool(IN PVOID Address)
Definition: pagfault.c:475
LARGE_INTEGER LastProcessSwappedOutTime
Definition: miarm.h:493
SIZE_T MmMinimumStackCommitInBytes
Definition: mminit.c:370
#define FASTCALL
Definition: nt_native.h:50
ULONG MmProductType
Definition: mminit.c:325
struct _MMVIEW * PMMVIEW
ULONG RunningDeAllocs
Definition: miarm.h:328
LIST_ENTRY ListHeads[POOL_LISTS_PER_PAGE]
Definition: miarm.h:337
#define MiGetPdeOffset(x)
Definition: mm.h:185
VOID NTAPI MiInsertBasedSection(IN PSECTION Section)
Definition: vadnode.c:345
FORCEINLINE VOID MiReferenceUsedPageAndBumpLockCount(IN PMMPFN Pfn1)
Definition: miarm.h:1596
BOOLEAN MmLargeSystemCache
Definition: mminit.c:340
ULONG MmLargeStackSize
Definition: mminit.c:262
SIZE_T MmAllocatedNonPagedPool
Definition: pool.c:26
UNICODE_STRING BaseName
Definition: miarm.h:412
FORCEINLINE VOID MI_MAKE_SUBSECTION_PTE(IN PMMPTE NewPte, IN PVOID Segment)
Definition: miarm.h:875
PPOOL_TRACKER_TABLE PoolTrackTable
Definition: expool.c:41
PMMPFN MmPfnDatabase
Definition: freelist.c:24
KGUARDED_MUTEX SystemSpaceViewLock
Definition: miarm.h:464
INIT_FUNCTION PFN_NUMBER NTAPI MxGetNextPage(IN PFN_NUMBER PageCount)
Definition: mminit.c:483
VOID NTAPI MiDeletePte(IN PMMPTE PointerPte, IN PVOID VirtualAddress, IN PEPROCESS CurrentProcess, IN PMMPTE PrototypePte)
Definition: virtual.c:391
struct _POOL_HEADER * PPOOL_HEADER
DRIVER_UNLOAD * PDRIVER_UNLOAD
Definition: iotypes.h:2144
MM_PAGED_POOL_INFO PagedPoolInfo
Definition: miarm.h:513
enum _MI_PFN_CACHE_ATTRIBUTE MI_PFN_CACHE_ATTRIBUTE
PFN_NUMBER NTAPI MiRemoveZeroPage(IN ULONG Color)
Definition: pfnlist.c:531
MMPTE DemandZeroPte
Definition: init.c:39
SIZE_T MmSizeOfPagedPoolInBytes
Definition: miarm.h:600
PVOID MmNonPagedPoolEnd
Definition: mminit.c:99
enum _TYPE_OF_MEMORY TYPE_OF_MEMORY
uint32_t ULONG_PTR
Definition: typedefs.h:63
struct LOOKASIDE_ALIGN _GENERAL_LOOKASIDE GENERAL_LOOKASIDE
FORCEINLINE BOOLEAN MI_IS_WS_UNSAFE(IN PEPROCESS Process)
Definition: miarm.h:1089
PMMPTE MmLastReservedMappingPte
Definition: hypermap.c:20
VOID NTAPI MiInitializeSessionWsSupport(VOID)
Definition: session.c:40
PVOID MmSessionBase
Definition: miarm.h:594
FORCEINLINE BOOLEAN MM_ANY_WS_LOCK_HELD(IN PETHREAD Thread)
Definition: miarm.h:1034
enum _MM_SYSTEM_SIZE MM_SYSTEMSIZE
UCHAR KIRQL
Definition: env_spec_w32.h:591
FORCEINLINE BOOLEAN MiIsMemoryTypeInvisible(TYPE_OF_MEMORY MemoryType)
Definition: miarm.h:688
struct _MMSESSION * PMMSESSION
SIZE_T MmSystemLockPagesCount
Definition: mdlsup.c:22
PDRIVER_UNLOAD Win32KDriverUnload
Definition: miarm.h:516
ULONG * PPFN_NUMBER
Definition: ke.h:8
struct _POOL_DESCRIPTOR * PPOOL_DESCRIPTOR
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
ULONG OwnsSessionWorkingSetShared
Definition: pstypes.h:1157
BOOLEAN MmDynamicPfn
Definition: pfnlist.c:34
ULONG MmSpecialPoolTag
Definition: pool.c:27
struct _POOL_TRACKER_BIG_PAGES POOL_TRACKER_BIG_PAGES
BOOLEAN MmZeroingPageThreadActive
Definition: zeropage.c:20
ULONG PFN_NUMBER
Definition: ke.h:8
LIST_ENTRY WsListEntry
Definition: miarm.h:509
ULONG_PTR * PSIZE_T
Definition: typedefs.h:78
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
SIZE_T MmMaximumNonPagedPoolInBytes
Definition: init.c:22
PETHREAD MiExpansionLockOwner
Definition: session.c:33
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
VOID FASTCALL MiSyncARM3WithROS(IN PVOID AddressStart, IN PVOID AddressEnd)
SIZE_T MmSystemViewSize
Definition: init.c:39
FORCEINLINE VOID MI_WRITE_VALID_PTE(IN PMMPTE PointerPte, IN MMPTE TempPte)
Definition: miarm.h:951
ULONG MmVerifyDriverBufferLength
Definition: drvmgmt.c:24
LIST_ENTRY Links
Definition: miarm.h:411
INIT_FUNCTION VOID NTAPI MiInitializePfnDatabase(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: mminit.c:1074
#define KeMemoryBarrierWithoutFence()
Definition: ke.h:66
PFN_NUMBER BasePage
Definition: miarm.h:432
#define InterlockedIncrementSizeT(a)
Definition: interlocked.h:220
PFN_NUMBER NTAPI MiFindContiguousPages(IN PFN_NUMBER LowestPfn, IN PFN_NUMBER HighestPfn, IN PFN_NUMBER BoundaryPfn, IN PFN_NUMBER SizeInPages, IN MEMORY_CACHING_TYPE CacheType)
Definition: contmem.c:22
FORCEINLINE VOID MI_WRITE_INVALID_PDE(IN PMMPDE PointerPde, IN MMPDE InvalidPde)
Definition: miarm.h:1020
long LONG
Definition: pedump.c:60
PMEMORY_ALLOCATION_DESCRIPTOR MxFreeDescriptor
Definition: init.c:46
LARGE_INTEGER MmCriticalSectionTimeout
Definition: mminit.c:388
#define PDE_BASE
Definition: winldr.c:20
MMPDE ValidKernelPdeLocal
Definition: init.c:34
PFN_NUMBER MmPlentyFreePages
Definition: mminit.c:322
PKEVENT MiLowNonPagedPoolEvent
Definition: mminit.c:296
struct _MMCOLOR_TABLES * PMMCOLOR_TABLES
struct _MI_LARGE_PAGE_DRIVER_ENTRY * PMI_LARGE_PAGE_DRIVER_ENTRY
FORCEINLINE BOOLEAN MiIsUserPde(PVOID Address)
Definition: miarm.h:727
PFN_NUMBER Flink
Definition: miarm.h:445
USHORT AllocatorBackTraceIndex
ULONG OwnsSessionWorkingSetExclusive
Definition: pstypes.h:1156
INIT_FUNCTION VOID NTAPI ExInitializePoolDescriptor(IN PPOOL_DESCRIPTOR PoolDescriptor, IN POOL_TYPE PoolType, IN ULONG PoolIndex, IN ULONG Threshold, IN PVOID PoolLock)
Definition: expool.c:965
FORCEINLINE VOID ExReleasePushLockExclusive(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1224
PPHYSICAL_MEMORY_DESCRIPTOR MmPhysicalMemoryBlock
Definition: init.c:45
VOID NTAPI MiInitializeSessionIds(VOID)
Definition: session.c:117
FORCEINLINE PFN_NUMBER MiRemoveZeroPageSafe(IN ULONG Color)
Definition: miarm.h:2315
TABLE_SEARCH_RESULT NTAPI MiFindEmptyAddressRangeInTree(IN SIZE_T Length, IN ULONG_PTR Alignment, IN PMM_AVL_TABLE Table, OUT PMMADDRESS_NODE *PreviousVad, OUT PULONG_PTR Base)
Definition: vadnode.c:502
const ULONG_PTR MmProtectToPteMask[32]
Definition: page.c:32
MM_PAGED_POOL_INFO MmPagedPoolInfo
Definition: pool.c:25
INIT_FUNCTION VOID NTAPI MiInitializeNonPagedPool(VOID)
Definition: pool.c:276
unsigned char BOOLEAN
POOL_DESCRIPTOR PagedPool
Definition: miarm.h:517
FORCEINLINE VOID MI_MAKE_TRANSITION_PTE(_Out_ PMMPTE NewPte, _In_ PFN_NUMBER Page, _In_ ULONG Protection)
Definition: miarm.h:921
VOID NTAPI MiMakePdeExistAndMakeValid(IN PMMPDE PointerPde, IN PEPROCESS TargetProcess, IN KIRQL OldIrql)
Definition: virtual.c:2371
smooth NULL
Definition: ftsmooth.c:416
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS _In_opt_ PHYSICAL_ADDRESS _In_ MEMORY_CACHING_TYPE CacheType
Definition: mmfuncs.h:214
MMPTE MmDecommittedPte
Definition: init.c:46
PMMVAD NTAPI MiLocateAddress(IN PVOID VirtualAddress)
Definition: vadnode.c:48
static WCHAR Address[46]
Definition: ping.c:68
struct _MM_SESSION_SPACE_FLAGS MM_SESSION_SPACE_FLAGS
#define INIT_FUNCTION
Definition: dfs.h:10
FORCEINLINE VOID MI_MAKE_PROTOTYPE_PTE(IN PMMPTE NewPte, IN PMMPTE PointerPte)
Definition: miarm.h:846
#define KeLeaveGuardedRegion()
Definition: ke_x.h:63
PFN_NUMBER MiHighPagedPoolThreshold
Definition: mminit.c:303
#define FORCEINLINE
Definition: ntbasedef.h:221
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define _Out_
Definition: no_sal2.h:323
ULONG MmVerifyDriverLevel
Definition: drvmgmt.c:26
KEVENT MmZeroingPageEvent
Definition: zeropage.c:21
ULONG MmSecondaryColorMask
Definition: mminit.c:257
PVOID MiSystemViewStart
Definition: miarm.h:659
void DPRINT(...)
Definition: polytest.cpp:61
VOID NTAPI MiDecrementShareCount(IN PMMPFN Pfn1, IN PFN_NUMBER PageFrameIndex)
Definition: pfnlist.c:1133
VOID NTAPI MiInsertPageInList(IN PMMPFNLIST ListHead, IN PFN_NUMBER PageFrameIndex)
Definition: pfnlist.c:778
FORCEINLINE VOID MiUnlockWorkingSet(IN PETHREAD Thread, IN PMMSUPPORT WorkingSet)
Definition: miarm.h:1284
SIZE_T NonPagedBytes
Definition: miarm.h:386
INIT_FUNCTION VOID NTAPI MiInitializeDriverLargePageList(VOID)
Definition: largepag.c:68
FORCEINLINE VOID MI_WRITE_VALID_PDE(IN PMMPDE PointerPde, IN MMPDE TempPde)
Definition: miarm.h:1006
PFN_NUMBER NTAPI MiPagesInLoaderBlock(IN PLOADER_PARAMETER_BLOCK LoaderBlock, IN PBOOLEAN IncludeType)
struct _POOL_TRACKER_TABLE POOL_TRACKER_TABLE
VOID NTAPI MiReleaseSystemPtes(IN PMMPTE StartingPte, IN ULONG NumberOfPtes, IN MMSYSTEM_PTE_POOL_TYPE SystemPtePoolType)
Definition: syspte.c:275
Definition: miarm.h:409
TABLE_SEARCH_RESULT NTAPI MiCheckForConflictingNode(IN ULONG_PTR StartVpn, IN ULONG_PTR EndVpn, IN PMM_AVL_TABLE Table, OUT PMMADDRESS_NODE *NodeOrParent)
Definition: vadnode.c:78
PMMVIEW SystemSpaceViewTable
Definition: miarm.h:467
ULONG SystemSpaceHashKey
Definition: miarm.h:470
ULONG NTAPI MiMakeSystemAddressValid(IN PVOID PageTableVirtualAddress, IN PEPROCESS CurrentProcess)
Definition: virtual.c:205
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS SkipBytes
Definition: mmfuncs.h:226
#define ULL(a, b)
Definition: format_msg.c:27
PMMPTE MmSharedUserDataPte
Definition: mminit.c:28
PVOID LockAddress
Definition: miarm.h:332
PMMCOLOR_TABLES MmFreePagesByColor[FreePageList+1]
Definition: mminit.c:286
MMPTE PrototypePte
Definition: init.c:42
_Inout_ PVOID Segment
Definition: exfuncs.h:893
FORCEINLINE ULONG_PTR MiDetermineUserGlobalPteMask(IN PVOID PointerPte)
Definition: miarm.h:746
ULONG PoolIndex
Definition: miarm.h:326
ULONG LongFlags
Definition: miarm.h:488
NTSTATUS NTAPI MiRosUnmapViewInSystemSpace(IN PVOID MappedBase)
Definition: section.c:4895
NTSTATUS NTAPI MiCheckSecuredVad(IN PMMVAD Vad, IN PVOID Base, IN SIZE_T Size, IN ULONG ProtectionMask)
Definition: vadnode.c:815
ULONG MmConsumedPoolPercentage
Definition: pool.c:28
PMMPTE MmSystemPtesStart[MaximumPtePoolTypes]
Definition: syspte.c:22
FORCEINLINE VOID MiLockProcessWorkingSetUnsafe(IN PEPROCESS Process, IN PETHREAD Thread)
Definition: miarm.h:1144
PVOID MmHyperSpaceEnd
Definition: init.c:56
MMPDE DemandZeroPde
Definition: init.c:38
union _MMPTE::@2219 u
struct _MI_LARGE_PAGE_DRIVER_ENTRY MI_LARGE_PAGE_DRIVER_ENTRY
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
MM_SESSION_SPACE_FLAGS Flags
Definition: miarm.h:489
struct _MM_SESSION_SPACE * GlobalVirtualAddress
Definition: miarm.h:484
FORCEINLINE VOID MiDecrementPageTableReferences(IN PVOID Address)
Definition: miarm.h:1684
ULONG CurrentProcess
Definition: shell.c:125
NTSTATUS NTAPI MiInsertVadEx(_Inout_ PMMVAD Vad, _In_ ULONG_PTR *BaseAddress, _In_ SIZE_T ViewSize, _In_ ULONG_PTR HighestAddress, _In_ ULONG_PTR Alignment, _In_ ULONG AllocationType)
Definition: vadnode.c:204
NTSTATUS NTAPI MiUnmapViewOfSection(IN PEPROCESS Process, IN PVOID BaseAddress, IN ULONG Flags)
Definition: section.c:817
PVOID MmNonPagedPoolExpansionStart
Definition: init.c:25
PMMPTE MmFirstReservedMappingPte
Definition: hypermap.c:20
FORCEINLINE VOID MiUnlockProcessWorkingSetForFault(IN PEPROCESS Process, IN PETHREAD Thread, OUT PBOOLEAN Safe, OUT PBOOLEAN Shared)
Definition: miarm.h:1322
ULONG RunningAllocs
Definition: miarm.h:327
SIZE_T CommittedPages
Definition: miarm.h:496
#define MI_IS_SESSION_PTE(Pte)
Definition: miarm.h:178
ULONG ExpNumberOfPagedPools
Definition: expool.c:33
struct _MM_SESSION_SPACE MM_SESSION_SPACE
INT POOL_TYPE
Definition: typedefs.h:76
BOOLEAN NTAPI MiInitializeSystemSpaceMap(IN PMMSESSION InputSession OPTIONAL)
Definition: section.c:240
MMSESSION Session
Definition: miarm.h:511
CSHORT Type
Definition: mm.h:194
ULONG64 Valid
Definition: mmtypes.h:150
LONG PendingFreeDepth
Definition: miarm.h:334
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
ULONG MmMaximumNonPagedPoolPercent
Definition: init.c:20
static const UCHAR Index[8]
Definition: usbohci.c:18
enum _MMSYSTEM_PTE_POOL_TYPE MMSYSTEM_PTE_POOL_TYPE
#define PTE_PER_PAGE
Definition: mm.h:20
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
struct _PHYSICAL_MEMORY_RUN PHYSICAL_MEMORY_RUN
LONG NonPagedFrees
Definition: miarm.h:385
#define InterlockedIncrement16
Definition: interlocked.h:206
NTSTATUS NTAPI MiQueryMemorySectionName(IN HANDLE ProcessHandle, IN PVOID BaseAddress, OUT PVOID MemoryInformation, IN SIZE_T MemoryInformationLength, OUT PSIZE_T ReturnLength)
Definition: section.c:1892
HARDWARE_PTE_ARMV6 TempPte
Definition: winldr.c:75
#define _Inout_
Definition: no_sal2.h:244
C_ASSERT(sizeof(POOL_HEADER)==POOL_BLOCK_SIZE)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
PFN_NUMBER MiHighNonPagedPoolThreshold
Definition: mminit.c:305
INIT_FUNCTION VOID NTAPI MiInitializeLargePageSupport(VOID)
Definition: largepag.c:34
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
PVOID MiSessionPoolStart
Definition: init.c:32
struct _MMVIEW MMVIEW
#define KeEnterGuardedRegion()
Definition: ke_x.h:34
ULONG SessionPoolAllocationFailures[4]
Definition: miarm.h:502
PMMADDRESS_NODE NTAPI MiGetNextNode(IN PMMADDRESS_NODE Node)
Definition: vadnode.c:467
PVOID MmHighSectionBase
Definition: section.c:111
ULONG Threshold
Definition: miarm.h:331
SIZE_T Spare0
Definition: miarm.h:336
FORCEINLINE VOID MiLockProcessWorkingSetShared(IN PEPROCESS Process, IN PETHREAD Thread)
Definition: miarm.h:1121
PVOID MiSessionSpaceEnd
Definition: init.c:27
SIZE_T PagedBytes
Definition: miarm.h:389
ULONG TotalPages
Definition: miarm.h:329
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
ULONG_PTR MxPfnAllocation
Definition: init.c:43
SIZE_T MmBootImageSize
Definition: init.c:49
FORCEINLINE BOOLEAN MiIsUserPte(PVOID Address)
Definition: miarm.h:735
INIT_FUNCTION VOID NTAPI MiInitializeNonPagedPoolThresholds(VOID)
Definition: pool.c:184
GENERAL_LOOKASIDE Lookaside[SESSION_POOL_LOOKASIDES]
Definition: miarm.h:510
VOID NTAPI MiDecrementReferenceCount(IN PMMPFN Pfn1, IN PFN_NUMBER PageFrameIndex)
Definition: pfnlist.c:1222
#define PDE_TOP
Definition: mm.h:34
char * PBOOLEAN
Definition: retypes.h:11
FORCEINLINE PMMPFN MI_PFN_ELEMENT(IN PFN_NUMBER Pfn)
Definition: miarm.h:1428
PKGUARDED_MUTEX SystemSpaceViewLockPointer
Definition: miarm.h:465
PFN_NUMBER MmLowMemoryThreshold
Definition: mminit.c:300
PVOID PagedPoolEnd
Definition: miarm.h:498
KGUARDED_MUTEX PagedPoolMutex
Definition: miarm.h:512
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
PCONTROL_AREA ControlArea
Definition: miarm.h:459
PFN_NUMBER MmMaximumNonPagedPoolInPages
Definition: mminit.c:30
PMMPTE MiSessionImagePteStart
Definition: mminit.c:143
FORCEINLINE VOID MiDropLockCount(IN PMMPFN Pfn1)
Definition: miarm.h:1439
ULONG NTAPI MiMakeProtectionMask(IN ULONG Protect)
Definition: section.c:158
BOOLEAN MmMakeLowMemory
Definition: sysldr.c:46
SLIST_HEADER MmDeadStackSListHead
Definition: procsup.c:23
Definition: mm.h:305
Definition: btrfs_drv.h:1801
INIT_FUNCTION VOID NTAPI MiInitializeSessionSpaceLayout(VOID)
Definition: init.c:65
ULONG MmMinAdditionNonPagedPoolPerMb
Definition: mminit.c:40
const ULONG MmProtectToValue[32]
Definition: page.c:81
#define PAGE_SIZE
Definition: env_spec_w32.h:49
Definition: typedefs.h:117
_In_ ULONG _In_ BOOLEAN _Must_inspect_result_ PVOID * VirtualAddress
Definition: ndis.h:3773
struct _PHYSICAL_MEMORY_RUN * PPHYSICAL_MEMORY_RUN
ULONG OwnsSystemWorkingSetExclusive
Definition: pstypes.h:1154
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define _1MB
Definition: miarm.h:15
ULONG MmSecondaryColors
Definition: mminit.c:256
LIST_HEAD(acpi_bus_event_list)
struct _MI_LARGE_PAGE_RANGES * PMI_LARGE_PAGE_RANGES
INIT_FUNCTION VOID NTAPI MiInitializeSystemPtes(IN PMMPTE StartingPte, IN ULONG NumberOfPtes, IN MMSYSTEM_PTE_POOL_TYPE PoolType)
Definition: syspte.c:399
BOOLEAN MmProtectFreedNonPagedPool
Definition: pool.c:29
MM_SYSTEMSIZE MmSystemSize
Definition: mminit.c:326
LIST_ENTRY ImageList
Definition: miarm.h:503
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T _In_ SECTION_INHERIT _In_ ULONG AllocationType
Definition: mmfuncs.h:404
PEPROCESS LastProcess
Definition: miarm.h:507
LIST_ENTRY MmWorkingSetExpansionHead
Definition: session.c:30
VOID NTAPI MiRemoveNode(IN PMMADDRESS_NODE Node, IN PMM_AVL_TABLE Table)
Definition: vadnode.c:360
enum _MI_PFN_CACHE_ATTRIBUTE * PMI_PFN_CACHE_ATTRIBUTE
ULONG MmNumberOfSystemPtes
Definition: init.c:42
ULONG_PTR Long
Definition: mmtypes.h:215
PVOID MmPagedPoolStart
Definition: miarm.h:589
PFN_NUMBER MiLowPagedPoolThreshold
Definition: mminit.c:302
NTSTATUS NTAPI MiSessionCommitPageTables(IN PVOID StartVa, IN PVOID EndVa)
Definition: section.c:935
PFN_COUNT NTAPI MiDeleteSystemPageableVm(IN PMMPTE PointerPte, IN PFN_NUMBER PageCount, IN ULONG Flags, OUT PPFN_NUMBER ValidPages)
Definition: virtual.c:297
FORCEINLINE VOID MI_MAKE_HARDWARE_PTE_USER(IN PMMPTE NewPte, IN PMMPTE MappingPte, IN ULONG_PTR ProtectionMask, IN PFN_NUMBER PageFrameNumber)
Definition: miarm.h:822
PVOID NTAPI MiCheckForContiguousMemory(IN PVOID BaseAddress, IN PFN_NUMBER BaseAddressPages, IN PFN_NUMBER SizeInPages, IN PFN_NUMBER LowestPfn, IN PFN_NUMBER HighestPfn, IN PFN_NUMBER BoundaryPfn, IN MI_PFN_CACHE_ATTRIBUTE CacheAttribute)
Definition: contmem.c:214
ULONG TotalBigPages
Definition: miarm.h:330
PVOID PendingFrees
Definition: miarm.h:333
#define _In_
Definition: no_sal2.h:204
VOID NTAPI MiDeleteVirtualAddresses(IN ULONG_PTR Va, IN ULONG_PTR EndingAddress, IN PMMVAD Vad)
Definition: virtual.c:540
PFN_NUMBER NTAPI MiRemoveAnyPage(IN ULONG Color)
Definition: pfnlist.c:475
FORCEINLINE VOID ExAcquirePushLockShared(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1077
FORCEINLINE VOID MiLockProcessWorkingSetForFault(IN PEPROCESS Process, IN PETHREAD Thread, IN BOOLEAN Safe, IN BOOLEAN Shared)
Definition: miarm.h:1355
ULONG_PTR SIZE_T
Definition: typedefs.h:78
MMPTE_HARDWARE Hard
Definition: mmtypes.h:217
#define SYSTEM_PD_SIZE
Definition: miarm.h:36
INIT_FUNCTION VOID NTAPI InitializePool(IN POOL_TYPE PoolType, IN ULONG Threshold)
Definition: expool.c:1016
FORCEINLINE VOID MI_WRITE_INVALID_PTE(IN PMMPTE PointerPte, IN MMPTE InvalidPte)
Definition: miarm.h:980
WCHAR MmLargePageDriverBuffer[512]
Definition: largepag.c:24
PSUBSECTION NTAPI MiLocateSubsection(IN PMMVAD Vad, IN ULONG_PTR Vpn)
Definition: section.c:570
KEVENT AttachEvent
Definition: miarm.h:506
MMPTE HyperTemplatePte
Definition: hypermap.c:22
struct _MMSESSION MMSESSION
PRTL_BITMAP SystemSpaceBitMap
Definition: miarm.h:472
SIZE_T MmDefaultMaximumNonPagedPool
Definition: mminit.c:41
ULONG MmVerifyDriverBufferType
Definition: drvmgmt.c:25
USHORT PreviousSize
POOL_TYPE PoolType
Definition: miarm.h:325
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS HighAddress
Definition: mmfuncs.h:226
unsigned short USHORT
Definition: pedump.c:61
LIST_ENTRY MmProcessList
Definition: largepag.c:20
SIZE_T MmAllocationFragment
Definition: mminit.c:352
PMMPTE MiFirstReservedZeroingPte
Definition: hypermap.c:21
SIZE_T MmSessionSize
Definition: init.c:34
BOOLEAN MiLargePageAllDrivers
Definition: largepag.c:27
ULONG NTAPI MiGetPageProtection(IN PMMPTE PointerPte)
Definition: virtual.c:1329
PMMWSLE Wsle
Definition: miarm.h:515
#define MI_IS_ROS_PFN(x)
Definition: miarm.h:1078
Definition: miarm.h:456
NTSTATUS NTAPI MiInitializeSessionPool(VOID)
Definition: pool.c:1280
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
_Out_ PKAPC_STATE ApcState
Definition: mm.h:1484
VOID NTAPI MiZeroPhysicalPage(IN PFN_NUMBER PageFrameIndex)
Definition: pfnlist.c:122
LONG ResidentProcessCount
Definition: miarm.h:501
MI_PFN_CACHE_ATTRIBUTE MiPlatformCacheAttributes[2][MmMaximumCacheType]
Definition: iosup.c:27
ULONG OwnsProcessWorkingSetShared
Definition: pstypes.h:1153
PPOOL_DESCRIPTOR ExpPagedPoolDescriptor[16+1]
Definition: expool.c:35
unsigned int * PULONG
Definition: retypes.h:1
FORCEINLINE VOID MiReleaseExpansionLock(KIRQL OldIrql)
Definition: miarm.h:1398
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define InterlockedCompareExchange16
Definition: interlocked.h:109
PKEVENT MiLowPagedPoolEvent
Definition: mminit.c:294
PFN_NUMBER MmResidentAvailablePages
Definition: freelist.c:27
SIZE_T MmSessionPoolSize
Definition: init.c:36
#define DPRINT1
Definition: precomp.h:8
#define POOL_LISTS_PER_PAGE
Definition: miarm.h:285
SIZE_T MmSizeOfNonPagedPoolInBytes
Definition: init.c:21
_Must_inspect_result_ _Outptr_result_bytebuffer_ ViewSize PVOID * MappedBase
Definition: mmfuncs.h:493
PVOID MmPagedPoolEnd
Definition: miarm.h:590
WCHAR MmVerifyDriverBuffer[512]
Definition: drvmgmt.c:23
POOL_DESCRIPTOR NonPagedPoolDescriptor
Definition: expool.c:34
struct _MM_SESSION_SPACE * PMM_SESSION_SPACE
FORCEINLINE BOOLEAN MiIsMemoryTypeFree(TYPE_OF_MEMORY MemoryType)
Definition: miarm.h:678
NTSTATUS NTAPI MiRosProtectVirtualMemory(IN PEPROCESS Process, IN OUT PVOID *BaseAddress, IN OUT PSIZE_T NumberOfBytesToProtect, IN ULONG NewAccessProtection, OUT PULONG OldAccessProtection OPTIONAL)
Definition: virtual.c:2052
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
VOID NTAPI MiSessionAddProcess(IN PEPROCESS NewProcess)
Definition: session.c:427
LONG NonPagedAllocs
Definition: miarm.h:384
FORCEINLINE PFN_NUMBER MiGetPfnEntryIndex(IN PMMPFN Pfn1)
Definition: mm.h:960
MMSUPPORT MmSystemCacheWs
Definition: init.c:55
#define OUT
Definition: typedefs.h:39
PVOID MiSessionPoolEnd
Definition: init.c:31
FORCEINLINE VOID ExReleasePushLockShared(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1185
VOID NTAPI MiInitializePfnAndMakePteValid(IN PFN_NUMBER PageFrameIndex, IN PMMPTE PointerPte, IN MMPTE TempPte)
Definition: pfnlist.c:1036
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T ViewSize
Definition: mmfuncs.h:404
ULONG MmMaximumDeadKernelStacks
Definition: procsup.c:22
FORCEINLINE VOID MiIncrementPageTableReferences(IN PVOID Address)
Definition: miarm.h:1672
PKEVENT MiHighPagedPoolEvent
Definition: mminit.c:295
PMMWSL MmSystemCacheWorkingSetList
Definition: mminit.c:174
unsigned int ULONG
Definition: retypes.h:1
INIT_FUNCTION BOOLEAN NTAPI MmArmInitSystem(IN ULONG Phase, IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: mminit.c:2043
LIST_ENTRY MiLargePageDriverList
Definition: largepag.c:26
INIT_FUNCTION VOID NTAPI MiInitializePoolEvents(VOID)
Definition: pool.c:201
ULONG64 LargePage
Definition: mmtypes.h:165
#define ULONG_PTR
Definition: config.h:101
PMMADDRESS_NODE NTAPI MiGetPreviousNode(IN PMMADDRESS_NODE Node)
Definition: vadnode.c:431
uint32_t * PULONG_PTR
Definition: typedefs.h:63
ULONG64 PageFrameNumber
Definition: mmtypes.h:171
CSHORT Size
Definition: mm.h:195
struct _POOL_TRACKER_BIG_PAGES * PPOOL_TRACKER_BIG_PAGES
VOID NTAPI MiRemoveMappedView(IN PEPROCESS CurrentProcess, IN PMMVAD Vad)
Definition: section.c:780
union _MM_SESSION_SPACE::@1740 u
ULONG_PTR Entry
Definition: miarm.h:458
BOOLEAN NTAPI MiIsPfnInUse(IN PMMPFN Pfn1)
Definition: freelist.c:142
ULONG AttachCount
Definition: miarm.h:505
PFN_NUMBER MiLowNonPagedPoolThreshold
Definition: mminit.c:304
KGUARDED_MUTEX MmPagedPoolMutex
Definition: pool.c:24
VOID NTAPI MiInsertVad(_Inout_ PMMVAD Vad, _Inout_ PMM_AVL_TABLE VadRoot)
PFN_NUMBER Count
Definition: miarm.h:447
#define InterlockedDecrementSizeT(a)
Definition: interlocked.h:153
ULONG OwnsProcessWorkingSetExclusive
Definition: pstypes.h:1152
PMMWSL MmWorkingSetList
Definition: procsup.c:21
VOID NTAPI MiInsertNode(IN PMM_AVL_TABLE Table, IN PMMADDRESS_NODE NewNode, PMMADDRESS_NODE Parent, TABLE_SEARCH_RESULT Result)
ULONG MmCritsectTimeoutSeconds
Definition: mminit.c:387
struct _POOL_HEADER POOL_HEADER
#define POOL_BLOCK_SIZE
Definition: miarm.h:283
FORCEINLINE VOID MiReferenceProbedPageAndBumpLockCount(IN PMMPFN Pfn1)
Definition: miarm.h:1541
PVOID MmSystemCacheStart
Definition: init.c:53
struct _PHYSICAL_MEMORY_DESCRIPTOR PHYSICAL_MEMORY_DESCRIPTOR
PFN_NUMBER MmSizeOfPagedPoolInPages
Definition: mminit.c:111
PKEVENT MiLowMemoryEvent
Definition: mminit.c:292
FORCEINLINE VOID MI_MAKE_HARDWARE_PTE_KERNEL(IN PMMPTE NewPte, IN PMMPTE MappingPte, IN ULONG_PTR ProtectionMask, IN PFN_NUMBER PageFrameNumber)
Definition: miarm.h:783
PMMPTE MiSessionBasePte
Definition: mminit.c:145
FORCEINLINE VOID MiLockWorkingSet(IN PETHREAD Thread, IN PMMSUPPORT WorkingSet)
Definition: miarm.h:1240
NTSTATUS NTAPI MmArmAccessFault(IN ULONG FaultCode, IN PVOID Address, IN KPROCESSOR_MODE Mode, IN PVOID TrapInformation)
Definition: pagfault.c:1650
INIT_FUNCTION BOOLEAN NTAPI MiInitializeMemoryEvents(VOID)
Definition: mminit.c:1339
PMMPTE MiHighestUserPte
Definition: mminit.c:233
MMPTE ValidKernelPteLocal
Definition: init.c:35
#define KeGetCurrentThread
Definition: hal.h:44
MMPDE ValidKernelPde
Definition: init.c:30
struct _POOL_TRACKER_TABLE * PPOOL_TRACKER_TABLE
ULONG SystemSpaceHashSize
Definition: miarm.h:468
_In_ HANDLE ProcessHandle
Definition: mmfuncs.h:403
INIT_FUNCTION VOID NTAPI MiInitializeColorTables(VOID)
Definition: mminit.c:562
enum _MEMORY_CACHING_TYPE MEMORY_CACHING_TYPE
KGUARDED_MUTEX MmSectionCommitMutex
Definition: section.c:108
FORCEINLINE BOOLEAN MI_IS_PHYSICAL_ADDRESS(IN PVOID Address)
Definition: miarm.h:937
_Must_inspect_result_ _In_ FLT_CONTEXT_TYPE _In_ SIZE_T _In_ POOL_TYPE PoolType
Definition: fltkernel.h:1444
FORCEINLINE VOID MI_UPDATE_VALID_PTE(IN PMMPTE PointerPte, IN MMPTE TempPte)
Definition: miarm.h:965
FORCEINLINE BOOLEAN MI_WS_OWNER(IN PEPROCESS Process)
Definition: miarm.h:1050
NTSTATUS NTAPI MiRosUnmapViewOfSection(IN PEPROCESS Process, IN PVOID BaseAddress, IN BOOLEAN SkipDebuggerNotify)
Definition: section.c:4131
PFN_NUMBER MmSystemPageDirectory[PD_COUNT]
Definition: init.c:40
PKEVENT MiHighMemoryEvent
Definition: mminit.c:293
PMMPDE PagedPoolBasePde
Definition: miarm.h:499
PFN_NUMBER LastFrame
Definition: miarm.h:453
PFN_NUMBER MmTotalSystemDriverPages
Definition: sysldr.c:41
VOID NTAPI MiUnlinkFreeOrZeroedPage(IN PMMPFN Entry)
Definition: pfnlist.c:137
PVOID MmSystemCacheEnd
Definition: init.c:54
#define APC_LEVEL
Definition: env_spec_w32.h:695
BOOLEAN MmEnforceWriteProtection
Definition: sysldr.c:47
unsigned short * PUSHORT
Definition: retypes.h:2
LONG ImageLoadingCount
Definition: miarm.h:530
PMDL NTAPI MiAllocatePagesForMdl(IN PHYSICAL_ADDRESS LowAddress, IN PHYSICAL_ADDRESS HighAddress, IN PHYSICAL_ADDRESS SkipBytes, IN SIZE_T TotalBytes, IN MI_PFN_CACHE_ATTRIBUTE CacheAttribute, IN ULONG Flags)
Definition: freelist.c:150
base of all file and directory entries
Definition: entries.h:82
BOOLEAN MmTrackLockedPages
Definition: mdlsup.c:21
FORCEINLINE VOID MI_MAKE_HARDWARE_PTE(IN PMMPTE NewPte, IN PMMPTE MappingPte, IN ULONG_PTR ProtectionMask, IN PFN_NUMBER PageFrameNumber)
Definition: miarm.h:806
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS _In_ SIZE_T TotalBytes
Definition: mmfuncs.h:226
FORCEINLINE VOID MiUnlockProcessWorkingSet(IN PEPROCESS Process, IN PETHREAD Thread)
Definition: miarm.h:1169
PMMPDE MmSystemPagePtes
Definition: init.c:41
FORCEINLINE PMMPTE MI_GET_PROTOTYPE_PTE_FOR_VPN(IN PMMVAD Vad, IN ULONG_PTR Vpn)
Definition: miarm.h:1411
ULONG PageFrameNumber
Definition: mmtypes.h:109
Definition: dlist.c:348
PFN_NUMBER SessionPageDirectoryIndex
Definition: miarm.h:494
Definition: mm.h:369
PVOID MiSessionViewStart
Definition: init.c:30
BOOLEAN MmTrackPtes
Definition: mdlsup.c:20
FORCEINLINE BOOLEAN MiIsRosSectionObject(IN PVOID Section)
Definition: miarm.h:1071
struct _POOL_DESCRIPTOR POOL_DESCRIPTOR
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
PVOID MmNonPagedSystemStart
Definition: miarm.h:591
PMMPTE MiSessionImagePteEnd
Definition: mminit.c:144