ReactOS  0.4.15-dev-5142-g967f5b9
mm.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <internal/arch/mm.h>
4 
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8 
9 /* TYPES *********************************************************************/
10 
11 struct _EPROCESS;
12 
22 extern ULONG MmThrottleTop;
23 extern ULONG MmThrottleBottom;
24 
26 
28 
30 
33 
37 extern PVOID KernelVerifier;
39 
42 extern SIZE_T MmSharedCommit;
43 extern SIZE_T MmDriverCommit;
44 extern SIZE_T MmProcessCommit;
48 
49 extern PVOID MiDebugMapping; // internal
50 extern PMMPTE MmDebugPte; // internal
51 
52 extern KSPIN_LOCK MmPfnLock;
53 
54 struct _KTRAP_FRAME;
55 struct _EPROCESS;
57 typedef ULONG_PTR SWAPENTRY;
58 
59 //
60 // Pool Quota values
61 //
62 #define MI_QUOTA_NON_PAGED_NEEDED_PAGES 64
63 #define MI_NON_PAGED_QUOTA_MIN_RESIDENT_PAGES 200
64 #define MI_CHARGE_PAGED_POOL_QUOTA 0x80000
65 #define MI_CHARGE_NON_PAGED_POOL_QUOTA 0x10000
66 
67 //
68 // Special IRQL value (found in assertions)
69 //
70 #define MM_NOIRQL ((KIRQL)0xFFFFFFFF)
71 
72 //
73 // MmDbgCopyMemory Flags
74 //
75 #define MMDBG_COPY_WRITE 0x00000001
76 #define MMDBG_COPY_PHYSICAL 0x00000002
77 #define MMDBG_COPY_UNSAFE 0x00000004
78 #define MMDBG_COPY_CACHED 0x00000008
79 #define MMDBG_COPY_UNCACHED 0x00000010
80 #define MMDBG_COPY_WRITE_COMBINED 0x00000020
81 
82 //
83 // Maximum chunk size per copy
84 //
85 #define MMDBG_COPY_MAX_SIZE 0x8
86 
87 #if defined(_X86_) // intenal for marea.c
88 #define MI_STATIC_MEMORY_AREAS (14)
89 #else
90 #define MI_STATIC_MEMORY_AREAS (13)
91 #endif
92 
93 #define MEMORY_AREA_SECTION_VIEW (1)
94 #ifdef NEWCC
95 #define MEMORY_AREA_CACHE (2)
96 #endif
97 #define MEMORY_AREA_OWNED_BY_ARM3 (15)
98 #define MEMORY_AREA_STATIC (0x80000000)
99 
100 /* Although Microsoft says this isn't hardcoded anymore,
101  they won't be able to change it. Stuff depends on it */
102 #define MM_VIRTMEM_GRANULARITY (64 * 1024)
103 
104 #define STATUS_MM_RESTART_OPERATION ((NTSTATUS)0xD0000001)
105 
106 /*
107  * Additional flags for protection attributes
108  */
109 #define PAGE_WRITETHROUGH (1024)
110 #define PAGE_SYSTEM (2048)
111 
112 #define SEC_PHYSICALMEMORY (0x80000000)
113 
114 #define MC_USER (0)
115 #define MC_SYSTEM (1)
116 #define MC_MAXIMUM (2)
117 
118 #define PAGED_POOL_MASK 1
119 #define MUST_SUCCEED_POOL_MASK 2
120 #define CACHE_ALIGNED_POOL_MASK 4
121 #define QUOTA_POOL_MASK 8
122 #define SESSION_POOL_MASK 32
123 #define VERIFIER_POOL_MASK 64
124 
125 #define MAX_PAGING_FILES (16)
126 
127 // FIXME: use ALIGN_UP_BY
128 #define MM_ROUND_UP(x,s) \
129  ((PVOID)(((ULONG_PTR)(x)+(s)-1) & ~((ULONG_PTR)(s)-1)))
130 
131 #define MM_ROUND_DOWN(x,s) \
132  ((PVOID)(((ULONG_PTR)(x)) & ~((ULONG_PTR)(s)-1)))
133 
134 #define PAGE_FLAGS_VALID_FOR_SECTION \
135  (PAGE_READONLY | \
136  PAGE_READWRITE | \
137  PAGE_WRITECOPY | \
138  PAGE_EXECUTE | \
139  PAGE_EXECUTE_READ | \
140  PAGE_EXECUTE_READWRITE | \
141  PAGE_EXECUTE_WRITECOPY | \
142  PAGE_NOACCESS | \
143  PAGE_NOCACHE)
144 
145 #define PAGE_IS_READABLE \
146  (PAGE_READONLY | \
147  PAGE_READWRITE | \
148  PAGE_WRITECOPY | \
149  PAGE_EXECUTE_READ | \
150  PAGE_EXECUTE_READWRITE | \
151  PAGE_EXECUTE_WRITECOPY)
152 
153 #define PAGE_IS_WRITABLE \
154  (PAGE_READWRITE | \
155  PAGE_WRITECOPY | \
156  PAGE_EXECUTE_READWRITE | \
157  PAGE_EXECUTE_WRITECOPY)
158 
159 #define PAGE_IS_EXECUTABLE \
160  (PAGE_EXECUTE | \
161  PAGE_EXECUTE_READ | \
162  PAGE_EXECUTE_READWRITE | \
163  PAGE_EXECUTE_WRITECOPY)
164 
165 #define PAGE_IS_WRITECOPY \
166  (PAGE_WRITECOPY | \
167  PAGE_EXECUTE_WRITECOPY)
168 
169 //
170 // Wait entry for marking pages that are being serviced
171 //
172 #ifdef _M_IX86
173 #define MM_WAIT_ENTRY 0x7ffffc00
174 #elif defined(_M_AMD64)
175 #define MM_WAIT_ENTRY 0x7FFFFFFFFFFFFC00ULL
176 #else
177 #error Unsupported architecture!
178 #endif
179 
180 #ifdef _M_AMD64
181 #define InterlockedCompareExchangePte(PointerPte, Exchange, Comperand) \
182  InterlockedCompareExchange64((PLONG64)(PointerPte), Exchange, Comperand)
183 
184 #define InterlockedExchangePte(PointerPte, Value) \
185  InterlockedExchange64((PLONG64)(PointerPte), Value)
186 #else
187 #define InterlockedCompareExchangePte(PointerPte, Exchange, Comperand) \
188  InterlockedCompareExchange((PLONG)(PointerPte), Exchange, Comperand)
189 
190 #define InterlockedExchangePte(PointerPte, Value) \
191  InterlockedExchange((PLONG)(PointerPte), Value)
192 #endif
193 
194 typedef struct _MM_SECTION_SEGMENT
195 {
198 
199  FAST_MUTEX Lock; /* lock which protects the page directory */
200  LARGE_INTEGER RawLength; /* length of the segment which is part of the mapped file */
201  LARGE_INTEGER Length; /* absolute length of the segment */
208 
209  struct
210  {
211  ULONGLONG FileOffset; /* start offset into the file for image sections */
212  ULONG_PTR VirtualAddress; /* start offset into the address range for image sections */
214  } Image;
215 
217 
219 
222 
224 {
230 
236 
237 #define MM_PHYSICALMEMORY_SEGMENT (0x1)
238 #define MM_DATAFILE_SEGMENT (0x2)
239 #define MM_SEGMENT_INDELETE (0x4)
240 #define MM_SEGMENT_INCREATE (0x8)
241 #define MM_IMAGE_SECTION_FLUSH_DELETE (0x10)
242 
243 
244 #define MA_GetStartingAddress(_MemoryArea) ((_MemoryArea)->VadNode.StartingVpn << PAGE_SHIFT)
245 #define MA_GetEndingAddress(_MemoryArea) (((_MemoryArea)->VadNode.EndingVpn + 1) << PAGE_SHIFT)
246 
247 typedef struct _MEMORY_AREA
248 {
250 
256 
257  struct
258  {
262  } SectionData;
264 
265 typedef struct _MM_RMAP_ENTRY
266 {
270 #if DBG
271  PVOID Caller;
272 #endif
273 }
275 
276 #if MI_TRACE_PFNS
279 #define MI_SET_USAGE(x) MI_PFN_CURRENT_USAGE = x
280 #define MI_SET_PROCESS2(x) memcpy(MI_PFN_CURRENT_PROCESS_NAME, x, min(sizeof(x), sizeof(MI_PFN_CURRENT_PROCESS_NAME)))
282 void
284 {
285  if (!Process)
286  MI_SET_PROCESS2("Kernel");
287  else if (Process == (PEPROCESS)1)
288  MI_SET_PROCESS2("Hydra");
289  else
290  MI_SET_PROCESS2(Process->ImageFileName);
291 }
292 
294 void
295 MI_SET_PROCESS_USTR(PUNICODE_STRING ustr)
296 {
297  PWSTR pos, strEnd;
298  ULONG i;
299 
300  if (!ustr->Buffer || ustr->Length == 0)
301  {
303  return;
304  }
305 
306  pos = strEnd = &ustr->Buffer[ustr->Length / sizeof(WCHAR)];
307  while ((*pos != L'\\') && (pos > ustr->Buffer))
308  pos--;
309 
310  if (*pos == L'\\')
311  pos++;
312 
313  for (i = 0; i < sizeof(MI_PFN_CURRENT_PROCESS_NAME) && pos <= strEnd; i++, pos++)
315 }
316 #else
317 #define MI_SET_USAGE(x)
318 #define MI_SET_PROCESS(x)
319 #define MI_SET_PROCESS2(x)
320 #endif
321 
322 typedef enum _MI_PFN_USAGES
323 {
350 } MI_PFN_USAGES;
351 
352 //
353 // These two mappings are actually used by Windows itself, based on the ASSERTS
354 //
355 #define StartOfAllocation ReadInProgress
356 #define EndOfAllocation WriteInProgress
357 
358 typedef struct _MMPFNENTRY
359 {
361  USHORT ReadInProgress:1; // StartOfAllocation
362  USHORT WriteInProgress:1; // EndOfAllocation
370 } MMPFNENTRY;
371 
372 // Mm internal
373 typedef struct _MMPFN
374 {
375  union
376  {
382 
383  // HACK for ROSPFN
385  } u1;
387  union
388  {
391  } u2;
392  union
393  {
394  struct
395  {
398  };
399  struct
400  {
403  } e2;
404  } u3;
405  union
406  {
409 
410  // HACK for ROSPFN
412  };
413  union
414  {
416  struct
417  {
424  };
425  } u4;
426 #if MI_TRACE_PFNS
427  MI_PFN_USAGES PfnUsage;
428  CHAR ProcessName[16];
429 #define MI_SET_PFN_PROCESS_NAME(pfn, x) memcpy(pfn->ProcessName, x, min(sizeof(x), sizeof(pfn->ProcessName)))
430  PVOID CallSite;
431 #endif
432 
433  // HACK until WS lists are supported
435  struct _MMPFN* NextLRU;
437 } MMPFN, *PMMPFN;
438 
439 extern PMMPFN MmPfnDatabase;
440 
441 typedef struct _MMPFNLIST
442 {
448 
454 
455 typedef struct _MM_MEMORY_CONSUMER
456 {
461 
462 typedef struct _MM_REGION
463 {
469 
470 // Mm internal
471 /* Entry describing free pool memory */
472 typedef struct _MMFREE_POOL_ENTRY
473 {
479 
480 /* Signature of a freed block */
481 #define MM_FREE_POOL_SIGNATURE 'ARM3'
482 
483 /* Paged pool information */
484 typedef struct _MM_PAGED_POOL_INFO
485 {
495 
497 
498 /* Page file information */
499 typedef struct _MMPAGING_FILE
500 {
510 }
512 
514 
515 typedef VOID
519  SIZE_T Length,
520  ULONG OldType,
521  ULONG OldProtect,
522  ULONG NewType,
524 );
525 
526 typedef VOID
528  PVOID Context,
530  PVOID Address,
532  SWAPENTRY SwapEntry,
533  BOOLEAN Dirty
534 );
535 
536 //
537 // Mm copy support for Kd
538 //
539 NTSTATUS
540 NTAPI
543  IN PVOID Buffer,
544  IN ULONG Size,
545  IN ULONG Flags
546 );
547 
548 //
549 // Determines if a given address is a session address
550 //
551 BOOLEAN
552 NTAPI
555 );
556 
557 ULONG
558 NTAPI
561 );
562 
563 ULONG
564 NTAPI
567 );
568 
569 /* marea.c *******************************************************************/
570 
571 NTSTATUS
572 NTAPI
575  ULONG Type,
577  SIZE_T Length,
578  ULONG Protection,
580  ULONG AllocationFlags,
581  ULONG AllocationGranularity
582 );
583 
585 NTAPI
588  PVOID Address
589 );
590 
591 NTSTATUS
592 NTAPI
597  PVOID FreePageContext
598 );
599 
600 VOID
601 NTAPI
604  PMMVAD Vad);
605 
607 NTAPI
610  PVOID Address,
611  SIZE_T Length
612 );
613 
614 PVOID
615 NTAPI
616 MmFindGap(
618  SIZE_T Length,
619  ULONG_PTR Granularity,
620  BOOLEAN TopDown
621 );
622 
623 VOID
624 NTAPI
627 
628 VOID
629 NTAPI
631 
632 /* npool.c *******************************************************************/
633 
634 CODE_SEG("INIT")
635 VOID
636 NTAPI
638 
639 PVOID
640 NTAPI
643  IN SIZE_T SizeInBytes
644 );
645 
646 POOL_TYPE
647 NTAPI
650 );
651 
652 ULONG
653 NTAPI
655  IN PVOID StartingAddress
656 );
657 
658 /* pool.c *******************************************************************/
659 
661 BOOLEAN
662 NTAPI
663 MmRaisePoolQuota(
667 );
668 
670 VOID
671 NTAPI
672 MmReturnPoolQuota(
675 );
676 
677 /* mdl.c *********************************************************************/
678 
679 VOID
680 NTAPI
682  PMDL Mdl,
683  PPFN_NUMBER Pages
684 );
685 
686 /* mminit.c ******************************************************************/
687 
688 VOID
689 NTAPI
690 MmInit1(
691  VOID
692 );
693 
694 CODE_SEG("INIT")
695 BOOLEAN
696 NTAPI
697 MmInitSystem(IN ULONG Phase,
698  IN PLOADER_PARAMETER_BLOCK LoaderBlock);
699 
700 
701 /* pagefile.c ****************************************************************/
702 
703 SWAPENTRY
704 NTAPI
706 
707 VOID
708 NTAPI
710 
711 CODE_SEG("INIT")
712 VOID
713 NTAPI
715 
716 BOOLEAN
717 NTAPI
719 
720 NTSTATUS
721 NTAPI
723  SWAPENTRY SwapEntry,
725 );
726 
727 NTSTATUS
728 NTAPI
730  SWAPENTRY SwapEntry,
732 );
733 
734 VOID
735 NTAPI
737 
738 NTSTATUS
739 NTAPI
742  _In_ ULONG PageFileIndex,
743  _In_ ULONG_PTR PageFileOffset);
744 
745 /* process.c ****************************************************************/
746 
747 NTSTATUS
748 NTAPI
751  IN PEPROCESS Clone OPTIONAL,
752  IN PVOID Section OPTIONAL,
753  IN OUT PULONG Flags,
755 );
756 
757 NTSTATUS
758 NTAPI
761  IN PINITIAL_PEB InitialPeb,
762  OUT PPEB *BasePeb
763 );
764 
765 NTSTATUS
766 NTAPI
770  IN PINITIAL_TEB InitialTeb,
771  OUT PTEB* BaseTeb
772 );
773 
774 VOID
775 NTAPI
778  PTEB Teb
779 );
780 
781 VOID
782 NTAPI
784 
785 VOID
786 NTAPI
788 
789 ULONG
790 NTAPI
792 
793 NTSTATUS
794 NTAPI
797  IN UCHAR MemoryPriority
798 );
799 
800 /* i386/pfault.c *************************************************************/
801 
802 NTSTATUS
803 NTAPI
805  ULONG Cs,
806  PULONG Eip,
807  PULONG Eax,
808  ULONG Cr2,
810 );
811 
812 /* special.c *****************************************************************/
813 
814 VOID
815 NTAPI
817 
818 BOOLEAN
819 NTAPI
822  IN ULONG Tag);
823 
824 BOOLEAN
825 NTAPI
827  IN PVOID P);
828 
829 BOOLEAN
830 NTAPI
832  IN PVOID P);
833 
834 PVOID
835 NTAPI
838  IN ULONG Tag,
840  IN ULONG SpecialType);
841 
842 VOID
843 NTAPI
845  IN PVOID P);
846 
847 /* mm.c **********************************************************************/
848 
849 NTSTATUS
850 NTAPI
852  IN ULONG FaultCode,
853  IN PVOID Address,
855  IN PVOID TrapInformation
856 );
857 
858 /* process.c *****************************************************************/
859 
860 PVOID
861 NTAPI
863 
864 VOID
865 NTAPI
867  BOOLEAN GuiStack);
868 
869 /* balance.c / pagefile.c******************************************************/
870 
872 {
873  /*
874  * Add up all the used "Committed" memory + pagefile.
875  * Not sure this is right. 8^\
876  * MmTotalCommittedPages should be adjusted consistently with
877  * other counters at different places.
878  *
879  MmTotalCommittedPages = MiMemoryConsumers[MC_SYSTEM].PagesUsed +
880  MiMemoryConsumers[MC_USER].PagesUsed +
881  MiUsedSwapPages;
882  */
883 
884  /* Update Commitment */
886 
887  /* Update Peak = max(Peak, Total) in a lockless way */
888  SIZE_T PeakCommitment = MmPeakCommitment;
889  while (TotalCommittedPages > PeakCommitment &&
890  InterlockedCompareExchangeSizeT(&MmPeakCommitment, TotalCommittedPages, PeakCommitment) != PeakCommitment)
891  {
892  PeakCommitment = MmPeakCommitment;
893  }
894 }
895 
896 /* balance.c *****************************************************************/
897 
898 CODE_SEG("INIT")
899 VOID
900 NTAPI
902  ULONG Consumer,
903  NTSTATUS (*Trim)(ULONG Target, ULONG Priority, PULONG NrFreed)
904 );
905 
906 CODE_SEG("INIT")
907 VOID
908 NTAPI
910  ULONG NrAvailablePages,
911  ULONG NrSystemPages
912 );
913 
914 NTSTATUS
915 NTAPI
917  ULONG Consumer,
919 );
920 
921 NTSTATUS
922 NTAPI
924  ULONG Consumer,
925  BOOLEAN MyWait,
926  PPFN_NUMBER AllocatedPage
927 );
928 
929 CODE_SEG("INIT")
930 VOID
931 NTAPI
933 
934 VOID
935 NTAPI
937 
938 /* rmap.c **************************************************************/
939 #define RMAP_SEGMENT_MASK ~((ULONG_PTR)0xff)
940 #define RMAP_IS_SEGMENT(x) (((ULONG_PTR)(x) & RMAP_SEGMENT_MASK) == RMAP_SEGMENT_MASK)
941 
942 VOID
943 NTAPI
946  struct _MM_RMAP_ENTRY* ListHead
947 );
948 
949 struct _MM_RMAP_ENTRY*
950 NTAPI
952 
953 VOID
954 NTAPI
957  struct _EPROCESS *Process,
958  PVOID Address
959 );
960 
961 VOID
962 NTAPI
965  PVOID Context,
966  VOID (*DeleteMapping)(PVOID Context, struct _EPROCESS *Process, PVOID Address)
967 );
968 
969 VOID
970 NTAPI
973  struct _EPROCESS *Process,
974  PVOID Address
975 );
976 
977 CODE_SEG("INIT")
978 VOID
979 NTAPI
981 
982 NTSTATUS
983 NTAPI
985 
987 NTAPI
990 
991 /* freelist.c **********************************************************/
998 KIRQL
999 MiAcquirePfnLock(VOID)
1000 {
1002 }
1003 
1008 VOID
1009 MiReleasePfnLock(
1011 {
1013 }
1014 
1019 VOID
1020 MiAcquirePfnLockAtDpcLevel(VOID)
1021 {
1022  PKSPIN_LOCK_QUEUE LockQueue;
1023 
1025  LockQueue = &KeGetCurrentPrcb()->LockQueue[LockQueuePfnLock];
1026  KeAcquireQueuedSpinLockAtDpcLevel(LockQueue);
1027 }
1028 
1033 VOID
1034 MiReleasePfnLockFromDpcLevel(VOID)
1035 {
1036  PKSPIN_LOCK_QUEUE LockQueue;
1037 
1038  LockQueue = &KeGetCurrentPrcb()->LockQueue[LockQueuePfnLock];
1039  KeReleaseQueuedSpinLockFromDpcLevel(LockQueue);
1041 }
1042 
1043 #define MI_ASSERT_PFN_LOCK_HELD() NT_ASSERT((KeGetCurrentIrql() >= DISPATCH_LEVEL) && (MmPfnLock != 0))
1044 
1046 PMMPFN
1048 {
1049  PMMPFN Page;
1050  extern RTL_BITMAP MiPfnBitMap;
1051 
1052  /* Make sure the PFN number is valid */
1053  if (Pfn > MmHighestPhysicalPage) return NULL;
1054 
1055  /* Make sure this page actually has a PFN entry */
1056  if ((MiPfnBitMap.Buffer) && !(RtlTestBit(&MiPfnBitMap, (ULONG)Pfn))) return NULL;
1057 
1058  /* Get the entry */
1059  Page = &MmPfnDatabase[Pfn];
1060 
1061  /* Return it */
1062  return Page;
1063 };
1064 
1066 PFN_NUMBER
1068 {
1069  //
1070  // This will return the Page Frame Number (PFN) from the MMPFN
1071  //
1072  return Pfn1 - MmPfnDatabase;
1073 }
1074 
1075 PFN_NUMBER
1076 NTAPI
1077 MmGetLRUNextUserPage(PFN_NUMBER PreviousPage, BOOLEAN MoveToLast);
1078 
1079 PFN_NUMBER
1080 NTAPI
1082 
1083 VOID
1084 NTAPI
1086  IN BOOLEAN StatusOnly
1087 );
1088 
1089 VOID
1090 NTAPI
1092  VOID
1093 );
1094 
1095 /* hypermap.c *****************************************************************/
1096 PVOID
1097 NTAPI
1099  IN PFN_NUMBER Page,
1100  IN PKIRQL OldIrql);
1101 
1102 VOID
1103 NTAPI
1105  IN PVOID Address,
1106  IN KIRQL OldIrql);
1107 
1108 PVOID
1109 NTAPI
1111  IN PFN_NUMBER NumberOfPages);
1112 
1113 VOID
1114 NTAPI
1116  IN PFN_NUMBER NumberOfPages);
1117 
1118 /* i386/page.c *********************************************************/
1119 
1120 NTSTATUS
1121 NTAPI
1123  struct _EPROCESS* Process,
1124  PVOID Address,
1125  ULONG flProtect,
1127 );
1128 
1129 NTSTATUS
1130 NTAPI
1132  struct _EPROCESS* Process,
1133  PVOID Address,
1134  ULONG flProtect,
1136 );
1137 
1138 ULONG
1139 NTAPI
1141  struct _EPROCESS* Process,
1142  PVOID Address);
1143 
1144 VOID
1145 NTAPI
1147  struct _EPROCESS* Process,
1148  PVOID Address,
1149  ULONG flProtect
1150 );
1151 
1152 BOOLEAN
1153 NTAPI
1155  struct _EPROCESS* Process,
1156  PVOID Address
1157 );
1158 
1159 BOOLEAN
1160 NTAPI
1162  struct _EPROCESS* Process,
1163  PVOID Address
1164 );
1165 
1166 CODE_SEG("INIT")
1167 VOID
1168 NTAPI
1170 
1171 VOID
1172 NTAPI
1175  PVOID Address,
1176  SWAPENTRY* SwapEntry
1177 );
1178 
1179 NTSTATUS
1180 NTAPI
1183  PVOID Address,
1184  SWAPENTRY SwapEntry
1185 );
1186 
1187 VOID
1188 NTAPI
1191  PVOID Address,
1192  SWAPENTRY *SwapEntry);
1193 
1194 BOOLEAN
1195 NTAPI
1198  PVOID Address
1199 );
1200 
1201 PFN_NUMBER
1202 NTAPI
1203 MmAllocPage(
1204  ULONG Consumer
1205 );
1206 
1207 VOID
1208 NTAPI
1210 
1211 VOID
1212 NTAPI
1214 
1215 ULONG
1216 NTAPI
1218 
1219 BOOLEAN
1220 NTAPI
1222 
1223 VOID
1224 NTAPI
1226  PFN_NUMBER Page,
1227  SWAPENTRY SavedSwapEntry);
1228 
1229 SWAPENTRY
1230 NTAPI
1232 
1233 VOID
1234 NTAPI
1237  PVOID Address
1238 );
1239 
1240 VOID
1241 NTAPI
1243 #define MmSetCleanPage(__P, __A) MmSetDirtyBit(__P, __A, FALSE)
1244 #define MmSetDirtyPage(__P, __A) MmSetDirtyBit(__P, __A, TRUE)
1245 
1246 VOID
1247 NTAPI
1249  struct _EPROCESS *Process,
1250  PVOID Address
1251 );
1252 
1253 PFN_NUMBER
1254 NTAPI
1256  struct _EPROCESS *Process,
1257  PVOID Address
1258 );
1259 
1260 BOOLEAN
1261 NTAPI
1263  IN ULONG MinWs,
1264  IN PEPROCESS Dest,
1265  IN PULONG_PTR DirectoryTableBase
1266 );
1267 
1268 CODE_SEG("INIT")
1269 NTSTATUS
1270 NTAPI
1273  IN PULONG_PTR DirectoryTableBase
1274 );
1275 
1276 CODE_SEG("INIT")
1277 NTSTATUS
1278 NTAPI
1281 );
1282 
1283 NTSTATUS
1284 NTAPI
1285 MmSetExecuteOptions(IN ULONG ExecuteOptions);
1286 
1287 NTSTATUS
1288 NTAPI
1289 MmGetExecuteOptions(IN PULONG ExecuteOptions);
1290 
1292 BOOLEAN
1298 );
1299 
1300 /* arch/procsup.c ************************************************************/
1301 
1302 BOOLEAN
1305  _In_ PULONG_PTR DirectoryTableBase);
1306 
1307 /* wset.c ********************************************************************/
1308 
1309 NTSTATUS
1311  ULONG Target,
1312  ULONG Priority,
1313  PULONG NrFreedPages
1314 );
1315 
1316 /* region.c ************************************************************/
1317 
1318 NTSTATUS
1319 NTAPI
1323  PLIST_ENTRY RegionListHead,
1324  PVOID StartAddress,
1325  SIZE_T Length,
1326  ULONG NewType,
1327  ULONG NewProtect,
1328  PMM_ALTER_REGION_FUNC AlterFunc
1329 );
1330 
1331 VOID
1332 NTAPI
1334  PLIST_ENTRY RegionListHead,
1335  SIZE_T Length,
1336  ULONG Type,
1337  ULONG Protect
1338 );
1339 
1340 PMM_REGION
1341 NTAPI
1342 MmFindRegion(
1344  PLIST_ENTRY RegionListHead,
1345  PVOID Address,
1346  PVOID* RegionBaseAddress
1347 );
1348 
1349 /* section.c *****************************************************************/
1350 
1351 #define PFN_FROM_SSE(E) ((PFN_NUMBER)((E) >> PAGE_SHIFT))
1352 #define IS_SWAP_FROM_SSE(E) ((E) & 0x00000001)
1353 #define MM_IS_WAIT_PTE(E) \
1354  (IS_SWAP_FROM_SSE(E) && SWAPENTRY_FROM_SSE(E) == MM_WAIT_ENTRY)
1355 #define MAKE_PFN_SSE(P) ((ULONG_PTR)((P) << PAGE_SHIFT))
1356 #define SWAPENTRY_FROM_SSE(E) ((E) >> 1)
1357 #define MAKE_SWAP_SSE(S) (((ULONG_PTR)(S) << 1) | 0x1)
1358 #define DIRTY_SSE(E) ((E) | 2)
1359 #define CLEAN_SSE(E) ((E) & ~2)
1360 #define IS_DIRTY_SSE(E) ((E) & 2)
1361 #define WRITE_SSE(E) ((E) | 4)
1362 #define IS_WRITE_SSE(E) ((E) & 4)
1363 #ifdef _WIN64
1364 #define PAGE_FROM_SSE(E) ((E) & 0xFFFFFFF000ULL)
1365 #else
1366 #define PAGE_FROM_SSE(E) ((E) & 0xFFFFF000)
1367 #endif
1368 #define SHARE_COUNT_FROM_SSE(E) (((E) & 0x00000FFC) >> 3)
1369 #define MAX_SHARE_COUNT 0x1FF
1370 #define MAKE_SSE(P, C) ((ULONG_PTR)((P) | ((C) << 3)))
1371 #define BUMPREF_SSE(E) (PAGE_FROM_SSE(E) | ((SHARE_COUNT_FROM_SSE(E) + 1) << 3) | ((E) & 0x7))
1372 #define DECREF_SSE(E) (PAGE_FROM_SSE(E) | ((SHARE_COUNT_FROM_SSE(E) - 1) << 3) | ((E) & 0x7))
1373 
1374 VOID
1375 NTAPI
1377  const char *file,
1378  int line);
1379 
1380 #define MmLockSectionSegment(x) _MmLockSectionSegment(x,__FILE__,__LINE__)
1381 
1382 VOID
1383 NTAPI
1385  const char *file,
1386  int line);
1387 
1388 #define MmUnlockSectionSegment(x) _MmUnlockSectionSegment(x,__FILE__,__LINE__)
1389 
1390 VOID
1391 NTAPI
1393  OUT PSECTION_IMAGE_INFORMATION ImageInformation
1394 );
1395 
1397 NTAPI
1399  IN PVOID Section
1400 );
1401 NTSTATUS
1402 NTAPI
1404  IN PVOID Address,
1406 );
1407 
1408 NTSTATUS
1409 NTAPI
1411  IN PVOID Section,
1413 );
1414 
1415 NTSTATUS
1416 NTAPI
1419  PVOID Address,
1422 );
1423 
1424 NTSTATUS
1425 NTAPI
1430  SIZE_T Length,
1431  ULONG Protect,
1432  PULONG OldProtect
1433 );
1434 
1435 CODE_SEG("INIT")
1436 NTSTATUS
1437 NTAPI
1439 
1440 NTSTATUS
1441 NTAPI
1445  PVOID Address,
1446  BOOLEAN Locked
1447 );
1448 
1449 NTSTATUS
1450 NTAPI
1454  PVOID Address,
1456 );
1457 
1458 CODE_SEG("INIT")
1459 NTSTATUS
1460 NTAPI
1462 
1463 NTSTATUS
1464 NTAPI
1468  PVOID Address,
1469  BOOLEAN Locked
1470 );
1471 
1472 VOID
1473 NTAPI
1475 
1476 /* Exported from NT 6.2 Onward. We keep it internal. */
1477 NTSTATUS
1478 NTAPI
1480  _In_ PVOID Section,
1485  );
1486 
1487 BOOLEAN
1488 NTAPI
1492  _In_ ULONG Length);
1493 
1494 NTSTATUS
1495 NTAPI
1498  _In_ PVOID Address,
1499  _In_ ULONG Length);
1500 
1501 NTSTATUS
1502 NTAPI
1506  _In_ ULONG Length,
1508 
1509 NTSTATUS
1510 NTAPI
1514  _In_ ULONG Length,
1515  _In_ PLARGE_INTEGER ValidDataLength);
1516 
1517 BOOLEAN
1518 NTAPI
1522  _In_ ULONG Length);
1523 
1524 BOOLEAN
1525 NTAPI
1530  BOOLEAN PageOut);
1531 
1532 BOOLEAN
1533 NTAPI
1537  BOOLEAN Dirty,
1538  BOOLEAN PageOut,
1539  ULONG_PTR *InEntry);
1540 
1546 VOID
1547 NTAPI
1548 MmDereferenceSegmentWithLock(
1551 
1555 VOID
1556 MmDereferenceSegment(PMM_SECTION_SEGMENT Segment)
1557 {
1558  MmDereferenceSegmentWithLock(Segment, MM_NOIRQL);
1559 }
1560 
1561 NTSTATUS
1562 NTAPI
1564  _In_ PVOID Section,
1566 
1567 /* sptab.c *******************************************************************/
1568 
1569 NTSTATUS
1570 NTAPI
1573  ULONG_PTR Entry,
1574  const char *file,
1575  int line);
1576 
1577 ULONG_PTR
1578 NTAPI
1581  const char *file,
1582  int line);
1583 
1584 #define MmSetPageEntrySectionSegment(S,O,E) _MmSetPageEntrySectionSegment(S,O,E,__FILE__,__LINE__)
1585 
1586 #define MmGetPageEntrySectionSegment(S,O) _MmGetPageEntrySectionSegment(S,O,__FILE__,__LINE__)
1587 
1588 /* sysldr.c ******************************************************************/
1589 
1590 CODE_SEG("INIT")
1591 VOID
1592 NTAPI
1594  IN PLOADER_PARAMETER_BLOCK LoaderBlock
1595 );
1596 
1597 CODE_SEG("INIT")
1598 BOOLEAN
1599 NTAPI
1601  IN PLOADER_PARAMETER_BLOCK LoaderBlock
1602 );
1603 
1604 BOOLEAN
1605 NTAPI
1607 
1608 VOID
1609 NTAPI
1611 
1612 NTSTATUS
1613 NTAPI
1616  IN PUNICODE_STRING NamePrefix OPTIONAL,
1617  IN PUNICODE_STRING LoadedName OPTIONAL,
1618  IN ULONG Flags,
1619  OUT PVOID *ModuleObject,
1620  OUT PVOID *ImageBaseAddress
1621 );
1622 
1623 NTSTATUS
1624 NTAPI
1626  IN PVOID ImageHandle
1627 );
1628 
1629 NTSTATUS
1630 NTAPI
1632  IN HANDLE ImageHandle,
1633  IN BOOLEAN PurgeSection
1634 );
1635 
1636 NTSTATUS
1637 NTAPI
1639  IN PLDR_DATA_TABLE_ENTRY LdrEntry,
1640  IN PLIST_ENTRY ListHead
1641 );
1642 
1643 VOID
1644 NTAPI
1646  IN PLDR_DATA_TABLE_ENTRY LdrEntry);
1647 
1648 /* procsup.c *****************************************************************/
1649 
1650 NTSTATUS
1651 NTAPI
1653  IN PVOID StackPointer
1654 );
1655 
1656 
1658 VOID
1660 {
1661  KeAcquireGuardedMutex(&CONTAINING_RECORD(AddressSpace, EPROCESS, Vm)->AddressCreationLock);
1662 }
1663 
1665 VOID
1667 {
1668  KeReleaseGuardedMutex(&CONTAINING_RECORD(AddressSpace, EPROCESS, Vm)->AddressCreationLock);
1669 }
1670 
1672 PEPROCESS
1674 {
1675  if (AddressSpace == MmKernelAddressSpace) return NULL;
1677 }
1678 
1680 PMMSUPPORT
1682 {
1683  return &((PEPROCESS)KeGetCurrentThread()->ApcState.Process)->Vm;
1684 }
1685 
1687 PMMSUPPORT
1689 {
1690  return MmKernelAddressSpace;
1691 }
1692 
1693 
1694 /* expool.c ******************************************************************/
1695 
1696 VOID
1697 NTAPI
1699  PVOID P,
1701  ULONG Tag);
1702 
1703 VOID
1704 NTAPI
1706  IN PVOID P);
1707 
1708 
1709 /* mmsup.c *****************************************************************/
1710 
1711 NTSTATUS
1712 NTAPI
1714  IN SIZE_T WorkingSetMinimumInBytes,
1715  IN SIZE_T WorkingSetMaximumInBytes,
1716  IN ULONG SystemCache,
1717  IN BOOLEAN IncreaseOkay);
1718 
1719 
1720 /* session.c *****************************************************************/
1721 
1723 NTSTATUS
1724 NTAPI
1725 MmAttachSession(
1726  _Inout_ PVOID SessionEntry,
1728 
1730 VOID
1731 NTAPI
1732 MmDetachSession(
1733  _Inout_ PVOID SessionEntry,
1735 
1736 VOID
1737 NTAPI
1739  _Inout_ PVOID SessionEntry);
1740 
1741 PVOID
1742 NTAPI
1744  _In_ ULONG SessionId);
1745 
1747 VOID
1748 NTAPI
1749 MmSetSessionLocaleId(
1750  _In_ LCID LocaleId);
1751 
1752 /* shutdown.c *****************************************************************/
1753 
1754 VOID
1755 MmShutdownSystem(IN ULONG Phase);
1756 
1757 /* virtual.c *****************************************************************/
1758 
1759 NTSTATUS
1760 NTAPI
1761 MmCopyVirtualMemory(IN PEPROCESS SourceProcess,
1763  IN PEPROCESS TargetProcess,
1767  OUT PSIZE_T ReturnSize);
1768 
1769 /* wslist.cpp ****************************************************************/
1770 _Requires_exclusive_lock_held_(WorkingSet->WorkingSetMutex)
1771 VOID
1772 NTAPI
1774 
1775 #ifdef __cplusplus
1776 } // extern "C"
1777 
1778 namespace ntoskrnl
1779 {
1780 using MiPfnLockGuard = const KiQueuedSpinLockGuard<LockQueuePfnLock>;
1781 } // namespace ntoskrnl
1782 
1783 #endif
VOID NTAPI MmDereferencePage(PFN_NUMBER Page)
Definition: freelist.c:565
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
NTSTATUS NTAPI MmExtendSection(_In_ PVOID Section, _Inout_ PLARGE_INTEGER NewSize)
Definition: section.c:5136
PRTL_BITMAP PagedPoolAllocationMap
Definition: mm.h:486
PULONG Buffer
Definition: typedefs.h:91
ULONG_PTR VirtualAddress
Definition: mm.h:212
PMM_REGION NTAPI MmFindRegion(PVOID BaseAddress, PLIST_ENTRY RegionListHead, PVOID Address, PVOID *RegionBaseAddress)
Definition: region.c:257
NTSTATUS NTAPI MmCreateTeb(IN PEPROCESS Process, IN PCLIENT_ID ClientId, IN PINITIAL_TEB InitialTeb, OUT PTEB *BaseTeb)
Definition: procsup.c:757
PFILE_OBJECT NTAPI MmGetFileObjectForSection(IN PVOID Section)
Definition: section.c:1755
BOOLEAN WriteCopy
Definition: mm.h:206
PFN_NUMBER MmResidentAvailablePages
Definition: freelist.c:27
#define IN
Definition: typedefs.h:39
return
Definition: dirsup.c:529
NTSTATUS NTAPI MmCopyVirtualMemory(IN PEPROCESS SourceProcess, IN PVOID SourceAddress, IN PEPROCESS TargetProcess, OUT PVOID TargetAddress, IN SIZE_T BufferSize, IN KPROCESSOR_MODE PreviousMode, OUT PSIZE_T ReturnSize)
Definition: virtual.c:1268
VOID NTAPI MmFreeDriverInitialization(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
Definition: sysldr.c:1635
PEPROCESS Process
Definition: mm.h:268
MM_MEMORY_CONSUMER MiMemoryConsumers[MC_MAXIMUM]
Definition: balance.c:30
VOID NTAPI MmInsertRmap(PFN_NUMBER Page, struct _EPROCESS *Process, PVOID Address)
SIZE_T MmtotalCommitLimitMaximum
Definition: freelist.c:36
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
VOID(* PMM_ALTER_REGION_FUNC)(PMMSUPPORT AddressSpace, PVOID BaseAddress, SIZE_T Length, ULONG OldType, ULONG OldProtect, ULONG NewType, ULONG NewProtect)
Definition: mm.h:516
VOID NTAPI MmFreeSectionSegments(PFILE_OBJECT FileObject)
#define _In_opt_
Definition: ms_sal.h:309
ULONG Type
Definition: mm.h:251
ULONG MI_PFN_CURRENT_USAGE
Definition: pfnlist.c:63
struct _MEMORY_AREA * PMEMORY_AREA
#define _Inout_
Definition: ms_sal.h:378
_In_ ULONG Mode
Definition: hubbusif.h:303
ULONG Characteristics
Definition: mm.h:213
_In_ PVOID Address
Definition: mm.h:1295
union _MMPFN::@1753 u2
Definition: ntbasedef.h:628
NTSTATUS NTAPI MmAccessFault(IN ULONG FaultCode, IN PVOID Address, IN KPROCESSOR_MODE Mode, IN PVOID TrapInformation)
Definition: mmfault.c:205
VOID FASTCALL KeAcquireGuardedMutex(IN PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:42
VOID NTAPI MmInit1(VOID)
#define _Out_
Definition: ms_sal.h:345
_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
_Requires_lock_held_(PspQuotaLock) BOOLEAN NTAPI MmRaisePoolQuota(_In_ POOL_TYPE PoolType
NTSTATUS NTAPI MmGetFileNameForSection(IN PVOID Section, OUT POBJECT_NAME_INFORMATION *ModuleName)
Definition: section.c:1882
ULONG PFN_COUNT
Definition: mmtypes.h:102
ULONG NTAPI MmGetPageProtect(struct _EPROCESS *Process, PVOID Address)
BOOLEAN NTAPI MmIsPageInUse(PFN_NUMBER Page)
Definition: freelist.c:558
USHORT ReadInProgress
Definition: mm.h:361
struct _MM_RMAP_ENTRY *NTAPI MmGetRmapListHeadPage(PFN_NUMBER Page)
Definition: freelist.c:458
NTSTATUS NTAPI MmMakeDataSectionResident(_In_ PSECTION_OBJECT_POINTERS SectionObjectPointer, _In_ LONGLONG Offset, _In_ ULONG Length, _In_ PLARGE_INTEGER ValidDataLength)
Definition: section.c:4822
uint16_t * PWSTR
Definition: typedefs.h:56
VOID NTAPI MmDumpArmPfnDatabase(IN BOOLEAN StatusOnly)
Definition: mminit.c:1474
BOOLEAN NTAPI MiInitializeLoadedModuleList(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: sysldr.c:2204
ULONG_PTR AweAllocation
Definition: mm.h:421
ULONG Signature
Definition: mm.h:476
ULONG PagesTarget
Definition: mm.h:458
VOID NTAPI MmDeleteRmap(PFN_NUMBER Page, struct _EPROCESS *Process, PVOID Address)
BOOLEAN MiArchCreateProcessAddressSpace(_In_ PEPROCESS Process, _In_ PULONG_PTR DirectoryTableBase)
Definition: procsup.c:21
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG AddressSpace
Definition: iofuncs.h:2272
VOID NTAPI MmDeleteKernelStack(PVOID Stack, BOOLEAN GuiStack)
VOID MmShutdownSystem(IN ULONG Phase)
Definition: shutdown.c:77
MMLISTS ListName
Definition: mm.h:444
char CHAR
Definition: xmlstorage.h:175
FORCEINLINE VOID MmUnlockAddressSpace(PMMSUPPORT AddressSpace)
Definition: mm.h:1666
VOID NTAPI MmBuildMdlFromPages(PMDL Mdl, PPFN_NUMBER Pages)
Definition: pagefile.c:94
ULONG SessionId
Definition: dllmain.c:28
BOOLEAN NTAPI MmArePagesResident(_In_ PEPROCESS Process, _In_ PVOID BaseAddress, _In_ ULONG Length)
Definition: section.c:4677
PMEMORY_AREA NTAPI MmLocateMemoryAreaByRegion(PMMSUPPORT AddressSpace, PVOID Address, SIZE_T Length)
Definition: marea.c:106
PMM_RMAP_ENTRY RmapListHead
Definition: mm.h:411
struct _MM_PAGED_POOL_INFO MM_PAGED_POOL_INFO
NTSTATUS NTAPI MmCreatePhysicalMemorySection(VOID)
Definition: section.c:2182
Definition: mm.h:462
ULONG SectionCount
Definition: mm.h:203
struct _MM_RMAP_ENTRY MM_RMAP_ENTRY
LONG NTSTATUS
Definition: precomp.h:26
PFN_NUMBER Size
Definition: mm.h:501
NTSTATUS NTAPI MiReadPageFile(_In_ PFN_NUMBER Page, _In_ ULONG PageFileIndex, _In_ ULONG_PTR PageFileOffset)
Definition: pagefile.c:194
PVOID NTAPI MmGetSessionById(_In_ ULONG SessionId)
Definition: session.c:1050
BOOLEAN NTAPI MmIsSessionAddress(IN PVOID Address)
Definition: session.c:48
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1080
PFN_NUMBER Flink
Definition: mm.h:377
struct _EPROCESS * PEPROCESS
Definition: nt_native.h:30
LIST_ENTRY RegionListHead
Definition: mm.h:261
NTSTATUS NTAPI MmReleasePageMemoryConsumer(ULONG Consumer, PFN_NUMBER Page)
Definition: balance.c:73
_In_ PVOID _Out_opt_ BOOLEAN * WasDirty
Definition: mm.h:1295
SIZE_T MmSharedCommit
Definition: freelist.c:31
NTSTATUS NTAPI MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN MyWait, PPFN_NUMBER AllocatedPage)
Definition: balance.c:281
VOID(* PMM_FREE_PAGE_FUNC)(PVOID Context, PMEMORY_AREA MemoryArea, PVOID Address, PFN_NUMBER Page, SWAPENTRY SwapEntry, BOOLEAN Dirty)
Definition: mm.h:527
NTSTATUS NTAPI MmCreateVirtualMapping(struct _EPROCESS *Process, PVOID Address, ULONG flProtect, PFN_NUMBER Page)
union _MMPFN::@1752 u1
USHORT Modified
Definition: mm.h:360
PMM_SECTION_SEGMENT Segment
Definition: mm.h:260
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
NTSTATUS NTAPI MmCreatePageFileMapping(struct _EPROCESS *Process, PVOID Address, SWAPENTRY SwapEntry)
VOID NTAPI MiCheckAllProcessMemoryAreas(VOID)
NTSTATUS NTAPI _MmSetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment, PLARGE_INTEGER Offset, ULONG_PTR Entry, const char *file, int line)
Definition: sptab.c:178
BOOLEAN NTAPI MmUnsharePageEntrySectionSegment(PMEMORY_AREA MemoryArea, PMM_SECTION_SEGMENT Segment, PLARGE_INTEGER Offset, BOOLEAN Dirty, BOOLEAN PageOut, ULONG_PTR *InEntry)
Definition: section.c:1091
struct _MMPFNENTRY MMPFNENTRY
PVOID MmTriageActionTaken
Definition: drvmgmt.c:27
USHORT RemovalRequested
Definition: mm.h:366
PVOID MmUnloadedDrivers
Definition: sysldr.c:43
_IRQL_requires_(DISPATCH_LEVEL)) VOID NTAPI MmDereferenceSegmentWithLock(_In_ PMM_SECTION_SEGMENT Segment
BOOLEAN NTAPI MmPurgeSegment(_In_ PSECTION_OBJECT_POINTERS SectionObjectPointer, _In_opt_ PLARGE_INTEGER Offset, _In_ ULONG Length)
Definition: section.c:4730
DWORD LCID
Definition: nls.h:13
PFILE_OBJECT FileObject
Definition: mm.h:506
PMM_SECTION_SEGMENT NTAPI MmGetSectionAssociation(PFN_NUMBER Page, PLARGE_INTEGER Offset)
Definition: sptab.c:360
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char * ModuleName
Definition: acpixf.h:1274
NTSTATUS NTAPI MmGetFileNameForAddress(IN PVOID Address, OUT PUNICODE_STRING ModuleName)
Definition: section.c:1903
VOID NTAPI MmDeletePageFileMapping(struct _EPROCESS *Process, PVOID Address, SWAPENTRY *SwapEntry)
NTSTATUS NTAPI MmReadFromSwapPage(SWAPENTRY SwapEntry, PFN_NUMBER Page)
Definition: pagefile.c:187
BOOLEAN NTAPI MmCheckDirtySegment(PMM_SECTION_SEGMENT Segment, PLARGE_INTEGER Offset, BOOLEAN ForceDirty, BOOLEAN PageOut)
NTSTATUS NTAPI MmAdjustWorkingSetSize(IN SIZE_T WorkingSetMinimumInBytes, IN SIZE_T WorkingSetMaximumInBytes, IN ULONG SystemCache, IN BOOLEAN IncreaseOkay)
Definition: mmsup.c:44
PFN_NUMBER MmAvailablePages
Definition: freelist.c:26
SIZE_T MmTotalNonPagedPoolQuota
Definition: pool.c:27
PMEMORY_AREA NTAPI MmLocateMemoryAreaByAddress(PMMSUPPORT AddressSpace, PVOID Address)
Definition: marea.c:60
_Use_decl_annotations_ VOID NTAPI MiInitializeWorkingSetList(_Inout_ PMMSUPPORT WorkingSet)
Definition: wslist.cpp:369
MMPFNLIST MmZeroedPageListHead
Definition: pfnlist.c:41
KMUTANT MmSystemLoadLock
Definition: sysldr.c:39
VOID NTAPI MmDeleteTeb(struct _EPROCESS *Process, PTEB Teb)
VOID NTAPI MiRosCleanupMemoryArea(PEPROCESS Process, PMMVAD Vad)
Definition: marea.c:515
USHORT ReferenceCount
Definition: mm.h:396
PVOID NTAPI MmAllocateSpecialPool(IN SIZE_T NumberOfBytes, IN ULONG Tag, IN POOL_TYPE PoolType, IN ULONG SpecialType)
MMPFNLIST MmStandbyPageListHead
Definition: pfnlist.c:43
USHORT PageLocation
Definition: mm.h:365
PMMPFN MmPfnDatabase
Definition: freelist.c:24
_Must_inspect_result_ _In_ PDEVICE_OBJECT _In_ PSECTION_OBJECT_POINTERS SectionObjectPointer
Definition: fsrtlfuncs.h:1368
struct _MM_IMAGE_SECTION_OBJECT MM_IMAGE_SECTION_OBJECT
PFN_NUMBER Flink
Definition: mm.h:445
enum _MMLISTS MMLISTS
MMPFNLIST MmModifiedNoWritePageListHead
Definition: pfnlist.c:47
PVOID NTAPI MmFindGap(PMMSUPPORT AddressSpace, SIZE_T Length, ULONG_PTR Granularity, BOOLEAN TopDown)
Definition: marea.c:215
uint32_t ULONG_PTR
Definition: typedefs.h:65
VOID NTAPI MmMakeKernelResourceSectionWritable(VOID)
Definition: sysldr.c:2324
MMWSLE Wsle
Definition: mm.h:434
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
_IRQL_raises_(DISPATCH_LEVEL) _IRQL_requires_max_(DISPATCH_LEVEL) _Requires_lock_not_held_(MmPfnLock) _Acquires_lock_(MmPfnLock) _IRQL_saves_ FORCEINLINE KIRQL MiAcquirePfnLock(VOID)
Definition: mm.h:992
USHORT PrototypePte
Definition: mm.h:363
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:636
UCHAR KIRQL
Definition: env_spec_w32.h:591
MMPFNENTRY e1
Definition: mm.h:397
ULONG * PPFN_NUMBER
Definition: ke.h:9
ULONG Magic
Definition: mm.h:254
_Releases_lock_(MmPfnLock)) _When_(OldIrql !
NTSTATUS NTAPI MmQuerySectionView(PMEMORY_AREA MemoryArea, PVOID Address, PMEMORY_BASIC_INFORMATION Info, PSIZE_T ResultLength)
Definition: section.c:2078
BOOLEAN NTAPI MmIsPagePresent(struct _EPROCESS *Process, PVOID Address)
VOID NTAPI MmInitializeMemoryConsumer(ULONG Consumer, NTSTATUS(*Trim)(ULONG Target, ULONG Priority, PULONG NrFreed))
Definition: balance.c:58
VOID NTAPI MmInitPagingFile(VOID)
Definition: pagefile.c:255
USHORT CacheAttribute
Definition: mm.h:367
PLARGE_INTEGER BOOLEAN ForceDirty
Definition: section.c:4930
#define MC_MAXIMUM
Definition: mm.h:116
#define L(x)
Definition: ntvdm.h:50
VOID NTAPI MmZeroPageThread(VOID)
Definition: zeropage.c:36
NTSTATUS NTAPI MmFlushSegment(_In_ PSECTION_OBJECT_POINTERS SectionObjectPointer, _In_opt_ PLARGE_INTEGER Offset, _In_ ULONG Length, _Out_opt_ PIO_STATUS_BLOCK Iosb)
Definition: section.c:4842
#define MM_NOIRQL
Definition: mm.h:70
RTL_BITMAP MiPfnBitMap
Definition: init.c:44
ULONG PFN_NUMBER
Definition: ke.h:9
PFN_NUMBER NTAPI MmGetLRUNextUserPage(PFN_NUMBER PreviousPage, BOOLEAN MoveToLast)
Definition: freelist.c:125
NTSTATUS NTAPI MmAlterRegion(PMMSUPPORT AddressSpace, PVOID BaseAddress, PLIST_ENTRY RegionListHead, PVOID StartAddress, SIZE_T Length, ULONG NewType, ULONG NewProtect, PMM_ALTER_REGION_FUNC AlterFunc)
Definition: region.c:108
VOID NTAPI MmGetImageInformation(OUT PSECTION_IMAGE_INFORMATION ImageInformation)
Definition: section.c:1829
ULONG_PTR MustBeCached
Definition: mm.h:423
ULONG_PTR * PSIZE_T
Definition: typedefs.h:80
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
_In_ PVOID _Out_opt_ BOOLEAN _Out_opt_ PPFN_NUMBER Page
Definition: mm.h:1295
NTSTATUS NTAPI MmInitSectionImplementation(VOID)
Definition: section.c:2273
PMMPTE LastPteForPagedPool
Definition: mm.h:489
ULONG Type
Definition: mm.h:464
struct _MM_MEMORY_CONSUMER * PMM_MEMORY_CONSUMER
#define MI_SET_PROCESS(x)
Definition: mm.h:318
struct _MMPFNLIST * PMMPFNLIST
ULONG_PTR ShareCount
Definition: mm.h:390
SIZE_T MmTotalCommitLimit
Definition: mminit.c:359
NTSTATUS NTAPI MmCallDllInitialize(IN PLDR_DATA_TABLE_ENTRY LdrEntry, IN PLIST_ENTRY ListHead)
Definition: sysldr.c:308
ULONG Protection
Definition: mm.h:204
#define _Outptr_result_bytebuffer_(size)
Definition: ms_sal.h:472
VOID NTAPI MmRebalanceMemoryConsumers(VOID)
Definition: balance.c:271
long LONG
Definition: pedump.c:60
USHORT ParityError
Definition: mm.h:369
ULONG NTAPI MmGetSessionLocaleId(VOID)
Definition: session.c:56
_In_ PMEMORY_AREA _In_ PVOID _In_ BOOLEAN Locked
Definition: newmm.h:207
PFN_NUMBER Blink
Definition: mm.h:446
PKEVENT Event
Definition: mm.h:379
#define MI_SET_PROCESS2(x)
Definition: mm.h:319
BOOLEAN NTAPI MmChangeKernelResourceSectionProtection(IN ULONG_PTR ProtectionMask)
Definition: sysldr.c:2293
PMMSUPPORT MmKernelAddressSpace
Definition: mminit.c:27
struct _MM_RMAP_ENTRY * PMM_RMAP_ENTRY
LIST_ENTRY List
Definition: mm.h:474
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER _Outptr_ PVOID * TargetAddress
Definition: iotypes.h:1035
struct _MMPAGING_FILE * PMMPAGING_FILE
PVOID NTAPI MiMapPageInHyperSpace(IN PEPROCESS Process, IN PFN_NUMBER Page, IN PKIRQL OldIrql)
Definition: hypermap.c:28
_IRQL_requires_max_(DISPATCH_LEVEL) _Requires_lock_not_held_(MmPfnLock) FORCEINLINE VOID MmDereferenceSegment(PMM_SECTION_SEGMENT Segment)
Definition: mm.h:1552
NTSTATUS NTAPI MmAccessFaultSectionView(PMMSUPPORT AddressSpace, MEMORY_AREA *MemoryArea, PVOID Address, BOOLEAN Locked)
Definition: section.c:1892
NTSTATUS NTAPI MmGetExecuteOptions(IN PULONG ExecuteOptions)
Definition: pagfault.c:2579
BOOLEAN Locked
Definition: mm.h:207
unsigned char BOOLEAN
SIZE_T AllocatedPagedPool
Definition: mm.h:493
SIZE_T MmPeakCommitment
Definition: freelist.c:35
NTSTATUS NTAPI MmPageOutSectionView(PMMSUPPORT AddressSpace, PMEMORY_AREA MemoryArea, PVOID Address, ULONG_PTR Entry)
NTSTATUS NTAPI MmCreateVirtualMappingUnsafe(struct _EPROCESS *Process, PVOID Address, ULONG flProtect, PFN_NUMBER Page)
ULONG_PTR VerifierAllocation
Definition: mm.h:420
SIZE_T Length
Definition: mm.h:466
_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 _In_
Definition: ms_sal.h:308
Definition: parser.c:48
NTSTATUS NTAPI MmPageOutPhysicalAddress(PFN_NUMBER Page)
Definition: rmap.c:51
Definition: bufpool.h:45
VOID NTAPI _MmLockSectionSegment(PMM_SECTION_SEGMENT Segment, const char *file, int line)
Definition: data.c:98
_Must_inspect_result_ _In_ WDFDMATRANSACTION _In_ PFN_WDF_PROGRAM_DMA _In_ WDF_DMA_DIRECTION _In_ PMDL _In_ PVOID VirtualAddress
struct _MMPFN * PreviousLRU
Definition: mm.h:436
SIZE_T MmTotalCommittedPages
Definition: freelist.c:30
VOID NTAPI MmQuitNextSession(_Inout_ PVOID SessionEntry)
Definition: session.c:1030
NTSTATUS NTAPI MmGrowKernelStack(IN PVOID StackPointer)
Definition: procsup.c:476
SIZE_T PagedPoolCommit
Definition: mm.h:492
PFN_NUMBER MaximumSize
Definition: mm.h:502
PFN_NUMBER MinimumSize
Definition: mm.h:503
VOID NTAPI MmSetRmapListHeadPage(PFN_NUMBER Page, struct _MM_RMAP_ENTRY *ListHead)
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
PFILE_OBJECT FileObject
Definition: mm.h:197
UNICODE_STRING PageFileName
Definition: mm.h:507
_Inout_ PVOID Segment
Definition: exfuncs.h:1101
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER SectionOffset
Definition: mmfuncs.h:404
struct _MM_IMAGE_SECTION_OBJECT * PMM_IMAGE_SECTION_OBJECT
ULONG Protect
Definition: mm.h:465
USHORT WriteInProgress
Definition: mm.h:362
NTSTATUS NTAPI MmCheckSystemImage(IN HANDLE ImageHandle, IN BOOLEAN PurgeSection)
Definition: sysldr.c:2707
NTSTATUS NTAPI MmUnloadSystemImage(IN PVOID ImageHandle)
Definition: sysldr.c:911
NTSTATUS NTAPI MmPageFault(ULONG Cs, PULONG Eip, PULONG Eax, ULONG Cr2, ULONG ErrorCode)
LARGE_INTEGER Length
Definition: mm.h:201
PMMPTE MmDebugPte
Definition: mmdbg.c:31
ULONGLONG FileOffset
Definition: mm.h:211
FAST_MUTEX
Definition: extypes.h:17
BOOLEAN NTAPI MmIsSpecialPoolAddressFree(IN PVOID P)
PFN_COUNT Size
Definition: mm.h:475
int64_t LONGLONG
Definition: typedefs.h:68
VOID NTAPI MmCleanProcessAddressSpace(IN PEPROCESS Process)
Definition: procsup.c:1267
int64_t LONG64
Definition: typedefs.h:68
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
VOID NTAPI MiInitializeSpecialPool(VOID)
Definition: special.c:123
_MI_PFN_USAGES
Definition: mm.h:322
LONG64 RefCount
Definition: mm.h:196
POOL_TYPE NTAPI MmDeterminePoolType(IN PVOID VirtualAddress)
Definition: pool.c:408
_Success_(return) BOOLEAN MmDeleteVirtualMapping(_In_opt_ PEPROCESS Process
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
_Out_ PCLIENT_ID ClientId
Definition: kefuncs.h:1165
VOID NTAPI MmDeleteVirtualMapping(IN PEPROCESS Process, IN PVOID Address, OUT PBOOLEAN WasDirty, OUT PPFN_NUMBER Page)
Definition: page.c:177
#define ASSERT(a)
Definition: mode.c:44
PFN_NUMBER FreeSpace
Definition: mm.h:504
struct _MMPFNLIST MMPFNLIST
#define MAX_PAGING_FILES
Definition: mm.h:125
__wchar_t WCHAR
Definition: xmlstorage.h:180
NTSTATUS NTAPI MmCreatePeb(IN PEPROCESS Process, IN PINITIAL_PEB InitialPeb, OUT PPEB *BasePeb)
Definition: procsup.c:517
Definition: mm.h:472
INT POOL_TYPE
Definition: typedefs.h:78
SWAPENTRY NTAPI MmAllocSwapPage(VOID)
Definition: pagefile.c:305
uint64_t ULONGLONG
Definition: typedefs.h:67
PVOID MiDebugMapping
Definition: mmdbg.c:30
BOOLEAN NTAPI MmInitSystem(IN ULONG Phase, IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: mminit.c:202
NTSTATUS(* Trim)(ULONG Target, ULONG Priority, PULONG NrFreed)
Definition: mm.h:459
NTSTATUS NTAPI MmInitializeProcessAddressSpace(IN PEPROCESS Process, IN PEPROCESS Clone OPTIONAL, IN PVOID Section OPTIONAL, IN OUT PULONG Flags, IN POBJECT_NAME_INFORMATION *AuditName OPTIONAL)
PMM_SECTION_SEGMENT Segments
Definition: mm.h:234
PLARGE_INTEGER BOOLEAN BOOLEAN PageOut
Definition: section.c:4933
struct _MMPAGING_FILE MMPAGING_FILE
BOOLEAN DeleteInProgress
Definition: mm.h:253
BOOLEAN NTAPI MmIsDisabledPage(struct _EPROCESS *Process, PVOID Address)
LARGE_INTEGER RawLength
Definition: mm.h:200
NTSTATUS NTAPI MmFreeMemoryArea(PMMSUPPORT AddressSpace, PMEMORY_AREA MemoryArea, PMM_FREE_PAGE_FUNC FreePage, PVOID FreePageContext)
Definition: marea.c:283
PVOID KernelVerifier
Definition: drvmgmt.c:28
Type
Definition: Type.h:6
VOID FASTCALL KeReleaseQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber, IN KIRQL OldIrql)
Definition: spinlock.c:154
PFN_NUMBER MmLowestPhysicalPage
Definition: meminit.c:30
VOID NTAPI ExReturnPoolQuota(IN PVOID P)
Definition: expool.c:1849
VOID NTAPI MmSetPageProtect(struct _EPROCESS *Process, PVOID Address, ULONG flProtect)
_When_(OldIrql==MM_NOIRQL, _IRQL_requires_max_(DISPATCH_LEVEL)) _When_(OldIrql
_Must_inspect_result_ NTSYSAPI BOOLEAN NTAPI RtlTestBit(_In_ PRTL_BITMAP BitMapHeader, _In_range_(<, BitMapHeader->SizeOfBitMap) ULONG BitNumber)
Definition: bitmap.c:434
MMPFNLIST MmModifiedPageListHead
Definition: pfnlist.c:45
_IRQL_requires_min_(DISPATCH_LEVEL) _Requires_lock_not_held_(MmPfnLock) _Acquires_lock_(MmPfnLock) FORCEINLINE VOID MiAcquirePfnLockAtDpcLevel(VOID)
Definition: mm.h:1015
PFN_NUMBER NTAPI MmAllocPage(ULONG Consumer)
Definition: freelist.c:601
VOID NTAPI MiRosCheckMemoryAreas(PMMSUPPORT AddressSpace)
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
BOOLEAN NTAPI MmIsPageSwapEntry(struct _EPROCESS *Process, PVOID Address)
* PFILE_OBJECT
Definition: iotypes.h:1998
struct _MEMORY_AREA MEMORY_AREA
_Requires_lock_not_held_(MmPfnLock)) _When_(OldIrql !
NTSTATUS NTAPI MmCreateMemoryArea(PMMSUPPORT AddressSpace, ULONG Type, PVOID *BaseAddress, SIZE_T Length, ULONG Protection, PMEMORY_AREA *Result, ULONG AllocationFlags, ULONG AllocationGranularity)
Definition: marea.c:404
ULONG NTAPI MmGetReferenceCountPage(PFN_NUMBER Page)
Definition: freelist.c:538
struct _MM_SECTION_SEGMENT * PMM_SECTION_SEGMENT
MMVAD VadNode
Definition: mm.h:249
LIST_ENTRY MmLoadedUserImageList
Definition: sysldr.c:35
struct _MMFREE_POOL_ENTRY * Owner
Definition: mm.h:477
ULONG MmThrottleBottom
Definition: mminit.c:397
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING _In_ PCUNICODE_STRING _In_ LCID LocaleId
Definition: wdfpdo.h:430
PVOID NTAPI MiAllocatePoolPages(IN POOL_TYPE PoolType, IN SIZE_T SizeInBytes)
Definition: pool.c:422
unsigned __int64 ULONG64
Definition: imports.h:198
PVOID NTAPI MiMapPagesInZeroSpace(IN PMMPFN Pfn1, IN PFN_NUMBER NumberOfPages)
Definition: hypermap.c:111
VOID NTAPI MiUnmapPageInHyperSpace(IN PEPROCESS Process, IN PVOID Address, IN KIRQL OldIrql)
Definition: hypermap.c:91
_In_ WDFINTERRUPT _In_ WDF_INTERRUPT_POLICY _In_ WDF_INTERRUPT_PRIORITY Priority
Definition: wdfinterrupt.h:651
unsigned char UCHAR
Definition: xmlstorage.h:181
ULONG NTAPI MiFreePoolPages(IN PVOID StartingAddress)
Definition: pool.c:918
struct _MMPFN::@1754::@1760 e2
struct _MM_REGION MM_REGION
#define InterlockedExchangeAddSizeT(a, b)
Definition: interlocked.h:196
NTSTATUS NTAPI MmSetExecuteOptions(IN ULONG ExecuteOptions)
Definition: pagfault.c:2621
_In_ SIZE_T _Out_ PSIZE_T NewMaxQuota
Definition: mm.h:665
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:792
#define NTSTATUS
Definition: precomp.h:20
_In_ SIZE_T CurrentMaxQuota
Definition: mm.h:665
#define VOID
Definition: acefi.h:82
Definition: mm.h:373
Definition: btrfs_drv.h:1876
KIRQL * PKIRQL
Definition: env_spec_w32.h:592
struct _MMFREE_POOL_ENTRY MMFREE_POOL_ENTRY
NTSTATUS NTAPI MmMapViewInSystemSpaceEx(_In_ PVOID Section, _Outptr_result_bytebuffer_(*ViewSize) PVOID *MappedBase, _Inout_ PSIZE_T ViewSize, _Inout_ PLARGE_INTEGER SectionOffset, _In_ ULONG_PTR Flags)
Definition: section.c:4362
NTSTATUS NTAPI MmInitializeHandBuiltProcess2(IN PEPROCESS Process)
Definition: procsup.c:1157
SIZE_T MmTotalPagedPoolQuota
Definition: pool.c:28
VOID NTAPI MiInitBalancerThread(VOID)
Definition: balance.c:363
PMMPAGING_FILE MmPagingFile[MAX_PAGING_FILES]
Definition: pagefile.c:40
_Must_inspect_result_ _In_ USHORT NewSize
Definition: fltkernel.h:975
ULONGLONG LastPage
Definition: mm.h:218
struct _MM_SECTION_SEGMENT::@1750 Image
union _MMPFN::@1754 u3
VOID NTAPI MmGetPageFileMapping(PEPROCESS Process, PVOID Address, SWAPENTRY *SwapEntry)
Definition: page.c:299
SIZE_T MmProcessCommit
Definition: freelist.c:33
Definition: typedefs.h:119
VOID UpdateTotalCommittedPages(LONG Delta)
Definition: mm.h:871
PFN_NUMBER NTAPI MmGetLRUFirstUserPage(VOID)
Definition: freelist.c:45
KIRQL FASTCALL KeAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber)
Definition: spinlock.c:108
struct _MMPFN MMPFN
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4061
ULONG_PTR Priority
Definition: mm.h:422
FORCEINLINE PMMPFN MiGetPfnEntry(IN PFN_NUMBER Pfn)
Definition: mm.h:1047
#define P(row, col)
NTSTATUS ReadStatus
Definition: mm.h:380
BOOLEAN NTAPI MmCreateProcessAddressSpace(IN ULONG MinWs, IN PEPROCESS Dest, IN PULONG_PTR DirectoryTableBase)
ULONG MmThrottleTop
Definition: mminit.c:396
VOID NTAPI MmShowOutOfSpaceMessagePagingFile(VOID)
Definition: pagefile.c:119
HANDLE FileHandle
Definition: mm.h:509
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
SIZE_T MmPagedPoolCommit
Definition: freelist.c:34
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
LONGLONG ViewOffset
Definition: mm.h:259
PFILE_OBJECT FileObject
Definition: mm.h:226
ULONG_PTR SIZE_T
Definition: typedefs.h:80
Definition: compat.h:694
PULONG Flags
Definition: mm.h:205
PFN_NUMBER CurrentUsage
Definition: mm.h:505
union _MMPFN::@1757 u4
USHORT PageColor
Definition: mm.h:364
FORCEINLINE PMMSUPPORT MmGetKernelAddressSpace(VOID)
Definition: mm.h:1688
PFN_COUNT MmNumberOfPhysicalPages
Definition: init.c:48
PRTL_BITMAP Bitmap
Definition: mm.h:508
NTSTATUS NTAPI MmDbgCopyMemory(IN ULONG64 Address, IN PVOID Buffer, IN ULONG Size, IN ULONG Flags)
Definition: mmdbg.c:124
NTSTATUS NTAPI MmMakePagesDirty(_In_ PEPROCESS Process, _In_ PVOID Address, _In_ ULONG Length)
Definition: section.c:5065
struct _MM_REGION * PMM_REGION
NTSTATUS MmTrimUserMemory(ULONG Target, ULONG Priority, PULONG NrFreedPages)
Definition: balance.c:139
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 const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
VOID NTAPI MiUnmapPagesInZeroSpace(IN PVOID VirtualAddress, IN PFN_NUMBER NumberOfPages)
Definition: hypermap.c:187
KSPIN_LOCK MmPfnLock
Definition: krnlinit.c:49
PFN_NUMBER NTAPI MmGetPfnForProcess(struct _EPROCESS *Process, PVOID Address)
unsigned short USHORT
Definition: pedump.c:61
VOID NTAPI MmInitializeBalancer(ULONG NrAvailablePages, ULONG NrSystemPages)
Definition: balance.c:45
ULONG_PTR PteFrame
Definition: mm.h:418
struct _MEMORY_AREA::@1751 SectionData
struct _MMFREE_POOL_ENTRY * PMMFREE_POOL_ENTRY
PFN_COUNT MiUsedSwapPages
Definition: pagefile.c:52
PRTL_BITMAP EndOfPagedPoolBitmap
Definition: mm.h:487
PFN_NUMBER Total
Definition: mm.h:443
USHORT ShortFlags
Definition: mm.h:402
struct _MMPFN * PMMPFN
ULONG_PTR SWAPENTRY
Definition: mm.h:56
static ULONG Delta
Definition: xboxvideo.c:33
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
NTSTATUS NTAPI MmSetMemoryPriorityProcess(IN PEPROCESS Process, IN UCHAR MemoryPriority)
Definition: procsup.c:486
#define FORCEINLINE
Definition: wdftypes.h:67
_Out_ PKAPC_STATE ApcState
Definition: mm.h:1727
FORCEINLINE PEPROCESS MmGetAddressSpaceOwner(IN PMMSUPPORT AddressSpace)
Definition: mm.h:1673
_Must_inspect_result_ _In_ ULONG NewProtect
Definition: mmfuncs.h:682
USHORT Rom
Definition: mm.h:368
PMMPTE PteAddress
Definition: mm.h:386
#define _Out_opt_
Definition: ms_sal.h:346
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:1035
unsigned int * PULONG
Definition: retypes.h:1
ULONG_PTR EntireFrame
Definition: mm.h:415
#define NULL
Definition: types.h:112
MMPTE OriginalPte
Definition: mm.h:407
struct _MM_SECTION_SEGMENT MM_SECTION_SEGMENT
VOID NTAPI MmDeleteAllRmaps(PFN_NUMBER Page, PVOID Context, VOID(*DeleteMapping)(PVOID Context, struct _EPROCESS *Process, PVOID Address))
#define inline
Definition: compat.h:23
_In_ SIZE_T QuotaToReturn
Definition: mm.h:675
_Requires_exclusive_lock_held_(WorkingSet->WorkingSetMutex) VOID NTAPI MiInitializeWorkingSetList(_Inout_ PMMSUPPORT WorkingSet)
SWAPENTRY SwapEntry
Definition: mm.h:384
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
struct _MM_RMAP_ENTRY * Next
Definition: mm.h:267
VOID FASTCALL KeReleaseGuardedMutex(IN OUT PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:53
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306
VOID NTAPI MiReloadBootLoadedDrivers(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: sysldr.c:1693
#define InterlockedCompareExchangeSizeT(Destination, Exchange, Comperand)
Definition: ex.h:1537
MM_DRIVER_VERIFIER_DATA MmVerifierData
Definition: drvmgmt.c:20
ULONG MmNumberOfPagingFiles
Definition: pagefile.c:46
PFN_NUMBER MmHighestPhysicalPage
Definition: meminit.c:31
VOID NTAPI MmInitializeRegion(PLIST_ENTRY RegionListHead, SIZE_T Length, ULONG Type, ULONG Protect)
Definition: region.c:239
_Must_inspect_result_ _Outptr_result_bytebuffer_ ViewSize PVOID * MappedBase
Definition: mmfuncs.h:492
ULONG WsIndex
Definition: mm.h:378
enum _MI_PFN_USAGES MI_PFN_USAGES
PFN_NUMBER Blink
Definition: mm.h:389
VOID NTAPI MmSetSavedSwapEntryPage(PFN_NUMBER Page, SWAPENTRY SavedSwapEntry)
Definition: freelist.c:483
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
NTSTATUS NTAPI MmProtectSectionView(PMMSUPPORT AddressSpace, PMEMORY_AREA MemoryArea, PVOID BaseAddress, SIZE_T Length, ULONG Protect, PULONG OldProtect)
Definition: section.c:2042
FAST_MUTEX Lock
Definition: mm.h:199
FORCEINLINE PFN_NUMBER MiGetPfnEntryIndex(IN PMMPFN Pfn1)
Definition: mm.h:1067
struct tagContext Context
Definition: acpixf.h:1034
SECTION_IMAGE_INFORMATION ImageInformation
Definition: mm.h:231
PVOID MmLastUnloadedDrivers
Definition: sysldr.c:44
#define OUT
Definition: typedefs.h:40
_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
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3810
RTL_GENERIC_TABLE PageTable
Definition: mm.h:220
return Iosb
Definition: create.c:4402
PFN_COUNT MiFreeSwapPages
Definition: pagefile.c:49
unsigned int ULONG
Definition: retypes.h:1
LIST_ENTRY RegionListEntry
Definition: mm.h:467
VOID NTAPI _MmUnlockSectionSegment(PMM_SECTION_SEGMENT Segment, const char *file, int line)
Definition: data.c:107
BOOLEAN NTAPI MmIsFileObjectAPagingFile(PFILE_OBJECT FileObject)
Definition: pagefile.c:102
Definition: mm.h:265
VOID NTAPI MmFreeSpecialPool(IN PVOID P)
uint32_t * PULONG_PTR
Definition: typedefs.h:65
NTSTATUS NTAPI MmWriteToSwapPage(SWAPENTRY SwapEntry, PFN_NUMBER Page)
Definition: pagefile.c:130
ULONG NTAPI MmGetSessionId(IN PEPROCESS Process)
Definition: session.c:179
BOOLEAN NTAPI MmUseSpecialPool(IN SIZE_T NumberOfBytes, IN ULONG Tag)
struct _MM_MEMORY_CONSUMER MM_MEMORY_CONSUMER
VOID NTAPI MmSetDirtyBit(PEPROCESS Process, PVOID Address, BOOLEAN Bit)
Definition: page.c:816
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
Definition: wdfdevice.h:3776
struct _MM_PAGED_POOL_INFO * PMM_PAGED_POOL_INFO
ULONG PagesUsed
Definition: mm.h:457
VOID NTAPI MiInitializeNonPagedPool(VOID)
Definition: pool.c:278
ULONG PagedPoolHint
Definition: mm.h:491
PVOID Address
Definition: mm.h:269
ULONG_PTR InPageError
Definition: mm.h:419
ULONG SegFlags
Definition: mm.h:216
#define MmSetCleanPage(__P, __A)
Definition: mm.h:1243
PVOID NTAPI MmCreateKernelStack(BOOLEAN GuiStack, UCHAR Node)
#define KeGetCurrentThread
Definition: hal.h:55
struct _MMPFN * NextLRU
Definition: mm.h:435
NTSTATUS NTAPI MmNotPresentFaultSectionView(PMMSUPPORT AddressSpace, MEMORY_AREA *MemoryArea, PVOID Address, BOOLEAN Locked)
Definition: section.c:1526
PMMPTE FirstPteForPagedPool
Definition: mm.h:488
#define _Acquires_lock_(lock)
UCHAR MmDisablePagingExecutive
Definition: mminit.c:25
VOID NTAPI MmInitGlobalKernelPageDirectory(VOID)
Definition: page.c:277
VOID NTAPI ExpCheckPoolAllocation(PVOID P, POOL_TYPE PoolType, ULONG Tag)
Definition: expool.c:296
MMPFNLIST MmFreePageListHead
Definition: pfnlist.c:42
VOID NTAPI MmInitializeRmapList(VOID)
Definition: rmap.c:38
VOID NTAPI MmReferencePage(PFN_NUMBER Page)
Definition: freelist.c:518
ULONG NTAPI MmGetSessionIdEx(IN PEPROCESS Process)
Definition: session.c:194
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS SourceAddress
Definition: iotypes.h:1127
SINGLE_LIST_ENTRY NextStackPfn
Definition: mm.h:381
VOID NTAPI MmDeleteProcessAddressSpace(IN PEPROCESS Process)
Definition: procsup.c:1361
__int64 * PLONG64
Definition: basetsd.h:185
struct _MEMORY_AREA * MemoryArea
Definition: newmm.h:37
BOOLEAN NTAPI MmIsSpecialPoolAddress(IN PVOID P)
PVOID Vad
Definition: mm.h:255
static CODE_SEG("PAGE")
Definition: isapnp.c:1482
NTSTATUS NTAPI MmInitializeHandBuiltProcess(IN PEPROCESS Process, IN PULONG_PTR DirectoryTableBase)
Definition: procsup.c:1131
#define APC_LEVEL
Definition: env_spec_w32.h:695
FORCEINLINE VOID MmLockAddressSpace(PMMSUPPORT AddressSpace)
Definition: mm.h:1659
#define _IRQL_restores_
Definition: driverspecs.h:233
#define _IRQL_saves_
Definition: driverspecs.h:235
ULONG Flags
Definition: mm.h:252
PLONG64 ReferenceCount
Definition: mm.h:202
base of all file and directory entries
Definition: entries.h:82
FORCEINLINE PMMSUPPORT MmGetCurrentAddressSpace(VOID)
Definition: mm.h:1681
ULONG_PTR NTAPI _MmGetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment, PLARGE_INTEGER Offset, const char *file, int line)
Definition: sptab.c:266
* PKAPC_STATE
Definition: ketypes.h:1285
LONG AweReferenceCount
Definition: mm.h:408
VOID NTAPI MmFreeSwapPage(SWAPENTRY Entry)
Definition: pagefile.c:274
CHAR MI_PFN_CURRENT_PROCESS_NAME[16]
Definition: pfnlist.c:64
VOID NTAPI MmDeletePageTable(struct _EPROCESS *Process, PVOID Address)
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:251
NTSTATUS NTAPI MmLoadSystemImage(IN PUNICODE_STRING FileName, IN PUNICODE_STRING NamePrefix OPTIONAL, IN PUNICODE_STRING LoadedName OPTIONAL, IN ULONG Flags, OUT PVOID *ModuleObject, OUT PVOID *ImageBaseAddress)
Definition: sysldr.c:2898
SWAPENTRY NTAPI MmGetSavedSwapEntryPage(PFN_NUMBER Page)
Definition: freelist.c:499
PMMPDE NextPdeForPagedPoolExpansion
Definition: mm.h:490
SIZE_T MmDriverCommit
Definition: freelist.c:32
Definition: dlist.c:348
Definition: mm.h:441
static KSPIN_LOCK PspQuotaLock
Definition: quota.c:18
Definition: fci.c:126
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68