ReactOS 0.4.16-dev-112-g52265ae
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#ifdef __cplusplus
12extern "C" {
13#endif
14
15#define MI_LOWEST_VAD_ADDRESS (PVOID)MM_LOWEST_USER_ADDRESS
16
17/* Make the code cleaner with some definitions for size multiples */
18#define _1KB (1024u)
19#define _1MB (1024 * _1KB)
20#define _1GB (1024 * _1MB)
21
22/* Everyone loves 64K */
23#define _64K (64 * _1KB)
24
25/* Size of a page table */
26#define PT_SIZE (PTE_PER_PAGE * sizeof(MMPTE))
27
28/* Size of a page directory */
29#define PD_SIZE (PDE_PER_PAGE * sizeof(MMPDE))
30
31/* Size of all page directories for a process */
32#define SYSTEM_PD_SIZE (PPE_PER_PAGE * PD_SIZE)
33#ifdef _M_IX86
35#endif
36
37//
38// Protection Bits part of the internal memory manager Protection Mask, from:
39// http://reactos.org/wiki/Techwiki:Memory_management_in_the_Windows_XP_kernel
40// https://www.reactos.org/wiki/Techwiki:Memory_Protection_constants
41// and public assertions.
42//
43#define MM_ZERO_ACCESS 0
44#define MM_READONLY 1
45#define MM_EXECUTE 2
46#define MM_EXECUTE_READ 3
47#define MM_READWRITE 4
48#define MM_WRITECOPY 5
49#define MM_EXECUTE_READWRITE 6
50#define MM_EXECUTE_WRITECOPY 7
51#define MM_PROTECT_ACCESS 7
52
53//
54// These are flags on top of the actual protection mask
55//
56#define MM_NOCACHE 0x08
57#define MM_GUARDPAGE 0x10
58#define MM_WRITECOMBINE 0x18
59#define MM_PROTECT_SPECIAL 0x18
60
61//
62// These are special cases
63//
64#define MM_DECOMMIT (MM_ZERO_ACCESS | MM_GUARDPAGE)
65#define MM_NOACCESS (MM_ZERO_ACCESS | MM_WRITECOMBINE)
66#define MM_OUTSWAPPED_KSTACK (MM_EXECUTE_WRITECOPY | MM_WRITECOMBINE)
67#define MM_INVALID_PROTECTION 0xFFFFFFFF
68
69//
70// Specific PTE Definitions that map to the Memory Manager's Protection Mask Bits
71// The Memory Manager's definition define the attributes that must be preserved
72// and these PTE definitions describe the attributes in the hardware sense. This
73// helps deal with hardware differences between the actual boolean expression of
74// the argument.
75//
76// For example, in the logical attributes, we want to express read-only as a flag
77// but on x86, it is writability that must be set. On the other hand, on x86, just
78// like in the kernel, it is disabling the caches that requires a special flag,
79// while on certain architectures such as ARM, it is enabling the cache which
80// requires a flag.
81//
82#if defined(_M_IX86)
83//
84// Access Flags
85//
86#define PTE_READONLY 0 // Doesn't exist on x86
87#define PTE_EXECUTE 0 // Not worrying about NX yet
88#define PTE_EXECUTE_READ 0 // Not worrying about NX yet
89#define PTE_READWRITE 0x2
90#define PTE_WRITECOPY 0x200
91#define PTE_EXECUTE_READWRITE 0x2 // Not worrying about NX yet
92#define PTE_EXECUTE_WRITECOPY 0x200
93#define PTE_PROTOTYPE 0x400
94
95//
96// State Flags
97//
98#define PTE_VALID 0x1
99#define PTE_ACCESSED 0x20
100#define PTE_DIRTY 0x40
101
102//
103// Cache flags
104//
105#define PTE_ENABLE_CACHE 0
106#define PTE_DISABLE_CACHE 0x10
107#define PTE_WRITECOMBINED_CACHE 0x10
108#define PTE_PROTECT_MASK 0x612
109#elif defined(_M_AMD64)
110//
111// Access Flags
112//
113#define PTE_READONLY 0x8000000000000000ULL
114#define PTE_EXECUTE 0x0000000000000000ULL
115#define PTE_EXECUTE_READ PTE_EXECUTE /* EXECUTE implies READ on x64 */
116#define PTE_READWRITE 0x8000000000000002ULL
117#define PTE_WRITECOPY 0x8000000000000200ULL
118#define PTE_EXECUTE_READWRITE 0x0000000000000002ULL
119#define PTE_EXECUTE_WRITECOPY 0x0000000000000200ULL
120#define PTE_PROTOTYPE 0x0000000000000400ULL
121
122//
123// State Flags
124//
125#define PTE_VALID 0x0000000000000001ULL
126#define PTE_ACCESSED 0x0000000000000020ULL
127#define PTE_DIRTY 0x0000000000000040ULL
128
129//
130// Cache flags
131//
132#define PTE_ENABLE_CACHE 0x0000000000000000ULL
133#define PTE_DISABLE_CACHE 0x0000000000000010ULL
134#define PTE_WRITECOMBINED_CACHE 0x0000000000000010ULL
135#define PTE_PROTECT_MASK 0x8000000000000612ULL
136#elif defined(_M_ARM)
137#define PTE_READONLY 0x200
138#define PTE_EXECUTE 0 // Not worrying about NX yet
139#define PTE_EXECUTE_READ 0 // Not worrying about NX yet
140#define PTE_READWRITE 0 // Doesn't exist on ARM
141#define PTE_WRITECOPY 0 // Doesn't exist on ARM
142#define PTE_EXECUTE_READWRITE 0 // Not worrying about NX yet
143#define PTE_EXECUTE_WRITECOPY 0 // Not worrying about NX yet
144#define PTE_PROTOTYPE 0x400 // Using the Shared bit
145
146//
147// Cache flags
148//
149#define PTE_ENABLE_CACHE 0
150#define PTE_DISABLE_CACHE 0x10
151#define PTE_WRITECOMBINED_CACHE 0x10
152#define PTE_PROTECT_MASK 0x610
153#else
154#error Define these please!
155#endif
156
157//
158// Mask for image section page protection
159//
160#define IMAGE_SCN_PROTECTION_MASK (IMAGE_SCN_MEM_WRITE | IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_EXECUTE)
161
162extern const ULONG_PTR MmProtectToPteMask[32];
163extern const ULONG MmProtectToValue[32];
164
165//
166// Assertions for session images, addresses, and PTEs
167//
168#define MI_IS_SESSION_IMAGE_ADDRESS(Address) \
169 (((Address) >= MiSessionImageStart) && ((Address) < MiSessionImageEnd))
170
171#define MI_IS_SESSION_ADDRESS(Address) \
172 (((Address) >= MmSessionBase) && ((Address) < MiSessionSpaceEnd))
173
174#define MI_IS_SESSION_PTE(Pte) \
175 ((((PMMPTE)Pte) >= MiSessionBasePte) && (((PMMPTE)Pte) < MiSessionLastPte))
176
177#define MI_IS_PAGE_TABLE_ADDRESS(Address) \
178 (((PVOID)(Address) >= (PVOID)PTE_BASE) && ((PVOID)(Address) <= (PVOID)PTE_TOP))
179
180#define MI_IS_SYSTEM_PAGE_TABLE_ADDRESS(Address) \
181 (((Address) >= (PVOID)MiAddressToPte(MmSystemRangeStart)) && ((Address) <= (PVOID)PTE_TOP))
182
183#define MI_IS_PAGE_TABLE_OR_HYPER_ADDRESS(Address) \
184 (((PVOID)(Address) >= (PVOID)PTE_BASE) && ((PVOID)(Address) <= (PVOID)MmHyperSpaceEnd))
185
186//
187// Creates a software PTE with the given protection
188//
189#define MI_MAKE_SOFTWARE_PTE(p, x) ((p)->u.Long = (x << MM_PTE_SOFTWARE_PROTECTION_BITS))
190
191//
192// Marks a PTE as deleted
193//
194#define MI_SET_PFN_DELETED(x) ((x)->PteAddress = (PMMPTE)((ULONG_PTR)(x)->PteAddress | 1))
195#define MI_IS_PFN_DELETED(x) ((ULONG_PTR)((x)->PteAddress) & 1)
196
197//
198// Special values for LoadedImports
199//
200#define MM_SYSLDR_NO_IMPORTS ((PVOID)(ULONG_PTR)-2)
201#define MM_SYSLDR_BOOT_LOADED ((PVOID)(ULONG_PTR)-1)
202#define MM_SYSLDR_SINGLE_ENTRY 0x1
203
204//
205// Number of initial session IDs
206//
207#define MI_INITIAL_SESSION_IDS 64
208
209#if defined(_M_IX86) || defined(_M_ARM)
210//
211// PFN List Sentinel
212//
213#define LIST_HEAD 0xFFFFFFFF
214
215//
216// Because GCC cannot automatically downcast 0xFFFFFFFF to lesser-width bits,
217// we need a manual definition suited to the number of bits in the PteFrame.
218// This is used as a LIST_HEAD for the colored list
219//
220#define COLORED_LIST_HEAD ((1 << 25) - 1) // 0x1FFFFFF
221#elif defined(_M_AMD64)
222#define LIST_HEAD 0xFFFFFFFFFFFFFFFFLL
223#define COLORED_LIST_HEAD ((1ULL << 57) - 1) // 0x1FFFFFFFFFFFFFFLL
224#else
225#error Define these please!
226#endif
227
228//
229// Returns the color of a page
230//
231#define MI_GET_PAGE_COLOR(x) ((x) & MmSecondaryColorMask)
232#define MI_GET_NEXT_COLOR() (MI_GET_PAGE_COLOR(++MmSystemPageColor))
233#define MI_GET_NEXT_PROCESS_COLOR(x) (MI_GET_PAGE_COLOR(++(x)->NextPageColor))
234
235//
236// Prototype PTEs that don't yet have a pagefile association
237//
238#ifdef _WIN64
239#define MI_PTE_LOOKUP_NEEDED 0xffffffffULL
240#else
241#define MI_PTE_LOOKUP_NEEDED 0xFFFFF
242#endif
243
244//
245// Number of session data and tag pages
246//
247#define MI_SESSION_DATA_PAGES_MAXIMUM (MM_ALLOCATION_GRANULARITY / PAGE_SIZE)
248#define MI_SESSION_TAG_PAGES_MAXIMUM (MM_ALLOCATION_GRANULARITY / PAGE_SIZE)
249
250//
251// Used by MiCheckSecuredVad
252//
253#define MM_READ_WRITE_ALLOWED 11
254#define MM_READ_ONLY_ALLOWED 10
255#define MM_NO_ACCESS_ALLOWED 01
256#define MM_DELETE_CHECK 85
257
258//
259// System views are binned into 64K chunks
260//
261#define MI_SYSTEM_VIEW_BUCKET_SIZE _64K
262
263//
264// FIXFIX: These should go in ex.h after the pool merge
265//
266#ifdef _WIN64
267#define POOL_BLOCK_SIZE 16
268#else
269#define POOL_BLOCK_SIZE 8
270#endif
271#define POOL_LISTS_PER_PAGE (PAGE_SIZE / POOL_BLOCK_SIZE)
272#define BASE_POOL_TYPE_MASK 1
273#define POOL_MAX_ALLOC (PAGE_SIZE - (sizeof(POOL_HEADER) + POOL_BLOCK_SIZE))
274
275//
276// Pool debugging/analysis/tracing flags
277//
278#define POOL_FLAG_CHECK_TIMERS 0x1
279#define POOL_FLAG_CHECK_WORKERS 0x2
280#define POOL_FLAG_CHECK_RESOURCES 0x4
281#define POOL_FLAG_VERIFIER 0x8
282#define POOL_FLAG_CHECK_DEADLOCK 0x10
283#define POOL_FLAG_SPECIAL_POOL 0x20
284#define POOL_FLAG_DBGPRINT_ON_FAILURE 0x40
285#define POOL_FLAG_CRASH_ON_FAILURE 0x80
286
287//
288// BAD_POOL_HEADER codes during pool bugcheck
289//
290#define POOL_CORRUPTED_LIST 3
291#define POOL_SIZE_OR_INDEX_MISMATCH 5
292#define POOL_ENTRIES_NOT_ALIGNED_PREVIOUS 6
293#define POOL_HEADER_NOT_ALIGNED 7
294#define POOL_HEADER_IS_ZERO 8
295#define POOL_ENTRIES_NOT_ALIGNED_NEXT 9
296#define POOL_ENTRY_NOT_FOUND 10
297
298//
299// BAD_POOL_CALLER codes during pool bugcheck
300//
301#define POOL_ENTRY_CORRUPTED 1
302#define POOL_ENTRY_ALREADY_FREE 6
303#define POOL_ENTRY_NOT_ALLOCATED 7
304#define POOL_ALLOC_IRQL_INVALID 8
305#define POOL_FREE_IRQL_INVALID 9
306#define POOL_BILLED_PROCESS_INVALID 13
307#define POOL_HEADER_SIZE_INVALID 32
308
309typedef struct _POOL_DESCRIPTOR
310{
325
326typedef struct _POOL_HEADER
327{
328 union
329 {
330 struct
331 {
332#ifdef _WIN64
337#else
342#endif
343 };
345 };
346#ifdef _WIN64
348#endif
349 union
350 {
351#ifdef _WIN64
352 PEPROCESS ProcessBilled;
353#else
355#endif
356 struct
357 {
360 };
361 };
363
366
368{
377
379{
385
390
391//
392// END FIXFIX
393//
394
396{
400
402{
407
409{
415
417{
421
423{
428
429typedef struct _MMCOLOR_TABLES
430{
435
437{
441
442typedef struct _MMVIEW
443{
447
448typedef struct _MMSESSION
449{
460
462{
467
468typedef struct _MM_SESSION_SPACE
469{
472 union
473 {
476 } u;
504#if defined (_M_AMD64)
505 MMPDE PageDirectory;
506#else
508#endif
509#if defined (_M_AMD64)
510 PMMPTE SpecialPoolFirstPte;
511 PMMPTE SpecialPoolLastPte;
512 PMMPTE NextPdeForSpecialPoolExpansion;
513 PMMPTE LastPdeForSpecialPoolExpansion;
514 PFN_NUMBER SpecialPagesInUse;
515#endif
518
521extern MMPDE ValidKernelPde;
522extern MMPTE ValidKernelPte;
525extern MMPDE DemandZeroPde;
526extern MMPTE DemandZeroPte;
527extern MMPTE PrototypePte;
533extern BOOLEAN MmTrackPtes;
534extern BOOLEAN MmDynamicPfn;
535extern BOOLEAN MmMirroring;
542extern WCHAR MmVerifyDriverBuffer[512];
558extern PVOID MmPagedPoolEnd;
559extern PVOID MmSessionBase;
560extern SIZE_T MmSessionSize;
605extern ULONG MmProductType;
643extern PVOID MiSessionPoolEnd; // 0xBE000000
644extern PVOID MiSessionPoolStart; // 0xBD000000
645extern PVOID MiSessionViewStart; // 0xBE000000
658
662{
663 return (WorkingSet != &MmSystemCacheWs) && !WorkingSet->Flags.SessionSpace;
664}
665
669{
670 return ((MemoryType == LoaderFree) ||
671 (MemoryType == LoaderLoadedProgram) ||
672 (MemoryType == LoaderFirmwareTemporary) ||
673 (MemoryType == LoaderOsloaderStack));
674}
675
679{
680 return ((MemoryType == LoaderFirmwarePermanent) ||
681 (MemoryType == LoaderSpecialMemory) ||
682 (MemoryType == LoaderHALCachedMemory) ||
683 (MemoryType == LoaderBBTMemory));
684}
685
686#ifdef _M_AMD64
689MiIsUserPxe(PVOID Address)
690{
691 return ((ULONG_PTR)Address >> 7) == 0x1FFFFEDF6FB7DA0ULL;
692}
693
696MiIsUserPpe(PVOID Address)
697{
698 return ((ULONG_PTR)Address >> 16) == 0xFFFFF6FB7DA0ULL;
699}
700
704{
705 return ((ULONG_PTR)Address >> 25) == 0x7FFFFB7DA0ULL;
706}
707
711{
712 return ((ULONG_PTR)Address >> 34) == 0x3FFFFDA0ULL;
713}
714#else
718{
719 return ((Address >= (PVOID)MiAddressToPde(NULL)) &&
721}
722
726{
727 return (Address >= (PVOID)PTE_BASE) && (Address <= (PVOID)MiHighestUserPte);
728}
729#endif
730
731//
732// Figures out the hardware bits for a PTE
733//
737{
739
740 /* Start fresh */
741 TempPte.u.Long = 0;
742
743 /* Make it valid and accessed */
744 TempPte.u.Hard.Valid = TRUE;
746
747 /* Is this for user-mode? */
748 if (
749#if (_MI_PAGING_LEVELS == 4)
750 MiIsUserPxe(PointerPte) ||
751#endif
752#if (_MI_PAGING_LEVELS >= 3)
753 MiIsUserPpe(PointerPte) ||
754#endif
755 MiIsUserPde(PointerPte) ||
756 MiIsUserPte(PointerPte))
757 {
758 /* Set the owner bit */
760 }
761
762 /* FIXME: We should also set the global bit */
763
764 /* Return the protection */
765 return TempPte.u.Long;
766}
767
768//
769// Creates a valid kernel PTE with the given protection
770//
772VOID
774 IN PMMPTE MappingPte,
775 IN ULONG_PTR ProtectionMask,
776 IN PFN_NUMBER PageFrameNumber)
777{
778 /* Only valid for kernel, non-session PTEs */
779 ASSERT(MappingPte > MiHighestUserPte);
780 ASSERT(!MI_IS_SESSION_PTE(MappingPte));
781 ASSERT((MappingPte < (PMMPTE)PDE_BASE) || (MappingPte > (PMMPTE)PDE_TOP));
782
783 /* Check that we are not setting valid a page that should not be */
784 ASSERT(ProtectionMask & MM_PROTECT_ACCESS);
785 ASSERT((ProtectionMask & MM_GUARDPAGE) == 0);
786
787 /* Start fresh */
788 NewPte->u.Long = 0;
789
790 /* Set the protection and page */
791 NewPte->u.Hard.PageFrameNumber = PageFrameNumber;
792 NewPte->u.Long |= MmProtectToPteMask[ProtectionMask];
793
794 /* Make this valid & global */
795#ifdef _GLOBAL_PAGES_ARE_AWESOME_
797 NewPte->u.Hard.Global = 1;
798#endif
799 NewPte->u.Hard.Valid = 1;
800}
801
802//
803// Creates a valid PTE with the given protection
804//
806VOID
808 IN PMMPTE MappingPte,
809 IN ULONG_PTR ProtectionMask,
810 IN PFN_NUMBER PageFrameNumber)
811{
812 /* Check that we are not setting valid a page that should not be */
813 ASSERT(ProtectionMask & MM_PROTECT_ACCESS);
814 ASSERT((ProtectionMask & MM_GUARDPAGE) == 0);
815
816 /* Set the protection and page */
817 NewPte->u.Long = MiDetermineUserGlobalPteMask(MappingPte);
818 NewPte->u.Long |= MmProtectToPteMask[ProtectionMask];
819 NewPte->u.Hard.PageFrameNumber = PageFrameNumber;
820}
821
822//
823// Creates a valid user PTE with the given protection
824//
826VOID
828 IN PMMPTE MappingPte,
829 IN ULONG_PTR ProtectionMask,
830 IN PFN_NUMBER PageFrameNumber)
831{
832 /* Only valid for kernel, non-session PTEs */
833 ASSERT(MappingPte <= MiHighestUserPte);
834
835 /* Start fresh */
836 NewPte->u.Long = 0;
837
838 /* Check that we are not setting valid a page that should not be */
839 ASSERT(ProtectionMask & MM_PROTECT_ACCESS);
840 ASSERT((ProtectionMask & MM_GUARDPAGE) == 0);
841
842 NewPte->u.Hard.Valid = TRUE;
843 NewPte->u.Hard.Owner = TRUE;
844 NewPte->u.Hard.PageFrameNumber = PageFrameNumber;
845 NewPte->u.Long |= MmProtectToPteMask[ProtectionMask];
846}
847
848#ifndef _M_AMD64
849//
850// Builds a Prototype PTE for the address of the PTE
851//
853VOID
855 IN PMMPTE PointerPte)
856{
858
859 /* Mark this as a prototype */
860 NewPte->u.Long = 0;
861 NewPte->u.Proto.Prototype = 1;
862
863 /*
864 * Prototype PTEs are only valid in paged pool by design, this little trick
865 * lets us only use 30 bits for the address of the PTE, as long as the area
866 * stays 1024MB At most.
867 */
869
870 /*
871 * 7 bits go in the "low" (but we assume the bottom 2 are zero)
872 * and the other 21 bits go in the "high"
873 */
874 NewPte->u.Proto.ProtoAddressLow = (Offset & 0x1FC) >> 2;
875 NewPte->u.Proto.ProtoAddressHigh = (Offset & 0x3FFFFE00) >> 9;
876}
877
878//
879// Builds a Subsection PTE for the address of the Segment
880//
882VOID
885{
887
888 /* Mark this as a prototype */
889 NewPte->u.Long = 0;
890 NewPte->u.Subsect.Prototype = 1;
891
892 /*
893 * Segments are only valid either in nonpaged pool. We store the 20 bit
894 * difference either from the top or bottom of nonpaged pool, giving a
895 * maximum of 128MB to each delta, meaning nonpaged pool cannot exceed
896 * 256MB.
897 */
898 if ((ULONG_PTR)Segment < ((ULONG_PTR)MmSubsectionBase + (128 * _1MB)))
899 {
901 NewPte->u.Subsect.WhichPool = PagedPool;
902 }
903 else
904 {
906 NewPte->u.Subsect.WhichPool = NonPagedPool;
907 }
908
909 /*
910 * 4 bits go in the "low" (but we assume the bottom 3 are zero)
911 * and the other 20 bits go in the "high"
912 */
913 NewPte->u.Subsect.SubsectionAddressLow = (Offset & 0x78) >> 3;
914 NewPte->u.Subsect.SubsectionAddressHigh = (Offset & 0xFFFFF80) >> 7;
915}
916
920{
922 return ((PointerPte->u.Long & 0xFFFFFC01) != 0);
923}
924
925#endif
926
928VOID
931 _In_ ULONG Protection)
932{
933 NewPte->u.Long = 0;
934 NewPte->u.Trans.Transition = 1;
935 NewPte->u.Trans.Protection = Protection;
936 NewPte->u.Trans.PageFrameNumber = Page;
937}
938
939//
940// Returns if the page is physically resident (ie: a large page)
941// FIXFIX: CISC/x86 only?
942//
946{
947 PMMPDE PointerPde;
948
949 /* Large pages are never paged out, always physically resident */
950 PointerPde = MiAddressToPde(Address);
951 return ((PointerPde->u.Hard.LargePage) && (PointerPde->u.Hard.Valid));
952}
953
954//
955// Writes a valid PTE
956//
958VOID
961{
962 /* Write the valid PTE */
963 ASSERT(PointerPte->u.Hard.Valid == 0);
964 ASSERT(TempPte.u.Hard.Valid == 1);
965#if _M_AMD64
967 (TempPte.u.Hard.NoExecute == 0));
968#endif
969 *PointerPte = TempPte;
970}
971
972//
973// Updates a valid PTE
974//
976VOID
979{
980 /* Write the valid PTE */
981 ASSERT(PointerPte->u.Hard.Valid == 1);
982 ASSERT(TempPte.u.Hard.Valid == 1);
983 ASSERT(PointerPte->u.Hard.PageFrameNumber == TempPte.u.Hard.PageFrameNumber);
984 *PointerPte = TempPte;
985}
986
987//
988// Writes an invalid PTE
989//
991VOID
993 IN MMPTE InvalidPte)
994{
995 /* Write the invalid PTE */
996 ASSERT(InvalidPte.u.Hard.Valid == 0);
997 ASSERT(InvalidPte.u.Long != 0);
998 *PointerPte = InvalidPte;
999}
1000
1001//
1002// Erase the PTE completely
1003//
1005VOID
1007{
1008 /* Zero out the PTE */
1009 ASSERT(PointerPte->u.Long != 0);
1010 PointerPte->u.Long = 0;
1011}
1012
1013//
1014// Writes a valid PDE
1015//
1017VOID
1020{
1021 /* Write the valid PDE */
1022 ASSERT(PointerPde->u.Hard.Valid == 0);
1023#ifdef _M_AMD64
1024 ASSERT(PointerPde->u.Hard.NoExecute == 0);
1025#endif
1026 ASSERT(TempPde.u.Hard.Valid == 1);
1027 *PointerPde = TempPde;
1028}
1029
1030//
1031// Writes an invalid PDE
1032//
1034VOID
1036 IN MMPDE InvalidPde)
1037{
1038 /* Write the invalid PDE */
1039 ASSERT(InvalidPde.u.Hard.Valid == 0);
1040 ASSERT(InvalidPde.u.Long != 0);
1041#ifdef _M_AMD64
1042 ASSERT(InvalidPde.u.Soft.Protection == MM_EXECUTE_READWRITE);
1043#endif
1044 *PointerPde = InvalidPde;
1045}
1046
1047//
1048// Checks if the thread already owns a working set
1049//
1051BOOLEAN
1053{
1054 /* If any of these are held, return TRUE */
1061}
1062
1064BOOLEAN
1066{
1070}
1071
1072//
1073// Checks if the process owns the working set lock
1074//
1076BOOLEAN
1078{
1079 /* Check if this process is the owner, and that the thread owns the WS */
1080 if (PsGetCurrentThread()->OwnsProcessWorkingSetExclusive == 0)
1081 {
1082 DPRINT("Thread: %p is not an owner\n", PsGetCurrentThread());
1083 }
1084 if (KeGetCurrentThread()->ApcState.Process != &Process->Pcb)
1085 {
1086 DPRINT("Current thread %p is attached to another process %p\n", PsGetCurrentThread(), Process);
1087 }
1088 return ((KeGetCurrentThread()->ApcState.Process == &Process->Pcb) &&
1089 ((PsGetCurrentThread()->OwnsProcessWorkingSetExclusive) ||
1090 (PsGetCurrentThread()->OwnsProcessWorkingSetShared)));
1091}
1092
1093//
1094// New ARM3<->RosMM PAGE Architecture
1095//
1097BOOLEAN
1099{
1100 return Section->u.Flags.filler;
1101}
1102
1103#define MI_IS_ROS_PFN(x) ((x)->u4.AweAllocation == TRUE)
1104
1105VOID
1106NTAPI
1108 IN PMMPFN Pfn1,
1109 IN PFN_NUMBER PageFrameIndex
1110);
1111
1113BOOLEAN
1115{
1116 return (Process->Vm.Flags.AcquiredUnsafe == TRUE);
1117}
1118
1119//
1120// Locks the working set for the given process
1121//
1123VOID
1126{
1127 /* Shouldn't already be owning the process working set */
1130
1131 /* Block APCs, make sure that still nothing is already held */
1134
1135 /* Lock the working set */
1136 ExAcquirePushLockExclusive(&Process->Vm.WorkingSetMutex);
1137
1138 /* Now claim that we own the lock */
1142}
1143
1145VOID
1148{
1149 /* Shouldn't already be owning the process working set */
1152
1153 /* Block APCs, make sure that still nothing is already held */
1156
1157 /* Lock the working set */
1158 ExAcquirePushLockShared(&Process->Vm.WorkingSetMutex);
1159
1160 /* Now claim that we own the lock */
1165}
1166
1168VOID
1171{
1172 /* Shouldn't already be owning the process working set */
1174
1175 /* APCs must be blocked, make sure that still nothing is already held */
1178
1179 /* Lock the working set */
1180 ExAcquirePushLockExclusive(&Process->Vm.WorkingSetMutex);
1181
1182 /* Now claim that we own the lock */
1184 Process->Vm.Flags.AcquiredUnsafe = 1;
1187}
1188
1189//
1190// Unlocks the working set for the given process
1191//
1193VOID
1196{
1197 /* Make sure we are the owner of a safe acquisition */
1200
1201 /* The thread doesn't own it anymore */
1204
1205 /* Release the lock and re-enable APCs */
1206 ExReleasePushLockExclusive(&Process->Vm.WorkingSetMutex);
1208}
1209
1210//
1211// Unlocks the working set for the given process
1212//
1214VOID
1217{
1218 /* Make sure we are the owner of a safe acquisition (because shared) */
1221
1222 /* Ensure we are in a shared acquisition */
1225
1226 /* Don't claim the lock anylonger */
1228
1229 /* Release the lock and re-enable APCs */
1230 ExReleasePushLockShared(&Process->Vm.WorkingSetMutex);
1232}
1233
1234//
1235// Unlocks the working set for the given process
1236//
1238VOID
1241{
1242 /* Make sure we are the owner of an unsafe acquisition */
1247
1248 /* No longer unsafe */
1249 Process->Vm.Flags.AcquiredUnsafe = 0;
1250
1251 /* The thread doesn't own it anymore */
1254
1255 /* Release the lock but don't touch APC state */
1256 ExReleasePushLockExclusive(&Process->Vm.WorkingSetMutex);
1258}
1259
1260//
1261// Locks the working set
1262//
1264VOID
1266 IN PMMSUPPORT WorkingSet)
1267{
1268 /* Block APCs */
1270
1271 /* Working set should be in global memory */
1272 ASSERT(MI_IS_SESSION_ADDRESS((PVOID)WorkingSet) == FALSE);
1273
1274 /* Thread shouldn't already be owning something */
1276
1277 /* Lock this working set */
1278 ExAcquirePushLockExclusive(&WorkingSet->WorkingSetMutex);
1279
1280 /* Which working set is this? */
1281 if (WorkingSet == &MmSystemCacheWs)
1282 {
1283 /* Own the system working set */
1287 }
1288 else if (WorkingSet->Flags.SessionSpace)
1289 {
1290 /* Own the session working set */
1294 }
1295 else
1296 {
1297 /* Own the process working set */
1301 }
1302}
1303
1305VOID
1308 _In_ PMMSUPPORT WorkingSet)
1309{
1310 /* Block APCs */
1312
1313 /* Working set should be in global memory */
1314 ASSERT(MI_IS_SESSION_ADDRESS((PVOID)WorkingSet) == FALSE);
1315
1316 /* Thread shouldn't already be owning something */
1318
1319 /* Lock this working set */
1320 ExAcquirePushLockShared(&WorkingSet->WorkingSetMutex);
1321
1322 /* Which working set is this? */
1323 if (WorkingSet == &MmSystemCacheWs)
1324 {
1325 /* Own the system working set */
1329 }
1330 else if (WorkingSet->Flags.SessionSpace)
1331 {
1332 /* Own the session working set */
1336 }
1337 else
1338 {
1339 /* Own the process working set */
1343 }
1344}
1345
1346//
1347// Unlocks the working set
1348//
1350VOID
1352 IN PMMSUPPORT WorkingSet)
1353{
1354 /* Working set should be in global memory */
1355 ASSERT(MI_IS_SESSION_ADDRESS((PVOID)WorkingSet) == FALSE);
1356
1357 /* Which working set is this? */
1358 if (WorkingSet == &MmSystemCacheWs)
1359 {
1360 /* Release the system working set */
1364 }
1365 else if (WorkingSet->Flags.SessionSpace)
1366 {
1367 /* Release the session working set */
1371 }
1372 else
1373 {
1374 /* Release the process working set */
1378 }
1379
1380 /* Release the working set lock */
1381 ExReleasePushLockExclusive(&WorkingSet->WorkingSetMutex);
1382
1383 /* Unblock APCs */
1385}
1386
1388VOID
1391 _In_ PMMSUPPORT WorkingSet)
1392{
1393 /* Working set should be in global memory */
1394 ASSERT(MI_IS_SESSION_ADDRESS((PVOID)WorkingSet) == FALSE);
1395
1396 /* Which working set is this? */
1397 if (WorkingSet == &MmSystemCacheWs)
1398 {
1399 /* Release the system working set */
1403 }
1404 else if (WorkingSet->Flags.SessionSpace)
1405 {
1406 /* Release the session working set */
1410 }
1411 else
1412 {
1413 /* Release the process working set */
1417 }
1418
1419 /* Release the working set lock */
1420 ExReleasePushLockShared(&WorkingSet->WorkingSetMutex);
1421
1422 /* Unblock APCs */
1424}
1425
1427BOOLEAN
1431{
1432 /* Sanity check: No exclusive lock. */
1436
1437 /* And it should have one and only one shared lock */
1439
1440 /* Try. */
1442 return FALSE;
1443
1444 if (Vm == &MmSystemCacheWs)
1445 {
1449 }
1450 else if (Vm->Flags.SessionSpace)
1451 {
1455 }
1456 else
1457 {
1461 }
1462
1463 return TRUE;
1464}
1465
1467VOID
1470 OUT PBOOLEAN Safe,
1471 OUT PBOOLEAN Shared)
1472{
1474
1475 /* Check if the current owner is unsafe */
1477 {
1478 /* Release unsafely */
1480 *Safe = FALSE;
1481 *Shared = FALSE;
1482 }
1484 {
1485 /* Owner is safe and exclusive, release normally */
1487 *Safe = TRUE;
1488 *Shared = FALSE;
1489 }
1490 else
1491 {
1492 /* Owner is shared (implies safe), release normally */
1494 *Safe = TRUE;
1495 *Shared = TRUE;
1496 }
1497}
1498
1500VOID
1503 IN BOOLEAN Safe,
1504 IN BOOLEAN Shared)
1505{
1506 /* Check if this was a safe lock or not */
1507 if (Safe)
1508 {
1509 if (Shared)
1510 {
1511 /* Reacquire safely & shared */
1513 }
1514 else
1515 {
1516 /* Reacquire safely */
1518 }
1519 }
1520 else
1521 {
1522 /* Unsafe lock cannot be shared */
1523 ASSERT(Shared == FALSE);
1524 /* Reacquire unsafely */
1526 }
1527}
1528
1530KIRQL
1532{
1533 KIRQL OldIrql;
1534
1539 return OldIrql;
1540}
1541
1543VOID
1545{
1550}
1551
1552//
1553// Returns the ProtoPTE inside a VAD for the given VPN
1554//
1556PMMPTE
1558 IN ULONG_PTR Vpn)
1559{
1560 PMMPTE ProtoPte;
1561
1562 /* Find the offset within the VAD's prototype PTEs */
1563 ProtoPte = Vad->FirstPrototypePte + (Vpn - Vad->StartingVpn);
1564 ASSERT(ProtoPte <= Vad->LastContiguousPte);
1565 return ProtoPte;
1566}
1567
1568//
1569// Returns the PFN Database entry for the given page number
1570// Warning: This is not necessarily a valid PFN database entry!
1571//
1573PMMPFN
1575{
1576 /* Get the entry */
1577 return &MmPfnDatabase[Pfn];
1578};
1579
1580//
1581// Drops a locked page without dereferencing it
1582//
1584VOID
1586{
1587 /* This page shouldn't be locked, but it should be valid */
1588 ASSERT(Pfn1->u3.e2.ReferenceCount != 0);
1589 ASSERT(Pfn1->u2.ShareCount == 0);
1590
1591 /* Is this the last reference to the page */
1592 if (Pfn1->u3.e2.ReferenceCount == 1)
1593 {
1594 /* It better not be valid */
1595 ASSERT(Pfn1->u3.e1.PageLocation != ActiveAndValid);
1596
1597 /* Is it a prototype PTE? */
1598 if ((Pfn1->u3.e1.PrototypePte == 1) &&
1599 (Pfn1->OriginalPte.u.Soft.Prototype == 1))
1600 {
1601 /* FIXME: We should return commit */
1602 DPRINT1("Not returning commit for prototype PTE\n");
1603 }
1604
1605 /* Update the counter */
1607 }
1608}
1609
1610//
1611// Drops a locked page and dereferences it
1612//
1614VOID
1616{
1617 USHORT RefCount, OldRefCount;
1618 PFN_NUMBER PageFrameIndex;
1619
1620 /* Loop while we decrement the page successfully */
1621 do
1622 {
1623 /* There should be at least one reference */
1624 OldRefCount = Pfn1->u3.e2.ReferenceCount;
1625 ASSERT(OldRefCount != 0);
1626
1627 /* Are we the last one */
1628 if (OldRefCount == 1)
1629 {
1630 /* The page shoudln't be shared not active at this point */
1631 ASSERT(Pfn1->u3.e2.ReferenceCount == 1);
1632 ASSERT(Pfn1->u3.e1.PageLocation != ActiveAndValid);
1633 ASSERT(Pfn1->u2.ShareCount == 0);
1634
1635 /* Is it a prototype PTE? */
1636 if ((Pfn1->u3.e1.PrototypePte == 1) &&
1637 (Pfn1->OriginalPte.u.Soft.Prototype == 1))
1638 {
1639 /* FIXME: We should return commit */
1640 DPRINT1("Not returning commit for prototype PTE\n");
1641 }
1642
1643 /* Update the counter, and drop a reference the long way */
1645 PageFrameIndex = MiGetPfnEntryIndex(Pfn1);
1646 MiDecrementReferenceCount(Pfn1, PageFrameIndex);
1647 return;
1648 }
1649
1650 /* Drop a reference the short way, and that's it */
1651 RefCount = InterlockedCompareExchange16((PSHORT)&Pfn1->u3.e2.ReferenceCount,
1652 OldRefCount - 1,
1653 OldRefCount);
1654 ASSERT(RefCount != 0);
1655 } while (OldRefCount != RefCount);
1656
1657 /* If we got here, there should be more than one reference */
1658 ASSERT(RefCount > 1);
1659 if (RefCount == 2)
1660 {
1661 /* Is it still being shared? */
1662 if (Pfn1->u2.ShareCount >= 1)
1663 {
1664 /* Then it should be valid */
1665 ASSERT(Pfn1->u3.e1.PageLocation == ActiveAndValid);
1666
1667 /* Is it a prototype PTE? */
1668 if ((Pfn1->u3.e1.PrototypePte == 1) &&
1669 (Pfn1->OriginalPte.u.Soft.Prototype == 1))
1670 {
1671 /* We don't handle ethis */
1672 ASSERT(FALSE);
1673 }
1674
1675 /* Update the counter */
1677 }
1678 }
1679}
1680
1681//
1682// References a locked page and updates the counter
1683// Used in MmProbeAndLockPages to handle different edge cases
1684//
1686VOID
1688{
1689 USHORT RefCount, OldRefCount;
1690
1691 /* Sanity check */
1692 ASSERT(Pfn1->u3.e2.ReferenceCount != 0);
1693
1694 /* Does ARM3 own the page? */
1695 if (MI_IS_ROS_PFN(Pfn1))
1696 {
1697 /* ReactOS Mm doesn't track share count */
1698 ASSERT(Pfn1->u3.e1.PageLocation == ActiveAndValid);
1699 }
1700 else
1701 {
1702 /* On ARM3 pages, we should see a valid share count */
1703 ASSERT((Pfn1->u2.ShareCount != 0) && (Pfn1->u3.e1.PageLocation == ActiveAndValid));
1704
1705 /* Is it a prototype PTE? */
1706 if ((Pfn1->u3.e1.PrototypePte == 1) &&
1707 (Pfn1->OriginalPte.u.Soft.Prototype == 1))
1708 {
1709 /* FIXME: We should charge commit */
1710 DPRINT1("Not charging commit for prototype PTE\n");
1711 }
1712 }
1713
1714 /* More locked pages! */
1716
1717 /* Loop trying to update the reference count */
1718 do
1719 {
1720 /* Get the current reference count, make sure it's valid */
1721 OldRefCount = Pfn1->u3.e2.ReferenceCount;
1722 ASSERT(OldRefCount != 0);
1723 ASSERT(OldRefCount < 2500);
1724
1725 /* Bump it up by one */
1726 RefCount = InterlockedCompareExchange16((PSHORT)&Pfn1->u3.e2.ReferenceCount,
1727 OldRefCount + 1,
1728 OldRefCount);
1729 ASSERT(RefCount != 0);
1730 } while (OldRefCount != RefCount);
1731
1732 /* Was this the first lock attempt? If not, undo our bump */
1733 if (OldRefCount != 1) InterlockedDecrementSizeT(&MmSystemLockPagesCount);
1734}
1735
1736//
1737// References a locked page and updates the counter
1738// Used in all other cases except MmProbeAndLockPages
1739//
1741VOID
1743{
1744 USHORT NewRefCount;
1745
1746 /* Is it a prototype PTE? */
1747 if ((Pfn1->u3.e1.PrototypePte == 1) &&
1748 (Pfn1->OriginalPte.u.Soft.Prototype == 1))
1749 {
1750 /* FIXME: We should charge commit */
1751 DPRINT1("Not charging commit for prototype PTE\n");
1752 }
1753
1754 /* More locked pages! */
1756
1757 /* Update the reference count */
1758 NewRefCount = InterlockedIncrement16((PSHORT)&Pfn1->u3.e2.ReferenceCount);
1759 if (NewRefCount == 2)
1760 {
1761 /* Is it locked or shared? */
1762 if (Pfn1->u2.ShareCount)
1763 {
1764 /* It's shared, so make sure it's active */
1765 ASSERT(Pfn1->u3.e1.PageLocation == ActiveAndValid);
1766 }
1767 else
1768 {
1769 /* It's locked, so we shouldn't lock again */
1771 }
1772 }
1773 else
1774 {
1775 /* Someone had already locked the page, so undo our bump */
1776 ASSERT(NewRefCount < 2500);
1778 }
1779}
1780
1781//
1782// References a locked page and updates the counter
1783// Used in all other cases except MmProbeAndLockPages
1784//
1786VOID
1788{
1789 USHORT NewRefCount;
1790
1791 /* Make sure the page isn't used yet */
1792 ASSERT(Pfn1->u2.ShareCount == 0);
1793 ASSERT(Pfn1->u3.e1.PageLocation != ActiveAndValid);
1794
1795 /* Is it a prototype PTE? */
1796 if ((Pfn1->u3.e1.PrototypePte == 1) &&
1797 (Pfn1->OriginalPte.u.Soft.Prototype == 1))
1798 {
1799 /* FIXME: We should charge commit */
1800 DPRINT1("Not charging commit for prototype PTE\n");
1801 }
1802
1803 /* More locked pages! */
1805
1806 /* Update the reference count */
1807 NewRefCount = InterlockedIncrement16((PSHORT)&Pfn1->u3.e2.ReferenceCount);
1808 if (NewRefCount != 1)
1809 {
1810 /* Someone had already locked the page, so undo our bump */
1811 ASSERT(NewRefCount < 2500);
1813 }
1814}
1815
1816
1817
1818CODE_SEG("INIT")
1819BOOLEAN
1820NTAPI
1822 IN ULONG Phase,
1823 IN PLOADER_PARAMETER_BLOCK LoaderBlock
1824);
1825
1826CODE_SEG("INIT")
1827VOID
1828NTAPI
1830
1831CODE_SEG("INIT")
1833NTAPI
1835 IN PLOADER_PARAMETER_BLOCK LoaderBlock
1836);
1837
1838CODE_SEG("INIT")
1839VOID
1840NTAPI
1842 VOID
1843);
1844
1845CODE_SEG("INIT")
1846VOID
1847NTAPI
1849 IN PLOADER_PARAMETER_BLOCK LoaderBlock
1850);
1851
1852CODE_SEG("INIT")
1853VOID
1854NTAPI
1856 VOID
1857);
1858
1859CODE_SEG("INIT")
1860VOID
1861NTAPI
1863 IN PLOADER_PARAMETER_BLOCK LoaderBlock
1864);
1865
1866VOID
1867NTAPI
1869 VOID
1870);
1871
1872VOID
1873NTAPI
1875 VOID
1876);
1877
1878CODE_SEG("INIT")
1879BOOLEAN
1880NTAPI
1882 VOID
1883);
1884
1885CODE_SEG("INIT")
1887NTAPI
1889 IN PFN_NUMBER PageCount
1890);
1891
1892CODE_SEG("INIT")
1894NTAPI
1896 IN PLOADER_PARAMETER_BLOCK LoaderBlock,
1897 IN PBOOLEAN IncludeType
1898);
1899
1901NTAPI
1903 IN PLOADER_PARAMETER_BLOCK LoaderBlock,
1904 IN PBOOLEAN IncludeType
1905);
1906
1907VOID
1910 IN PVOID AddressStart,
1911 IN PVOID AddressEnd
1912);
1913
1915NTAPI
1919 IN OUT PSIZE_T NumberOfBytesToProtect,
1920 IN ULONG NewAccessProtection,
1921 OUT PULONG OldAccessProtection OPTIONAL
1922);
1923
1925NTAPI
1927 IN ULONG FaultCode,
1930 IN PVOID TrapInformation
1931);
1932
1937);
1938
1939CODE_SEG("INIT")
1940VOID
1941NTAPI
1943 VOID
1944);
1945
1946CODE_SEG("INIT")
1947VOID
1948NTAPI
1950 VOID
1951);
1952
1953CODE_SEG("INIT")
1954VOID //
1955NTAPI //
1957 IN POOL_TYPE PoolType,// FIXFIX: This should go in ex.h after the pool merge
1958 IN ULONG Threshold //
1959); //
1960
1961// FIXFIX: THIS ONE TOO
1962CODE_SEG("INIT")
1963VOID
1964NTAPI
1966 IN PPOOL_DESCRIPTOR PoolDescriptor,
1968 IN ULONG PoolIndex,
1969 IN ULONG Threshold,
1970 IN PVOID PoolLock
1971);
1972
1974NTAPI
1976 VOID
1977);
1978
1979CODE_SEG("INIT")
1980VOID
1981NTAPI
1983 IN PMMPTE StartingPte,
1984 IN ULONG NumberOfPtes,
1986);
1987
1988PMMPTE
1989NTAPI
1991 IN ULONG NumberOfPtes,
1992 IN MMSYSTEM_PTE_POOL_TYPE SystemPtePoolType
1993);
1994
1995VOID
1996NTAPI
1998 IN PMMPTE StartingPte,
1999 IN ULONG NumberOfPtes,
2000 IN MMSYSTEM_PTE_POOL_TYPE SystemPtePoolType
2001);
2002
2003
2005NTAPI
2007 IN PFN_NUMBER LowestPfn,
2008 IN PFN_NUMBER HighestPfn,
2009 IN PFN_NUMBER BoundaryPfn,
2010 IN PFN_NUMBER SizeInPages,
2012);
2013
2014PVOID
2015NTAPI
2018 IN PFN_NUMBER BaseAddressPages,
2019 IN PFN_NUMBER SizeInPages,
2020 IN PFN_NUMBER LowestPfn,
2021 IN PFN_NUMBER HighestPfn,
2022 IN PFN_NUMBER BoundaryPfn,
2023 IN MI_PFN_CACHE_ATTRIBUTE CacheAttribute
2024);
2025
2026PMDL
2027NTAPI
2029 IN PHYSICAL_ADDRESS LowAddress,
2033 IN MI_PFN_CACHE_ATTRIBUTE CacheAttribute,
2034 IN ULONG Flags
2035);
2036
2037VOID
2038NTAPI
2040 IN PMMPFNLIST ListHead,
2041 IN PFN_NUMBER PageFrameIndex
2042);
2043
2044VOID
2045NTAPI
2048);
2049
2050VOID
2051NTAPI
2053 IN PMMPFN Pfn
2054);
2055
2056VOID
2057NTAPI
2059 IN PFN_NUMBER PageFrameIndex,
2060 IN PMMPTE PointerPte,
2061 IN BOOLEAN Modified
2062);
2063
2065NTAPI
2067 OUT PPFN_NUMBER PageFrameIndex,
2068 IN PMMPDE PointerPde,
2069 IN PFN_NUMBER ContainingPageFrame,
2070 IN BOOLEAN SessionAllocation
2071);
2072
2073VOID
2074NTAPI
2076 IN PFN_NUMBER PageFrameIndex,
2077 IN PMMPTE PointerPte,
2079);
2080
2081VOID
2082NTAPI
2084 IN PFN_NUMBER PageFrameIndex,
2085 IN PVOID PteAddress,
2086 IN PFN_NUMBER PteFrame
2087);
2088
2089VOID
2090NTAPI
2092 IN PMMPFN Pfn1,
2093 IN PFN_NUMBER PageFrameIndex
2094);
2095
2097NTAPI
2099 IN ULONG Color
2100);
2101
2103NTAPI
2105 IN ULONG Color
2106);
2107
2108VOID
2109NTAPI
2111 IN PFN_NUMBER PageFrameIndex
2112);
2113
2114VOID
2115NTAPI
2117 IN PFN_NUMBER PageFrameIndex
2118);
2119
2121NTAPI
2123 IN PMMPTE PointerPte,
2124 IN PFN_NUMBER PageCount,
2125 IN ULONG Flags,
2126 OUT PPFN_NUMBER ValidPages
2127);
2128
2129ULONG
2130NTAPI
2132 IN PMMPTE PointerPte
2133);
2134
2136NTAPI
2139);
2140
2141CODE_SEG("INIT")
2142VOID
2143NTAPI
2145 VOID
2146);
2147
2148CODE_SEG("INIT")
2149VOID
2150NTAPI
2152 VOID
2153);
2154
2155CODE_SEG("INIT")
2156VOID
2157NTAPI
2159 VOID
2160);
2161
2162BOOLEAN
2163NTAPI
2165 IN PMMPFN Pfn1
2166);
2167
2168PMMVAD
2169NTAPI
2172);
2173
2175NTAPI
2177 IN ULONG_PTR StartVpn,
2178 IN ULONG_PTR EndVpn,
2180 OUT PMMADDRESS_NODE *NodeOrParent
2181);
2182
2184NTAPI
2187 IN ULONG_PTR BoundaryAddress,
2192);
2193
2195NTAPI
2198 IN ULONG_PTR BoundaryAddress,
2202);
2203
2205NTAPI
2210 OUT PMMADDRESS_NODE *PreviousVad,
2212);
2213
2215NTAPI
2217 IN PMMVAD Vad,
2218 IN PVOID Base,
2219 IN SIZE_T Size,
2220 IN ULONG ProtectionMask
2221);
2222
2223VOID
2224NTAPI
2226 _Inout_ PMMVAD Vad,
2227 _Inout_ PMM_AVL_TABLE VadRoot);
2228
2230NTAPI
2232 _Inout_ PMMVAD Vad,
2235 _In_ ULONG_PTR HighestAddress,
2238
2239VOID
2240NTAPI
2242 IN PSECTION Section
2243);
2244
2246NTAPI
2250 IN BOOLEAN SkipDebuggerNotify
2251);
2252
2253VOID
2254NTAPI
2257 IN PMMADDRESS_NODE NewNode,
2260);
2261
2262VOID
2263NTAPI
2267);
2268
2270NTAPI
2273);
2274
2276NTAPI
2279);
2280
2281BOOLEAN
2282NTAPI
2284 IN PMMSESSION InputSession OPTIONAL
2285);
2286
2287VOID
2288NTAPI
2290 VOID
2291);
2292
2293VOID
2294NTAPI
2296 IN PMM_SESSION_SPACE SessionGlobal
2297);
2298
2299VOID
2300NTAPI
2302 IN PEPROCESS NewProcess
2303);
2304
2305ULONG
2306NTAPI
2309);
2310
2311VOID
2312NTAPI
2314 IN ULONG_PTR Va,
2315 IN ULONG_PTR EndingAddress,
2316 IN PMMVAD Vad
2317);
2318
2319VOID
2320NTAPI
2322 IN PMMPTE PointerPte,
2324 IN PEPROCESS CurrentProcess,
2326);
2327
2328ULONG
2329NTAPI
2331 IN PVOID PageTableVirtualAddress,
2332 IN PEPROCESS CurrentProcess
2333);
2334
2335ULONG
2336NTAPI
2340);
2341
2342VOID
2343NTAPI
2345 IN PEPROCESS CurrentProcess,
2346 IN PMMVAD Vad
2347);
2348
2350NTAPI
2352 IN PMMVAD Vad,
2353 IN ULONG_PTR Vpn
2354);
2355
2356VOID
2357NTAPI
2359 PVOID ObjectBody
2360);
2361
2363NTAPI
2367 OUT PVOID MemoryInformation,
2368 IN SIZE_T MemoryInformationLength,
2370);
2371
2373NTAPI
2376);
2377
2378VOID
2379NTAPI
2381 IN PMMPDE PointerPde,
2382 IN PEPROCESS TargetProcess,
2384);
2385
2386VOID
2387NTAPI
2389 _In_ PVOID ImageBase);
2390
2391//
2392// MiRemoveZeroPage will use inline code to zero out the page manually if only
2393// free pages are available. In some scenarios, we don't/can't run that piece of
2394// code and would rather only have a real zero page. If we can't have a zero page,
2395// then we'd like to have our own code to grab a free page and zero it out, by
2396// using MiRemoveAnyPage. This macro implements this.
2397//
2401{
2403 return 0;
2404}
2405
2406#if (_MI_PAGING_LEVELS == 2)
2408BOOLEAN
2409MiSynchronizeSystemPde(PMMPDE PointerPde)
2410{
2411 ULONG Index;
2412
2413 /* Get the Index from the PDE */
2414 Index = ((ULONG_PTR)PointerPde & (SYSTEM_PD_SIZE - 1)) / sizeof(MMPTE);
2415 if (PointerPde->u.Hard.Valid != 0)
2416 {
2417 NT_ASSERT(PointerPde->u.Long == MmSystemPagePtes[Index].u.Long);
2418 return TRUE;
2419 }
2420
2421 if (MmSystemPagePtes[Index].u.Hard.Valid == 0)
2422 {
2423 return FALSE;
2424 }
2425
2426 /* Copy the PDE from the double-mapped system page directory */
2428
2429 /* Make sure we re-read the PDE and PTE */
2431
2432 /* Return success */
2433 return TRUE;
2434}
2435#endif
2436
2437#if _MI_PAGING_LEVELS == 2
2439USHORT
2441{
2442 PUSHORT RefCount;
2443
2445
2446 *RefCount += 1;
2447 ASSERT(*RefCount <= PTE_PER_PAGE);
2448 return *RefCount;
2449}
2450
2452USHORT
2454{
2455 PUSHORT RefCount;
2456
2458
2459 *RefCount -= 1;
2460 ASSERT(*RefCount < PTE_PER_PAGE);
2461 return *RefCount;
2462}
2463#else
2465USHORT
2467{
2468 PMMPDE PointerPde = MiAddressToPde(Address);
2469 PMMPFN Pfn;
2470
2471 /* We should not tinker with this one. */
2472 ASSERT(PointerPde != (PMMPDE)PXE_SELFMAP);
2473 DPRINT("Incrementing %p from %p\n", Address, _ReturnAddress());
2474
2475 /* Make sure we're locked */
2476 ASSERT(PsGetCurrentThread()->OwnsProcessWorkingSetExclusive);
2477
2478 /* If we're bumping refcount, then it must be valid! */
2479 ASSERT(PointerPde->u.Hard.Valid == 1);
2480
2481 /* This lies on the PFN */
2482 Pfn = MiGetPfnEntry(PFN_FROM_PDE(PointerPde));
2484
2486
2488}
2489
2491USHORT
2493{
2494 PMMPDE PointerPde = MiAddressToPde(Address);
2495 PMMPFN Pfn;
2496
2497 /* We should not tinker with this one. */
2498 ASSERT(PointerPde != (PMMPDE)PXE_SELFMAP);
2499
2500 DPRINT("Decrementing %p from %p\n", PointerPde, _ReturnAddress());
2501
2502 /* Make sure we're locked */
2503 ASSERT(PsGetCurrentThread()->OwnsProcessWorkingSetExclusive);
2504
2505 /* If we're decreasing refcount, then it must be valid! */
2506 ASSERT(PointerPde->u.Hard.Valid == 1);
2507
2508 /* This lies on the PFN */
2509 Pfn = MiGetPfnEntry(PFN_FROM_PDE(PointerPde));
2510
2513
2515
2517}
2518#endif
2519
2520#ifdef __cplusplus
2521} // extern "C"
2522#endif
2523
2525VOID
2527 _In_ PMMPDE PointerPde,
2528 _In_ PEPROCESS CurrentProcess)
2529{
2530 /* Only for user-mode ones */
2531 ASSERT(MiIsUserPde(PointerPde));
2532
2533 /* Kill this one as a PTE */
2534 MiDeletePte((PMMPTE)PointerPde, MiPdeToPte(PointerPde), CurrentProcess, NULL);
2535#if _MI_PAGING_LEVELS >= 3
2536 /* Cascade down */
2537 if (MiDecrementPageTableReferences(MiPdeToPte(PointerPde)) == 0)
2538 {
2539 MiDeletePte(MiPdeToPpe(PointerPde), PointerPde, CurrentProcess, NULL);
2540#if _MI_PAGING_LEVELS == 4
2541 if (MiDecrementPageTableReferences(PointerPde) == 0)
2542 {
2543 MiDeletePte(MiPdeToPxe(PointerPde), MiPdeToPpe(PointerPde), CurrentProcess, NULL);
2544 }
2545#endif
2546 }
2547#endif
2548}
2549
2550/* EOF */
#define CODE_SEG(...)
unsigned char BOOLEAN
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx 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:732
HARDWARE_PTE_ARMV6 TempPte
Definition: winldr.c:76
#define PDE_BASE
Definition: winldr.c:21
HARDWARE_PDE_ARMV6 TempPde
Definition: winldr.c:78
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ULONG_PTR
Definition: config.h:101
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:43
UCHAR KIRQL
Definition: env_spec_w32.h:591
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define APC_LEVEL
Definition: env_spec_w32.h:695
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define NonPagedPool
Definition: env_spec_w32.h:307
#define PagedPool
Definition: env_spec_w32.h:308
FORCEINLINE VOID ExAcquirePushLockExclusive(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1036
FORCEINLINE VOID ExAcquirePushLockShared(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1105
FORCEINLINE VOID ExReleasePushLockShared(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1213
FORCEINLINE BOOLEAN ExConvertPushLockSharedToExclusive(IN PEX_PUSH_LOCK PushLock)
Definition: ex.h:1139
FORCEINLINE VOID ExReleasePushLockExclusive(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1252
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:223
ASMGENDATA Table[]
Definition: genincdata.c:61
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define KeGetCurrentThread
Definition: hal.h:55
_In_ ULONG Mode
Definition: hubbusif.h:303
#define InterlockedCompareExchange16
Definition: interlocked.h:109
#define InterlockedDecrementSizeT(a)
Definition: interlocked.h:153
#define InterlockedIncrement16
Definition: interlocked.h:206
#define InterlockedIncrementSizeT(a)
Definition: interlocked.h:220
#define _ReturnAddress()
Definition: intrin_arm.h:35
#define C_ASSERT(e)
Definition: intsafe.h:73
#define KeLeaveGuardedRegion()
Definition: ke_x.h:68
#define KeEnterGuardedRegion()
Definition: ke_x.h:39
PMMVAD NTAPI MiLocateAddress(IN PVOID VirtualAddress)
Definition: vadnode.c:116
MMPTE ValidKernelPte
Definition: init.c:29
_MMSYSTEM_PTE_POOL_TYPE
Definition: miarm.h:402
@ SystemPteSpace
Definition: miarm.h:403
@ MaximumPtePoolTypes
Definition: miarm.h:405
@ NonPagedPoolExpansion
Definition: miarm.h:404
FORCEINLINE VOID MI_MAKE_SUBSECTION_PTE(IN PMMPTE NewPte, IN PVOID Segment)
Definition: miarm.h:883
VOID NTAPI MiInitializeSystemPtes(IN PMMPTE StartingPte, IN ULONG NumberOfPtes, IN MMSYSTEM_PTE_POOL_TYPE PoolType)
Definition: syspte.c:388
SIZE_T MmMinimumNonPagedPoolSize
Definition: mminit.c:39
BOOLEAN MmTrackLockedPages
Definition: mdlsup.c:21
PMMPTE MiHighestUserPte
Definition: mminit.c:233
PETHREAD MiExpansionLockOwner
Definition: session.c:33
PMMWSL MmWorkingSetList
Definition: wslist.cpp:19
#define MI_IS_ROS_PFN(x)
Definition: miarm.h:1103
ULONG MmMaximumNonPagedPoolPercent
Definition: init.c:20
FORCEINLINE KIRQL MiAcquireExpansionLock(VOID)
Definition: miarm.h:1531
PMMPTE MmSharedUserDataPte
Definition: mminit.c:26
PFN_COUNT MiExpansionPoolPagesInitialCharge
Definition: pool.c:21
VOID NTAPI MiDeleteVirtualAddresses(IN ULONG_PTR Va, IN ULONG_PTR EndingAddress, IN PMMVAD Vad)
Definition: virtual.c:530
KGUARDED_MUTEX MmSectionBasedMutex
Definition: section.c:110
NTSTATUS NTAPI MiQueryMemorySectionName(IN HANDLE ProcessHandle, IN PVOID BaseAddress, OUT PVOID MemoryInformation, IN SIZE_T MemoryInformationLength, OUT PSIZE_T ReturnLength)
Definition: section.c:1752
PFN_NUMBER MiNumberOfFreePages
Definition: mminit.c:384
PVOID MmNonPagedSystemStart
Definition: miarm.h:576
VOID NTAPI MiInsertNode(IN PMM_AVL_TABLE Table, IN PMMADDRESS_NODE NewNode, PMMADDRESS_NODE Parent, TABLE_SEARCH_RESULT Result)
FORCEINLINE PMMPTE MI_GET_PROTOTYPE_PTE_FOR_VPN(IN PMMVAD Vad, IN ULONG_PTR Vpn)
Definition: miarm.h:1557
PMMPTE MiSessionBasePte
Definition: mminit.c:145
FORCEINLINE BOOLEAN MM_ANY_WS_LOCK_HELD_EXCLUSIVE(_In_ PETHREAD Thread)
Definition: miarm.h:1065
FORCEINLINE BOOLEAN MI_IS_PHYSICAL_ADDRESS(IN PVOID Address)
Definition: miarm.h:945
struct _POOL_TRACKER_TABLE POOL_TRACKER_TABLE
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:182
FORCEINLINE VOID MiLockProcessWorkingSetShared(IN PEPROCESS Process, IN PETHREAD Thread)
Definition: miarm.h:1146
PMMPTE MmSystemPtesStart[MaximumPtePoolTypes]
Definition: syspte.c:22
FORCEINLINE BOOLEAN MiIsMemoryTypeInvisible(TYPE_OF_MEMORY MemoryType)
Definition: miarm.h:678
FORCEINLINE VOID MiDeletePde(_In_ PMMPDE PointerPde, _In_ PEPROCESS CurrentProcess)
Definition: miarm.h:2526
PMMPTE MmLastReservedMappingPte
Definition: miarm.h:561
PVOID MmPagedPoolStart
Definition: miarm.h:574
PMEMORY_ALLOCATION_DESCRIPTOR MxFreeDescriptor
Definition: init.c:46
PFN_NUMBER NTAPI MiRemoveZeroPage(IN ULONG Color)
Definition: pfnlist.c:537
FORCEINLINE VOID MiLockWorkingSet(IN PETHREAD Thread, IN PMMSUPPORT WorkingSet)
Definition: miarm.h:1265
FORCEINLINE VOID MI_MAKE_HARDWARE_PTE_USER(IN PMMPTE NewPte, IN PMMPTE MappingPte, IN ULONG_PTR ProtectionMask, IN PFN_NUMBER PageFrameNumber)
Definition: miarm.h:827
ULONG MmProcessColorSeed
Definition: procsup.c:20
struct _MMSESSION MMSESSION
struct _MM_SESSION_SPACE * PMM_SESSION_SPACE
PFN_NUMBER MmLowMemoryThreshold
Definition: mminit.c:300
ULONG MmVerifyDriverBufferType
Definition: drvmgmt.c:25
VOID NTAPI MiInitializePfnDatabase(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: mminit.c:1074
SIZE_T MmMinimumStackCommitInBytes
Definition: mminit.c:370
VOID NTAPI ExInitializePoolDescriptor(IN PPOOL_DESCRIPTOR PoolDescriptor, IN POOL_TYPE PoolType, IN ULONG PoolIndex, IN ULONG Threshold, IN PVOID PoolLock)
Definition: expool.c:969
ULONG NTAPI MiGetPageProtection(IN PMMPTE PointerPte)
Definition: virtual.c:1355
VOID NTAPI MiInsertBasedSection(IN PSECTION Section)
Definition: vadnode.c:423
VOID NTAPI MiRemoveNode(IN PMMADDRESS_NODE Node, IN PMM_AVL_TABLE Table)
Definition: vadnode.c:440
PMMPTE MmSystemPtesEnd[MaximumPtePoolTypes]
Definition: syspte.c:23
VOID NTAPI MiInitializePoolEvents(VOID)
Definition: pool.c:203
FORCEINLINE VOID MiUnlockProcessWorkingSetForFault(IN PEPROCESS Process, IN PETHREAD Thread, OUT PBOOLEAN Safe, OUT PBOOLEAN Shared)
Definition: miarm.h:1468
SLIST_HEADER MmDeadStackSListHead
Definition: procsup.c:22
MM_SYSTEMSIZE MmSystemSize
Definition: mminit.c:326
BOOLEAN MmDynamicPfn
Definition: pfnlist.c:34
struct _MI_LARGE_PAGE_RANGES MI_LARGE_PAGE_RANGES
ULONG MmSecondaryColorMask
Definition: mminit.c:257
FORCEINLINE BOOLEAN MI_IS_WS_UNSAFE(IN PEPROCESS Process)
Definition: miarm.h:1114
ULONG_PTR MmSubsectionBase
Definition: section.c:196
VOID NTAPI InitializePool(IN POOL_TYPE PoolType, IN ULONG Threshold)
Definition: expool.c:1020
SIZE_T MmBootImageSize
Definition: init.c:49
VOID NTAPI MiDeletePte(IN PMMPTE PointerPte, IN PVOID VirtualAddress, IN PEPROCESS CurrentProcess, IN PMMPTE PrototypePte)
Definition: virtual.c:369
VOID NTAPI MiReleaseProcessReferenceToSessionDataPage(IN PMM_SESSION_SPACE SessionGlobal)
Definition: session.c:209
PMMPDE MmSystemPagePtes
Definition: init.c:41
FORCEINLINE BOOLEAN MiIsRosSectionObject(IN PSECTION Section)
Definition: miarm.h:1098
#define MM_GUARDPAGE
Definition: miarm.h:57
FORCEINLINE VOID MiLockProcessWorkingSetForFault(IN PEPROCESS Process, IN PETHREAD Thread, IN BOOLEAN Safe, IN BOOLEAN Shared)
Definition: miarm.h:1501
struct _PHYSICAL_MEMORY_RUN * PPHYSICAL_MEMORY_RUN
PVOID MmNonPagedPoolEnd
Definition: mminit.c:99
PMMPDE MiHighestUserPde
Definition: mminit.c:234
VOID NTAPI MiUnlinkFreeOrZeroedPage(IN PMMPFN Entry)
Definition: pfnlist.c:137
MI_PFN_CACHE_ATTRIBUTE MiPlatformCacheAttributes[2][MmMaximumCacheType]
Definition: iosup.c:27
struct _MMCOLOR_TABLES MMCOLOR_TABLES
VOID NTAPI MiZeroPhysicalPage(IN PFN_NUMBER PageFrameIndex)
Definition: pfnlist.c:122
ULONG NTAPI MiMakeSystemAddressValidPfn(IN PVOID VirtualAddress, IN KIRQL OldIrql)
Definition: virtual.c:235
struct _MI_LARGE_PAGE_DRIVER_ENTRY MI_LARGE_PAGE_DRIVER_ENTRY
ULONG_PTR MxPfnAllocation
Definition: init.c:43
SIZE_T MmSessionViewSize
Definition: init.c:35
BOOLEAN NTAPI MiInitializeMemoryEvents(VOID)
Definition: mminit.c:1339
FORCEINLINE BOOLEAN MI_IS_PROCESS_WORKING_SET(PMMSUPPORT WorkingSet)
Definition: miarm.h:661
#define POOL_LISTS_PER_PAGE
Definition: miarm.h:271
PFN_NUMBER MmMinimumFreePages
Definition: mminit.c:314
SIZE_T MmSizeOfNonPagedPoolInBytes
Definition: init.c:21
VOID NTAPI MiSessionAddProcess(IN PEPROCESS NewProcess)
Definition: session.c:423
PFN_NUMBER MiLowPagedPoolThreshold
Definition: mminit.c:302
MMPTE ValidKernelPteLocal
Definition: init.c:33
FORCEINLINE VOID MI_MAKE_PROTOTYPE_PTE(IN PMMPTE NewPte, IN PMMPTE PointerPte)
Definition: miarm.h:854
PMM_SESSION_SPACE MmSessionSpace
Definition: session.c:21
VOID NTAPI MiInitializeColorTables(VOID)
Definition: mminit.c:562
FORCEINLINE VOID MiReferenceUsedPageAndBumpLockCount(IN PMMPFN Pfn1)
Definition: miarm.h:1742
struct _MI_LARGE_PAGE_RANGES * PMI_LARGE_PAGE_RANGES
PFN_NUMBER NTAPI MxGetNextPage(IN PFN_NUMBER PageCount)
Definition: mminit.c:483
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:799
#define MI_IS_SESSION_ADDRESS(Address)
Definition: miarm.h:171
SIZE_T MmSessionImageSize
Definition: init.c:37
struct _PHYSICAL_MEMORY_DESCRIPTOR * PPHYSICAL_MEMORY_DESCRIPTOR
BOOLEAN MmProtectFreedNonPagedPool
Definition: pool.c:31
BOOLEAN MmEnforceWriteProtection
Definition: sysldr.c:34
ULONG MmVerifyDriverLevel
Definition: drvmgmt.c:26
ULONG MmSecondaryColors
Definition: mminit.c:256
PMMPTE MiFirstReservedZeroingPte
Definition: hypermap.c:21
PVOID MiSessionViewStart
Definition: init.c:30
PMMPTE MiSessionImagePteEnd
Definition: mminit.c:144
VOID NTAPI MiInsertPageInFreeList(IN PFN_NUMBER PageFrameIndex)
Definition: pfnlist.c:611
PFN_NUMBER NTAPI MiRemoveAnyPage(IN ULONG Color)
Definition: pfnlist.c:477
KGUARDED_MUTEX MmPagedPoolMutex
Definition: pool.c:24
LIST_ENTRY MmProcessList
Definition: largepag.c:20
MMPDE DemandZeroPde
Definition: init.c:36
#define POOL_BLOCK_SIZE
Definition: miarm.h:269
VOID NTAPI MiReleaseSystemPtes(IN PMMPTE StartingPte, IN ULONG NumberOfPtes, IN MMSYSTEM_PTE_POOL_TYPE SystemPtePoolType)
Definition: syspte.c:264
enum _MI_PFN_CACHE_ATTRIBUTE MI_PFN_CACHE_ATTRIBUTE
BOOLEAN NTAPI MmArmInitSystem(IN ULONG Phase, IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: mminit.c:2046
MMPTE HyperTemplatePte
Definition: hypermap.c:22
VOID NTAPI MiRemoveMappedView(IN PEPROCESS CurrentProcess, IN PMMVAD Vad)
Definition: section.c:766
#define MM_EXECUTE_READWRITE
Definition: miarm.h:49
PFN_NUMBER MmResidentAvailableAtInit
Definition: freelist.c:28
struct _POOL_TRACKER_TABLE * PPOOL_TRACKER_TABLE
struct _POOL_DESCRIPTOR POOL_DESCRIPTOR
PFN_NUMBER MmMaximumNonPagedPoolInPages
Definition: mminit.c:30
ULONG ExpNumberOfPagedPools
Definition: expool.c:41
VOID NTAPI MiInitializeSessionIds(VOID)
Definition: session.c:116
FORCEINLINE BOOLEAN MiIsUserPte(PVOID Address)
Definition: miarm.h:725
MMPDE ValidKernelPdeLocal
Definition: init.c:32
PMMADDRESS_NODE NTAPI MiGetPreviousNode(IN PMMADDRESS_NODE Node)
Definition: vadnode.c:513
FORCEINLINE VOID MiUnlockProcessWorkingSetShared(IN PEPROCESS Process, IN PETHREAD Thread)
Definition: miarm.h:1215
VOID NTAPI MiInitializePfnAndMakePteValid(IN PFN_NUMBER PageFrameIndex, IN PMMPTE PointerPte, IN MMPTE TempPte)
Definition: pfnlist.c:1041
PVOID MiSessionImageStart
Definition: init.c:29
MMPTE MmDecommittedPte
Definition: init.c:44
struct _POOL_TRACKER_BIG_PAGES * PPOOL_TRACKER_BIG_PAGES
VOID NTAPI MiWriteProtectSystemImage(_In_ PVOID ImageBase)
Definition: sysldr.c:2481
FORCEINLINE VOID MI_MAKE_HARDWARE_PTE_KERNEL(IN PMMPTE NewPte, IN PMMPTE MappingPte, IN ULONG_PTR ProtectionMask, IN PFN_NUMBER PageFrameNumber)
Definition: miarm.h:773
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
PFN_NUMBER MmPlentyFreePages
Definition: mminit.c:322
ULONG MmVerifyDriverBufferLength
Definition: drvmgmt.c:24
PMMWSL MmSystemCacheWorkingSetList
Definition: mminit.c:174
BOOLEAN MmMakeLowMemory
Definition: sysldr.c:33
MM_PAGED_POOL_INFO MmPagedPoolInfo
Definition: pool.c:25
WCHAR MmVerifyDriverBuffer[512]
Definition: drvmgmt.c:23
VOID NTAPI MiDeleteARM3Section(PVOID ObjectBody)
Definition: section.c:2949
KSPIN_LOCK MmExpansionLock
Definition: session.c:32
NTSTATUS NTAPI MiInitializeAndChargePfn(OUT PPFN_NUMBER PageFrameIndex, IN PMMPDE PointerPde, IN PFN_NUMBER ContainingPageFrame, IN BOOLEAN SessionAllocation)
Definition: pfnlist.c:1101
SIZE_T MmSessionSize
Definition: init.c:34
FORCEINLINE VOID MiReleaseExpansionLock(KIRQL OldIrql)
Definition: miarm.h:1544
PFN_NUMBER MiHighPagedPoolThreshold
Definition: mminit.c:303
PMMPTE MiSessionLastPte
Definition: mminit.c:146
FORCEINLINE VOID MI_ERASE_PTE(IN PMMPTE PointerPte)
Definition: miarm.h:1006
#define MI_IS_SESSION_PTE(Pte)
Definition: miarm.h:174
#define MI_IS_PAGE_TABLE_ADDRESS(Address)
Definition: miarm.h:177
VOID NTAPI MiInitializeNonPagedPoolThresholds(VOID)
Definition: pool.c:186
VOID NTAPI MiInitializeSessionSpaceLayout(VOID)
Definition: init.c:63
SIZE_T MmSessionPoolSize
Definition: init.c:36
VOID NTAPI MiInitializePfnForOtherProcess(IN PFN_NUMBER PageFrameIndex, IN PVOID PteAddress, IN PFN_NUMBER PteFrame)
Definition: pfnlist.c:1301
PMMPTE MiSessionImagePteStart
Definition: mminit.c:143
FORCEINLINE USHORT MiDecrementPageTableReferences(IN PVOID Address)
Definition: miarm.h:2492
PVOID MiSessionPoolStart
Definition: init.c:32
ULONG MmNumberOfSystemPtes
Definition: init.c:42
struct _POOL_DESCRIPTOR * PPOOL_DESCRIPTOR
NTSTATUS NTAPI MmArmAccessFault(IN ULONG FaultCode, IN PVOID Address, IN KPROCESSOR_MODE Mode, IN PVOID TrapInformation)
Definition: pagfault.c:1698
BOOLEAN MmLargeSystemCache
Definition: mminit.c:340
FORCEINLINE VOID MI_WRITE_VALID_PDE(IN PMMPDE PointerPde, IN MMPDE TempPde)
Definition: miarm.h:1018
VOID NTAPI MiDecrementShareCount(IN PMMPFN Pfn1, IN PFN_NUMBER PageFrameIndex)
Definition: pfnlist.c:1141
FORCEINLINE VOID MiUnlockProcessWorkingSet(IN PEPROCESS Process, IN PETHREAD Thread)
Definition: miarm.h:1194
struct _MMVIEW * PMMVIEW
PKEVENT MiLowNonPagedPoolEvent
Definition: mminit.c:296
FORCEINLINE VOID MiUnlockProcessWorkingSetUnsafe(IN PEPROCESS Process, IN PETHREAD Thread)
Definition: miarm.h:1239
struct _MMCOLOR_TABLES * PMMCOLOR_TABLES
const ULONG MmProtectToValue[32]
Definition: page.c:71
VOID NTAPI MiInitializeDriverLargePageList(VOID)
Definition: largepag.c:68
#define _1MB
Definition: miarm.h:19
ULONG MmTotalFreeSystemPtes[MaximumPtePoolTypes]
Definition: syspte.c:25
PKEVENT MiHighMemoryEvent
Definition: mminit.c:293
PKEVENT MiLowMemoryEvent
Definition: mminit.c:292
struct _MI_LARGE_PAGE_DRIVER_ENTRY * PMI_LARGE_PAGE_DRIVER_ENTRY
ULONG MmProductType
Definition: mminit.c:325
VOID FASTCALL MiSyncARM3WithROS(IN PVOID AddressStart, IN PVOID AddressEnd)
FORCEINLINE VOID MiReferenceUnusedPageAndBumpLockCount(IN PMMPFN Pfn1)
Definition: miarm.h:1787
_MI_PFN_CACHE_ATTRIBUTE
Definition: miarm.h:409
@ MiWriteCombined
Definition: miarm.h:412
@ MiCached
Definition: miarm.h:411
@ MiNotMapped
Definition: miarm.h:413
@ MiNonCached
Definition: miarm.h:410
FORCEINLINE VOID MI_WRITE_INVALID_PTE(IN PMMPTE PointerPte, IN MMPTE InvalidPte)
Definition: miarm.h:992
BOOLEAN MmZeroPageFile
Definition: pagefile.c:71
enum _MI_PFN_CACHE_ATTRIBUTE * PMI_PFN_CACHE_ATTRIBUTE
PPHYSICAL_MEMORY_DESCRIPTOR NTAPI MmInitializeMemoryLimits(IN PLOADER_PARAMETER_BLOCK LoaderBlock, IN PBOOLEAN IncludeType)
Definition: mminit.c:1622
FORCEINLINE VOID MiUnlockWorkingSet(IN PETHREAD Thread, IN PMMSUPPORT WorkingSet)
Definition: miarm.h:1351
VOID NTAPI MiMakePdeExistAndMakeValid(IN PMMPDE PointerPde, IN PEPROCESS TargetProcess, IN KIRQL OldIrql)
Definition: virtual.c:2481
ULONG NTAPI MiMakeSystemAddressValid(IN PVOID PageTableVirtualAddress, IN PEPROCESS CurrentProcess)
Definition: virtual.c:183
VOID NTAPI MiSessionRemoveProcess(VOID)
Definition: session.c:392
FORCEINLINE VOID MiDereferencePfnAndDropLockCount(IN PMMPFN Pfn1)
Definition: miarm.h:1615
MMPFNLIST MmStandbyPageListByPriority[8]
Definition: pfnlist.c:44
PFN_NUMBER MmTotalSystemDriverPages
Definition: sysldr.c:28
struct _PHYSICAL_MEMORY_RUN PHYSICAL_MEMORY_RUN
ULONG MmLargePageDriverBufferLength
Definition: largepag.c:25
NTSTATUS NTAPI MiRosUnmapViewInSystemSpace(IN PVOID MappedBase)
Definition: section.c:4557
SIZE_T MmMaximumNonPagedPoolInBytes
Definition: init.c:22
ULONG MmMaxAdditionNonPagedPoolPerMb
Definition: mminit.c:42
PVOID MmNonPagedPoolExpansionStart
Definition: init.c:25
PMMPTE NTAPI MiReserveSystemPtes(IN ULONG NumberOfPtes, IN MMSYSTEM_PTE_POOL_TYPE SystemPtePoolType)
Definition: syspte.c:246
VOID NTAPI MiUnlinkPageFromList(IN PMMPFN Pfn)
Definition: pfnlist.c:265
PVOID MmHighSectionBase
Definition: section.c:111
PVOID MmSessionBase
Definition: miarm.h:579
FORCEINLINE VOID MiReferenceProbedPageAndBumpLockCount(IN PMMPFN Pfn1)
Definition: miarm.h:1687
MMPTE PrototypePte
Definition: init.c:40
PSUBSECTION NTAPI MiLocateSubsection(IN PMMVAD Vad, IN ULONG_PTR Vpn)
Definition: section.c:556
BOOLEAN MiLargePageAllDrivers
Definition: largepag.c:27
PFN_NUMBER NTAPI MiPagesInLoaderBlock(IN PLOADER_PARAMETER_BLOCK LoaderBlock, IN PBOOLEAN IncludeType)
MMPTE DemandZeroPte
Definition: init.c:37
FORCEINLINE BOOLEAN MI_IS_MAPPED_PTE(PMMPTE PointerPte)
Definition: miarm.h:919
POOL_DESCRIPTOR NonPagedPoolDescriptor
Definition: expool.c:42
FORCEINLINE BOOLEAN MM_ANY_WS_LOCK_HELD(IN PETHREAD Thread)
Definition: miarm.h:1052
#define SYSTEM_PD_SIZE
Definition: miarm.h:32
BOOLEAN NTAPI MiIsPfnInUse(IN PMMPFN Pfn1)
Definition: freelist.c:174
PPOOL_TRACKER_TABLE PoolTrackTable
Definition: expool.c:49
NTSTATUS NTAPI MiRosUnmapViewOfSection(IN PEPROCESS Process, IN PVOID BaseAddress, IN BOOLEAN SkipDebuggerNotify)
Definition: section.c:3589
SIZE_T MmAllocatedNonPagedPool
Definition: pool.c:26
PPOOL_DESCRIPTOR ExpPagedPoolDescriptor[16+1]
Definition: expool.c:43
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:282
PVOID MiSystemViewStart
Definition: miarm.h:642
ULONG MmMinAdditionNonPagedPoolPerMb
Definition: mminit.c:40
LIST_ENTRY MiLargePageDriverList
Definition: largepag.c:26
ULONG MmSpecialPoolTag
Definition: pool.c:29
PVOID MmHyperSpaceEnd
Definition: init.c:56
struct _PHYSICAL_MEMORY_DESCRIPTOR PHYSICAL_MEMORY_DESCRIPTOR
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:681
VOID NTAPI MiMapPfnDatabase(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: mminit.c:672
FORCEINLINE BOOLEAN MiIsMemoryTypeFree(TYPE_OF_MEMORY MemoryType)
Definition: miarm.h:668
struct _MMVIEW MMVIEW
KGUARDED_MUTEX MmSectionCommitMutex
Definition: section.c:108
BOOLEAN NTAPI MiInitializeSystemSpaceMap(IN PMMSESSION InputSession OPTIONAL)
Definition: section.c:222
PFN_NUMBER MiLowNonPagedPoolThreshold
Definition: mminit.c:304
FORCEINLINE VOID MiLockWorkingSetShared(_In_ PETHREAD Thread, _In_ PMMSUPPORT WorkingSet)
Definition: miarm.h:1306
MMSUPPORT MmSystemCacheWs
Definition: init.c:55
FORCEINLINE VOID MI_WRITE_INVALID_PDE(IN PMMPDE PointerPde, IN MMPDE InvalidPde)
Definition: miarm.h:1035
PFN_NUMBER MiHighNonPagedPoolThreshold
Definition: mminit.c:305
MEMORY_ALLOCATION_DESCRIPTOR MxOldFreeDescriptor
Definition: init.c:47
BOOLEAN MmMirroring
Definition: pfnlist.c:35
struct _MM_SESSION_SPACE_FLAGS MM_SESSION_SPACE_FLAGS
ULONG MmLargeStackSize
Definition: mminit.c:262
VOID NTAPI MiComputeColorInformation(VOID)
Definition: mminit.c:508
FORCEINLINE VOID MI_MAKE_HARDWARE_PTE(IN PMMPTE NewPte, IN PMMPTE MappingPte, IN ULONG_PTR ProtectionMask, IN PFN_NUMBER PageFrameNumber)
Definition: miarm.h:807
struct _POOL_HEADER POOL_HEADER
VOID NTAPI MiInsertPageInList(IN PMMPFNLIST ListHead, IN PFN_NUMBER PageFrameIndex)
Definition: pfnlist.c:779
NTSTATUS NTAPI MiCheckSecuredVad(IN PMMVAD Vad, IN PVOID Base, IN SIZE_T Size, IN ULONG ProtectionMask)
Definition: vadnode.c:903
PKEVENT MiHighPagedPoolEvent
Definition: mminit.c:295
FORCEINLINE BOOLEAN MI_WS_OWNER(IN PEPROCESS Process)
Definition: miarm.h:1077
FORCEINLINE BOOLEAN MiIsUserPde(PVOID Address)
Definition: miarm.h:717
PVOID MmNonPagedPoolStart
Definition: init.c:24
PVOID MiSessionImageEnd
Definition: init.c:28
FORCEINLINE VOID MI_UPDATE_VALID_PTE(IN PMMPTE PointerPte, IN MMPTE TempPte)
Definition: miarm.h:977
VOID NTAPI MiInitializeLargePageSupport(VOID)
Definition: largepag.c:34
SIZE_T MmSystemLockPagesCount
Definition: mdlsup.c:22
NTSTATUS FASTCALL MiCheckPdeForPagedPool(IN PVOID Address)
Definition: pagfault.c:479
VOID NTAPI MiDecrementReferenceCount(IN PMMPFN Pfn1, IN PFN_NUMBER PageFrameIndex)
Definition: pfnlist.c:1236
WCHAR MmLargePageDriverBuffer[512]
Definition: largepag.c:24
MM_AVL_TABLE MmSectionBasedRoot
Definition: section.c:109
FORCEINLINE BOOLEAN MiConvertSharedWorkingSetLockToExclusive(_In_ PETHREAD Thread, _In_ PMMSUPPORT Vm)
Definition: miarm.h:1428
enum _MMSYSTEM_PTE_POOL_TYPE MMSYSTEM_PTE_POOL_TYPE
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:584
FORCEINLINE VOID MI_MAKE_TRANSITION_PTE(_Out_ PMMPTE NewPte, _In_ PFN_NUMBER Page, _In_ ULONG Protection)
Definition: miarm.h:929
FORCEINLINE VOID MI_WRITE_VALID_PTE(IN PMMPTE PointerPte, IN MMPTE TempPte)
Definition: miarm.h:959
FORCEINLINE VOID MiDropLockCount(IN PMMPFN Pfn1)
Definition: miarm.h:1585
PMMPTE MmFirstReservedMappingPte
Definition: hypermap.c:20
FORCEINLINE ULONG_PTR MiDetermineUserGlobalPteMask(IN PVOID PointerPte)
Definition: miarm.h:736
KEVENT MmZeroingPageEvent
Definition: zeropage.c:20
SIZE_T MmDefaultMaximumNonPagedPool
Definition: mminit.c:41
NTSTATUS NTAPI MiInitializeSessionPool(VOID)
Definition: pool.c:1276
VOID NTAPI MiInitializePfn(IN PFN_NUMBER PageFrameIndex, IN PMMPTE PointerPte, IN BOOLEAN Modified)
Definition: pfnlist.c:970
SIZE_T MmAllocationFragment
Definition: mminit.c:352
struct _POOL_TRACKER_BIG_PAGES POOL_TRACKER_BIG_PAGES
PFN_COUNT NTAPI MiDeleteSystemPageableVm(IN PMMPTE PointerPte, IN PFN_NUMBER PageCount, IN ULONG Flags, OUT PPFN_NUMBER ValidPages)
Definition: virtual.c:275
PKEVENT MiLowPagedPoolEvent
Definition: mminit.c:294
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:150
PFN_NUMBER MmSizeOfPagedPoolInPages
Definition: mminit.c:111
ULONG NTAPI MiMakeProtectionMask(IN ULONG Protect)
Definition: section.c:140
FORCEINLINE USHORT MiIncrementPageTableReferences(IN PVOID Address)
Definition: miarm.h:2466
LIST_ENTRY MmWorkingSetExpansionHead
Definition: session.c:30
LARGE_INTEGER MmCriticalSectionTimeout
Definition: mminit.c:388
#define MM_PROTECT_ACCESS
Definition: miarm.h:51
PVOID MiSessionSpaceWs
Definition: mminit.c:130
struct _MMSESSION * PMMSESSION
PMMADDRESS_NODE NTAPI MiGetNextNode(IN PMMADDRESS_NODE Node)
Definition: vadnode.c:549
VOID NTAPI MiInsertVad(_Inout_ PMMVAD Vad, _Inout_ PMM_AVL_TABLE VadRoot)
PPHYSICAL_MEMORY_DESCRIPTOR MmPhysicalMemoryBlock
Definition: init.c:45
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
NTSTATUS NTAPI MiInitMachineDependent(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: init.c:697
ULONG MmConsumedPoolPercentage
Definition: pool.c:30
BOOLEAN MmTrackPtes
Definition: mdlsup.c:20
FORCEINLINE PMMPFN MI_PFN_ELEMENT(IN PFN_NUMBER Pfn)
Definition: miarm.h:1574
SIZE_T MmSystemViewSize
Definition: init.c:39
PVOID MiSessionSpaceEnd
Definition: init.c:27
VOID NTAPI MiSyncCachedRanges(VOID)
Definition: largepag.c:54
const ULONG_PTR MmProtectToPteMask[32]
Definition: page.c:22
SIZE_T MmSizeOfPagedPoolInBytes
Definition: miarm.h:585
MMPDE ValidKernelPde
Definition: init.c:28
FORCEINLINE VOID MiLockProcessWorkingSet(IN PEPROCESS Process, IN PETHREAD Thread)
Definition: miarm.h:1124
PMMCOLOR_TABLES MmFreePagesByColor[FreePageList+1]
Definition: mminit.c:286
struct _MM_SESSION_SPACE MM_SESSION_SPACE
PVOID MmSystemCacheStart
Definition: init.c:53
ULONG MmSystemPageColor
Definition: pfnlist.c:36
FORCEINLINE PFN_NUMBER MiRemoveZeroPageSafe(IN ULONG Color)
Definition: miarm.h:2400
PFN_NUMBER MmHighMemoryThreshold
Definition: mminit.c:301
PVOID MiSessionPoolEnd
Definition: init.c:31
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:2158
struct _POOL_HEADER * PPOOL_HEADER
ULONG MmMaximumDeadKernelStacks
Definition: procsup.c:21
VOID NTAPI MiInitializeSessionWsSupport(VOID)
Definition: session.c:40
PVOID MmSystemCacheEnd
Definition: init.c:54
PLDR_DATA_TABLE_ENTRY NTAPI MiLookupDataTableEntry(IN PVOID Address)
Definition: sysldr.c:3517
PKEVENT MiHighNonPagedPoolEvent
Definition: mminit.c:297
PFN_NUMBER MmSystemPageDirectory[PPE_PER_PAGE]
Definition: init.c:40
FORCEINLINE VOID MiLockProcessWorkingSetUnsafe(IN PEPROCESS Process, IN PETHREAD Thread)
Definition: miarm.h:1169
PVOID MmPagedPoolEnd
Definition: miarm.h:575
FORCEINLINE VOID MiUnlockWorkingSetShared(_In_ PETHREAD Thread, _In_ PMMSUPPORT WorkingSet)
Definition: miarm.h:1389
ULONG MmCritsectTimeoutSeconds
Definition: mminit.c:387
#define PTE_BASE
Definition: mmx86.c:14
#define MiAddressToPde(x)
Definition: mmx86.c:20
#define ASSERT(a)
Definition: mode.c:44
#define _Inout_
Definition: ms_sal.h:378
#define _Out_
Definition: ms_sal.h:345
#define _In_
Definition: ms_sal.h:308
#define KF_GLOBAL_PAGE
Definition: ketypes.h:35
_In_ HANDLE ProcessHandle
Definition: mmfuncs.h:403
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
_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:410
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T ViewSize
Definition: mmfuncs.h:408
@ ZeroedPageList
Definition: mmtypes.h:153
@ FreePageList
Definition: mmtypes.h:154
@ ActiveAndValid
Definition: mmtypes.h:159
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2451
#define FASTCALL
Definition: nt_native.h:50
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
FORCEINLINE PMMPXE MiPdeToPxe(PMMPDE PointerPde)
Definition: mm.h:300
#define MI_MAKE_OWNER_PAGE(x)
Definition: mm.h:113
FORCEINLINE PMMPDE MiPdeToPpe(PMMPDE PointerPde)
Definition: mm.h:292
#define MiGetPdeOffset(x)
Definition: mm.h:195
#define MI_MAKE_ACCESSED_PAGE(x)
Definition: mm.h:100
#define _MI_PAGING_LEVELS
Definition: mm.h:6
#define SESSION_POOL_LOOKASIDES
Definition: mm.h:84
#define PFN_FROM_PDE(v)
Definition: mm.h:93
#define PTE_PER_PAGE
Definition: mm.h:20
#define PPE_PER_PAGE
Definition: mm.h:22
#define MiPteToAddress(_Pte)
Definition: mm.h:116
#define MiPdeToPte(_Pde)
Definition: mm.h:120
#define PDE_TOP
Definition: mm.h:168
ULONG KeFeatureBits
Definition: krnlinit.c:22
FORCEINLINE PMMPFN MiGetPfnEntry(IN PFN_NUMBER Pfn)
Definition: mm.h:1047
FORCEINLINE PFN_NUMBER MiGetPfnEntryIndex(IN PMMPFN Pfn1)
Definition: mm.h:1067
PMMPFN MmPfnDatabase
Definition: freelist.c:24
_In_ PVOID _Out_opt_ BOOLEAN _Out_opt_ PPFN_NUMBER Page
Definition: mm.h:1306
_Out_ PKAPC_STATE ApcState
Definition: mm.h:1765
BOOLEAN NTAPI KeAreAllApcsDisabled(VOID)
Definition: apc.c:985
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
static WCHAR Address[46]
Definition: ping.c:68
DWORD LCID
Definition: nls.h:13
@ LoaderFree
Definition: arc.h:176
@ LoaderFirmwareTemporary
Definition: arc.h:179
@ LoaderLoadedProgram
Definition: arc.h:178
@ LoaderHALCachedMemory
Definition: arc.h:200
@ LoaderFirmwarePermanent
Definition: arc.h:180
@ LoaderOsloaderStack
Definition: arc.h:182
@ LoaderSpecialMemory
Definition: arc.h:196
@ LoaderBBTMemory
Definition: arc.h:197
enum _TYPE_OF_MEMORY TYPE_OF_MEMORY
#define KeMemoryBarrierWithoutFence()
Definition: ke.h:66
#define PXE_SELFMAP
ULONG * PPFN_NUMBER
Definition: ke.h:9
ULONG PFN_NUMBER
Definition: ke.h:9
#define DPRINT
Definition: sndvol32.h:73
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
base of all file and directory entries
Definition: entries.h:83
ULONG OwnsSessionWorkingSetExclusive
Definition: pstypes.h:1226
ULONG OwnsSessionWorkingSetShared
Definition: pstypes.h:1227
ULONG OwnsSystemWorkingSetShared
Definition: pstypes.h:1225
ULONG OwnsProcessWorkingSetShared
Definition: pstypes.h:1223
ULONG OwnsProcessWorkingSetExclusive
Definition: pstypes.h:1222
ULONG OwnsSystemWorkingSetExclusive
Definition: pstypes.h:1224
ULONG PageFrameNumber
Definition: mmtypes.h:109
Definition: btrfs_drv.h:1876
Definition: typedefs.h:120
Definition: miarm.h:396
LIST_ENTRY Links
Definition: miarm.h:397
UNICODE_STRING BaseName
Definition: miarm.h:398
PFN_NUMBER LastFrame
Definition: miarm.h:439
PFN_NUMBER StartFrame
Definition: miarm.h:438
PFN_NUMBER Count
Definition: miarm.h:433
PVOID Blink
Definition: miarm.h:432
PFN_NUMBER Flink
Definition: miarm.h:431
Definition: mm.h:442
Definition: mm.h:374
MMPTE OriginalPte
Definition: mm.h:407
ULONG64 LargePage
Definition: mmtypes.h:165
ULONG64 Valid
Definition: mmtypes.h:150
ULONG64 UsedPageTableEntries
Definition: mmtypes.h:91
union _MMPTE::@2334 u
MMPTE_SOFTWARE Soft
Definition: mmtypes.h:219
MMPTE_HARDWARE Hard
Definition: mmtypes.h:217
ULONG_PTR Long
Definition: mmtypes.h:215
ULONG SystemSpaceHashKey
Definition: miarm.h:456
ULONG SystemSpaceHashEntries
Definition: miarm.h:455
ULONG BitmapFailures
Definition: miarm.h:457
PKGUARDED_MUTEX SystemSpaceViewLockPointer
Definition: miarm.h:451
PRTL_BITMAP SystemSpaceBitMap
Definition: miarm.h:458
PCHAR SystemSpaceViewStart
Definition: miarm.h:452
ULONG SystemSpaceHashSize
Definition: miarm.h:454
PMMVIEW SystemSpaceViewTable
Definition: miarm.h:453
KGUARDED_MUTEX SystemSpaceViewLock
Definition: miarm.h:450
ULONG SessionSpace
Definition: mmtypes.h:905
EX_PUSH_LOCK WorkingSetMutex
Definition: mmtypes.h:961
MMSUPPORT_FLAGS Flags
Definition: mmtypes.h:933
Definition: miarm.h:443
PCONTROL_AREA ControlArea
Definition: miarm.h:445
ULONG_PTR Entry
Definition: miarm.h:444
USHORT UsedPageTableEntries[768]
Definition: mmtypes.h:886
ULONG SessionId
Definition: miarm.h:477
ULONG LongFlags
Definition: miarm.h:474
PFN_NUMBER SessionPageDirectoryIndex
Definition: miarm.h:480
PMMPDE PageTables
Definition: miarm.h:507
LONG ResidentProcessCount
Definition: miarm.h:487
KGUARDED_MUTEX PagedPoolMutex
Definition: miarm.h:498
LARGE_INTEGER LastProcessSwappedOutTime
Definition: miarm.h:479
PVOID PagedPoolStart
Definition: miarm.h:483
MM_PAGED_POOL_INFO PagedPoolInfo
Definition: miarm.h:499
struct _MM_SESSION_SPACE * GlobalVirtualAddress
Definition: miarm.h:470
MM_SESSION_SPACE_FLAGS Flags
Definition: miarm.h:475
ULONG SessionPoolAllocationFailures[4]
Definition: miarm.h:488
union _MM_SESSION_SPACE::@1836 u
PVOID PagedPoolEnd
Definition: miarm.h:484
MMSESSION Session
Definition: miarm.h:497
LONG ImageLoadingCount
Definition: miarm.h:516
LONG ProcessReferenceToSession
Definition: miarm.h:494
ULONG AttachCount
Definition: miarm.h:491
KEVENT AttachEvent
Definition: miarm.h:492
MMSUPPORT Vm
Definition: miarm.h:500
SIZE_T CommittedPages
Definition: miarm.h:482
LIST_ENTRY WsListEntry
Definition: miarm.h:495
LIST_ENTRY ProcessList
Definition: miarm.h:478
SIZE_T NonPageablePages
Definition: miarm.h:481
POOL_DESCRIPTOR PagedPool
Definition: miarm.h:503
LONG ReferenceCount
Definition: miarm.h:471
PEPROCESS LastProcess
Definition: miarm.h:493
PMMWSLE Wsle
Definition: miarm.h:501
PDRIVER_UNLOAD Win32KDriverUnload
Definition: miarm.h:502
LIST_ENTRY ImageList
Definition: miarm.h:489
PMMPDE PagedPoolBasePde
Definition: miarm.h:485
PFN_NUMBER NumberOfPages
Definition: miarm.h:425
PFN_NUMBER PageCount
Definition: miarm.h:419
PFN_NUMBER BasePage
Definition: miarm.h:418
LIST_ENTRY ListHeads[POOL_LISTS_PER_PAGE]
Definition: miarm.h:323
POOL_TYPE PoolType
Definition: miarm.h:311
ULONG Threshold
Definition: miarm.h:317
ULONG RunningAllocs
Definition: miarm.h:313
ULONG TotalPages
Definition: miarm.h:315
SIZE_T TotalBytes
Definition: miarm.h:321
LONG PendingFreeDepth
Definition: miarm.h:320
ULONG PoolIndex
Definition: miarm.h:312
PVOID PendingFrees
Definition: miarm.h:319
ULONG RunningDeAllocs
Definition: miarm.h:314
SIZE_T Spare0
Definition: miarm.h:322
ULONG TotalBigPages
Definition: miarm.h:316
PVOID LockAddress
Definition: miarm.h:318
USHORT PoolTagHash
USHORT AllocatorBackTraceIndex
USHORT PreviousSize
LONG NonPagedAllocs
Definition: miarm.h:370
SIZE_T NonPagedBytes
Definition: miarm.h:372
LONG NonPagedFrees
Definition: miarm.h:371
SIZE_T PagedBytes
Definition: miarm.h:375
Definition: bidi.c:434
#define LIST_HEAD(name, type)
Definition: queue.h:167
ULONG_PTR * PSIZE_T
Definition: typedefs.h:80
uint32_t * PULONG_PTR
Definition: typedefs.h:65
uint32_t * PULONG
Definition: typedefs.h:59
unsigned char * PBOOLEAN
Definition: typedefs.h:53
INT POOL_TYPE
Definition: typedefs.h:78
int16_t * PSHORT
Definition: typedefs.h:55
#define NTAPI
Definition: typedefs.h:36
void * PVOID
Definition: typedefs.h:50
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint16_t * PUSHORT
Definition: typedefs.h:56
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
char * PCHAR
Definition: typedefs.h:51
Definition: dlist.c:348
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3815
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_Must_inspect_result_ _In_ WDFDMATRANSACTION _In_ PFN_WDF_PROGRAM_DMA _In_ WDF_DMA_DIRECTION _In_ PMDL _In_ PVOID VirtualAddress
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _In_ _Strict_type_match_ POOL_TYPE _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_opt_ ULONG _Out_ WDFLOOKASIDE * Lookaside
Definition: wdfmemory.h:414
#define FORCEINLINE
Definition: wdftypes.h:67
_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:409
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
_Inout_ PVOID Segment
Definition: exfuncs.h:1101
struct LOOKASIDE_ALIGN _GENERAL_LOOKASIDE GENERAL_LOOKASIDE
DRIVER_UNLOAD * PDRIVER_UNLOAD
Definition: iotypes.h:2253
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
_Must_inspect_result_ _Outptr_result_bytebuffer_ ViewSize PVOID * MappedBase
Definition: mmfuncs.h:492
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS HighAddress
Definition: mmfuncs.h:226
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS SkipBytes
Definition: mmfuncs.h:227
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS _In_opt_ PHYSICAL_ADDRESS _In_ MEMORY_CACHING_TYPE CacheType
Definition: mmfuncs.h:217
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS _In_ SIZE_T TotalBytes
Definition: mmfuncs.h:228
enum _MM_SYSTEM_SIZE MM_SYSTEMSIZE
enum _MEMORY_CACHING_TYPE MEMORY_CACHING_TYPE
@ MmMaximumCacheType
Definition: mmtypes.h:135
ULONG PFN_COUNT
Definition: mmtypes.h:102
#define NT_ASSERT
Definition: rtlfuncs.h:3324
TABLE_SEARCH_RESULT
Definition: rtltypes.h:386
__wchar_t WCHAR
Definition: xmlstorage.h:180
_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:221