ReactOS  0.4.15-dev-1384-g878186b
mm.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <internal/arch/mm.h>
4 
5 /* TYPES *********************************************************************/
6 
7 struct _EPROCESS;
8 
18 extern ULONG MmThrottleTop;
19 extern ULONG MmThrottleBottom;
20 
22 
24 
26 
30 extern PVOID KernelVerifier;
32 
35 extern SIZE_T MmSharedCommit;
36 extern SIZE_T MmDriverCommit;
37 extern SIZE_T MmProcessCommit;
41 
42 extern PVOID MiDebugMapping; // internal
43 extern PMMPTE MmDebugPte; // internal
44 
45 struct _KTRAP_FRAME;
46 struct _EPROCESS;
48 typedef ULONG_PTR SWAPENTRY;
49 
50 //
51 // MmDbgCopyMemory Flags
52 //
53 #define MMDBG_COPY_WRITE 0x00000001
54 #define MMDBG_COPY_PHYSICAL 0x00000002
55 #define MMDBG_COPY_UNSAFE 0x00000004
56 #define MMDBG_COPY_CACHED 0x00000008
57 #define MMDBG_COPY_UNCACHED 0x00000010
58 #define MMDBG_COPY_WRITE_COMBINED 0x00000020
59 
60 //
61 // Maximum chunk size per copy
62 //
63 #define MMDBG_COPY_MAX_SIZE 0x8
64 
65 #if defined(_X86_) // intenal for marea.c
66 #define MI_STATIC_MEMORY_AREAS (14)
67 #else
68 #define MI_STATIC_MEMORY_AREAS (13)
69 #endif
70 
71 #define MEMORY_AREA_SECTION_VIEW (1)
72 #define MEMORY_AREA_CACHE (2)
73 #define MEMORY_AREA_OWNED_BY_ARM3 (15)
74 #define MEMORY_AREA_STATIC (0x80000000)
75 
76 /* Although Microsoft says this isn't hardcoded anymore,
77  they won't be able to change it. Stuff depends on it */
78 #define MM_VIRTMEM_GRANULARITY (64 * 1024)
79 
80 #define STATUS_MM_RESTART_OPERATION ((NTSTATUS)0xD0000001)
81 
82 /*
83  * Additional flags for protection attributes
84  */
85 #define PAGE_WRITETHROUGH (1024)
86 #define PAGE_SYSTEM (2048)
87 
88 #define SEC_PHYSICALMEMORY (0x80000000)
89 
90 #define MM_PAGEFILE_SEGMENT (0x1)
91 #define MM_DATAFILE_SEGMENT (0x2)
92 
93 #define MC_CACHE (0)
94 #define MC_USER (1)
95 #define MC_SYSTEM (2)
96 #define MC_MAXIMUM (3)
97 
98 #define PAGED_POOL_MASK 1
99 #define MUST_SUCCEED_POOL_MASK 2
100 #define CACHE_ALIGNED_POOL_MASK 4
101 #define QUOTA_POOL_MASK 8
102 #define SESSION_POOL_MASK 32
103 #define VERIFIER_POOL_MASK 64
104 
105 #define MAX_PAGING_FILES (16)
106 
107 // FIXME: use ALIGN_UP_BY
108 #define MM_ROUND_UP(x,s) \
109  ((PVOID)(((ULONG_PTR)(x)+(s)-1) & ~((ULONG_PTR)(s)-1)))
110 
111 #define MM_ROUND_DOWN(x,s) \
112  ((PVOID)(((ULONG_PTR)(x)) & ~((ULONG_PTR)(s)-1)))
113 
114 #define PAGE_FLAGS_VALID_FOR_SECTION \
115  (PAGE_READONLY | \
116  PAGE_READWRITE | \
117  PAGE_WRITECOPY | \
118  PAGE_EXECUTE | \
119  PAGE_EXECUTE_READ | \
120  PAGE_EXECUTE_READWRITE | \
121  PAGE_EXECUTE_WRITECOPY | \
122  PAGE_NOACCESS | \
123  PAGE_NOCACHE)
124 
125 #define PAGE_IS_READABLE \
126  (PAGE_READONLY | \
127  PAGE_READWRITE | \
128  PAGE_WRITECOPY | \
129  PAGE_EXECUTE_READ | \
130  PAGE_EXECUTE_READWRITE | \
131  PAGE_EXECUTE_WRITECOPY)
132 
133 #define PAGE_IS_WRITABLE \
134  (PAGE_READWRITE | \
135  PAGE_WRITECOPY | \
136  PAGE_EXECUTE_READWRITE | \
137  PAGE_EXECUTE_WRITECOPY)
138 
139 #define PAGE_IS_EXECUTABLE \
140  (PAGE_EXECUTE | \
141  PAGE_EXECUTE_READ | \
142  PAGE_EXECUTE_READWRITE | \
143  PAGE_EXECUTE_WRITECOPY)
144 
145 #define PAGE_IS_WRITECOPY \
146  (PAGE_WRITECOPY | \
147  PAGE_EXECUTE_WRITECOPY)
148 
149 //
150 // Wait entry for marking pages that are being serviced
151 //
152 #ifdef _M_IX86
153 #define MM_WAIT_ENTRY 0x7ffffc00
154 #elif defined(_M_AMD64)
155 #define MM_WAIT_ENTRY 0x7FFFFFFFFFFFFC00ULL
156 #else
157 #error Unsupported architecture!
158 #endif
159 
160 #define InterlockedCompareExchangePte(PointerPte, Exchange, Comperand) \
161  InterlockedCompareExchange((PLONG)(PointerPte), Exchange, Comperand)
162 
163 #define InterlockedExchangePte(PointerPte, Value) \
164  InterlockedExchange((PLONG)(PointerPte), Value)
165 
166 typedef struct _MM_SECTION_SEGMENT
167 {
168  FAST_MUTEX Lock; /* lock which protects the page directory */
170  LARGE_INTEGER RawLength; /* length of the segment which is part of the mapped file */
171  LARGE_INTEGER Length; /* absolute length of the segment */
178 
179  struct
180  {
181  ULONGLONG FileOffset; /* start offset into the file for image sections */
182  ULONG_PTR VirtualAddress; /* start offset into the address range for image sections */
184  } Image;
185 
189 
191 {
197 
198 typedef struct _ROS_SECTION_OBJECT
199 {
206  union
207  {
210  };
212 
213 #define MA_GetStartingAddress(_MemoryArea) ((_MemoryArea)->VadNode.StartingVpn << PAGE_SHIFT)
214 #define MA_GetEndingAddress(_MemoryArea) (((_MemoryArea)->VadNode.EndingVpn + 1) << PAGE_SHIFT)
215 
216 typedef struct _MEMORY_AREA
217 {
219 
226  union
227  {
228  struct
229  {
234  } SectionData;
235  struct
236  {
239  } Data;
241 
242 typedef struct _MM_RMAP_ENTRY
243 {
247 #if DBG
248  PVOID Caller;
249 #endif
250 }
252 
253 #if MI_TRACE_PFNS
256 #define MI_SET_USAGE(x) MI_PFN_CURRENT_USAGE = x
257 #define MI_SET_PROCESS2(x) memcpy(MI_PFN_CURRENT_PROCESS_NAME, x, 16)
258 #else
259 #define MI_SET_USAGE(x)
260 #define MI_SET_PROCESS2(x)
261 #endif
262 
263 typedef enum _MI_PFN_USAGES
264 {
288 } MI_PFN_USAGES;
289 
290 //
291 // These two mappings are actually used by Windows itself, based on the ASSERTS
292 //
293 #define StartOfAllocation ReadInProgress
294 #define EndOfAllocation WriteInProgress
295 
296 typedef struct _MMPFNENTRY
297 {
299  USHORT ReadInProgress:1; // StartOfAllocation
300  USHORT WriteInProgress:1; // EndOfAllocation
308 } MMPFNENTRY;
309 
310 // Mm internal
311 typedef struct _MMPFN
312 {
313  union
314  {
320 
321  // HACK for ROSPFN
323  } u1;
325  union
326  {
329  } u2;
330  union
331  {
332  struct
333  {
336  };
337  struct
338  {
341  } e2;
342  } u3;
343  union
344  {
347 
348  // HACK for ROSPFN
350  };
351  union
352  {
354  struct
355  {
362  };
363  } u4;
364 #if MI_TRACE_PFNS
365  MI_PFN_USAGES PfnUsage;
366  CHAR ProcessName[16];
367 #endif
368 
369  // HACK until WS lists are supported
371 } MMPFN, *PMMPFN;
372 
373 extern PMMPFN MmPfnDatabase;
374 
375 typedef struct _MMPFNLIST
376 {
382 
388 
389 typedef struct _MM_MEMORY_CONSUMER
390 {
395 
396 typedef struct _MM_REGION
397 {
403 
404 // Mm internal
405 /* Entry describing free pool memory */
406 typedef struct _MMFREE_POOL_ENTRY
407 {
413 
414 /* Signature of a freed block */
415 #define MM_FREE_POOL_SIGNATURE 'ARM3'
416 
417 /* Paged pool information */
418 typedef struct _MM_PAGED_POOL_INFO
419 {
429 
431 
432 /* Page file information */
433 typedef struct _MMPAGING_FILE
434 {
444 }
446 
448 
449 typedef VOID
453  SIZE_T Length,
454  ULONG OldType,
455  ULONG OldProtect,
456  ULONG NewType,
458 );
459 
460 typedef VOID
462  PVOID Context,
464  PVOID Address,
465  PFN_NUMBER Page,
466  SWAPENTRY SwapEntry,
467  BOOLEAN Dirty
468 );
469 
470 //
471 // Mm copy support for Kd
472 //
473 NTSTATUS
474 NTAPI
477  IN PVOID Buffer,
478  IN ULONG Size,
479  IN ULONG Flags
480 );
481 
482 //
483 // Determines if a given address is a session address
484 //
485 BOOLEAN
486 NTAPI
489 );
490 
491 ULONG
492 NTAPI
495 );
496 
497 ULONG
498 NTAPI
501 );
502 
503 /* marea.c *******************************************************************/
504 
505 NTSTATUS
506 NTAPI
509  ULONG Type,
511  SIZE_T Length,
512  ULONG Protection,
514  ULONG AllocationFlags,
515  ULONG AllocationGranularity
516 );
517 
519 NTAPI
522  PVOID Address
523 );
524 
525 NTSTATUS
526 NTAPI
531  PVOID FreePageContext
532 );
533 
534 VOID
535 NTAPI
538  PMMVAD Vad);
539 
541 NTAPI
544  PVOID Address,
545  SIZE_T Length
546 );
547 
548 PVOID
549 NTAPI
550 MmFindGap(
552  SIZE_T Length,
553  ULONG_PTR Granularity,
554  BOOLEAN TopDown
555 );
556 
557 VOID
558 NTAPI
561 
562 VOID
563 NTAPI
565 
566 /* npool.c *******************************************************************/
567 
568 VOID
569 NTAPI
571 
572 PVOID
573 NTAPI
576  IN SIZE_T SizeInBytes
577 );
578 
579 POOL_TYPE
580 NTAPI
583 );
584 
585 ULONG
586 NTAPI
588  IN PVOID StartingAddress
589 );
590 
591 /* pool.c *******************************************************************/
592 
593 BOOLEAN
594 NTAPI
597  IN ULONG CurrentMaxQuota,
598  OUT PULONG NewMaxQuota
599 );
600 
601 /* mdl.c *********************************************************************/
602 
603 VOID
604 NTAPI
606  PMDL Mdl,
607  PPFN_NUMBER Pages
608 );
609 
610 /* mminit.c ******************************************************************/
611 
612 VOID
613 NTAPI
614 MmInit1(
615  VOID
616 );
617 
618 BOOLEAN
619 NTAPI
620 MmInitSystem(IN ULONG Phase,
621  IN PLOADER_PARAMETER_BLOCK LoaderBlock);
622 
623 
624 /* pagefile.c ****************************************************************/
625 
626 SWAPENTRY
627 NTAPI
629 
630 VOID
631 NTAPI
633 
634 VOID
635 NTAPI
637 
638 BOOLEAN
639 NTAPI
641 
642 NTSTATUS
643 NTAPI
645  SWAPENTRY SwapEntry,
646  PFN_NUMBER Page
647 );
648 
649 NTSTATUS
650 NTAPI
652  SWAPENTRY SwapEntry,
653  PFN_NUMBER Page
654 );
655 
656 VOID
657 NTAPI
659 
660 NTSTATUS
661 NTAPI
663  _In_ PFN_NUMBER Page,
664  _In_ ULONG PageFileIndex,
665  _In_ ULONG_PTR PageFileOffset);
666 
667 /* process.c ****************************************************************/
668 
669 NTSTATUS
670 NTAPI
673  IN PEPROCESS Clone OPTIONAL,
674  IN PVOID Section OPTIONAL,
675  IN OUT PULONG Flags,
677 );
678 
679 NTSTATUS
680 NTAPI
683  IN PINITIAL_PEB InitialPeb,
684  OUT PPEB *BasePeb
685 );
686 
687 NTSTATUS
688 NTAPI
692  IN PINITIAL_TEB InitialTeb,
693  OUT PTEB* BaseTeb
694 );
695 
696 VOID
697 NTAPI
699  struct _EPROCESS *Process,
700  PTEB Teb
701 );
702 
703 VOID
704 NTAPI
706 
707 NTSTATUS
708 NTAPI
710 
711 ULONG
712 NTAPI
714 
715 NTSTATUS
716 NTAPI
719  IN UCHAR MemoryPriority
720 );
721 
722 /* i386/pfault.c *************************************************************/
723 
724 NTSTATUS
725 NTAPI
727  ULONG Cs,
728  PULONG Eip,
729  PULONG Eax,
730  ULONG Cr2,
732 );
733 
734 /* special.c *****************************************************************/
735 
736 VOID
737 NTAPI
739 
740 BOOLEAN
741 NTAPI
744  IN ULONG Tag);
745 
746 BOOLEAN
747 NTAPI
749  IN PVOID P);
750 
751 BOOLEAN
752 NTAPI
754  IN PVOID P);
755 
756 PVOID
757 NTAPI
760  IN ULONG Tag,
762  IN ULONG SpecialType);
763 
764 VOID
765 NTAPI
767  IN PVOID P);
768 
769 /* mm.c **********************************************************************/
770 
771 NTSTATUS
772 NTAPI
774  IN ULONG FaultCode,
775  IN PVOID Address,
777  IN PVOID TrapInformation
778 );
779 
780 /* kmap.c ********************************************************************/
781 
782 NTSTATUS
783 NTAPI
785  PFN_NUMBER DestPage,
786  const VOID *SrcAddress
787 );
788 
789 /* process.c *****************************************************************/
790 
791 PVOID
792 NTAPI
794 
795 VOID
796 NTAPI
798  BOOLEAN GuiStack);
799 
800 /* balance.c *****************************************************************/
801 
802 VOID
803 NTAPI
805  ULONG Consumer,
806  NTSTATUS (*Trim)(ULONG Target, ULONG Priority, PULONG NrFreed)
807 );
808 
809 VOID
810 NTAPI
812  ULONG NrAvailablePages,
813  ULONG NrSystemPages
814 );
815 
816 NTSTATUS
817 NTAPI
819  ULONG Consumer,
820  PFN_NUMBER Page
821 );
822 
823 NTSTATUS
824 NTAPI
826  ULONG Consumer,
827  BOOLEAN MyWait,
828  PPFN_NUMBER AllocatedPage
829 );
830 
831 VOID
832 NTAPI
834 
835 VOID
836 NTAPI
838 
839 /* rmap.c **************************************************************/
840 
841 VOID
842 NTAPI
844  PFN_NUMBER Page,
845  struct _MM_RMAP_ENTRY* ListHead
846 );
847 
848 struct _MM_RMAP_ENTRY*
849 NTAPI
851 
852 VOID
853 NTAPI
855  PFN_NUMBER Page,
856  struct _EPROCESS *Process,
857  PVOID Address
858 );
859 
860 VOID
861 NTAPI
863  PFN_NUMBER Page,
864  PVOID Context,
865  VOID (*DeleteMapping)(PVOID Context, struct _EPROCESS *Process, PVOID Address)
866 );
867 
868 VOID
869 NTAPI
871  PFN_NUMBER Page,
872  struct _EPROCESS *Process,
873  PVOID Address
874 );
875 
876 VOID
877 NTAPI
879 
880 VOID
881 NTAPI
883 
884 VOID
885 NTAPI
887 
888 BOOLEAN
889 NTAPI
891 
892 NTSTATUS
893 NTAPI
895 
896 /* freelist.c **********************************************************/
897 
899 KIRQL
901 {
903 }
904 
906 VOID
909 {
911 }
912 
914 VOID
916 {
917  PKSPIN_LOCK_QUEUE LockQueue;
918 
920  LockQueue = &KeGetCurrentPrcb()->LockQueue[LockQueuePfnLock];
922 }
923 
925 VOID
927 {
928  PKSPIN_LOCK_QUEUE LockQueue;
929 
930  LockQueue = &KeGetCurrentPrcb()->LockQueue[LockQueuePfnLock];
933 }
934 
935 #define MI_ASSERT_PFN_LOCK_HELD() ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL)
936 
938 PMMPFN
940 {
941  PMMPFN Page;
942  extern RTL_BITMAP MiPfnBitMap;
943 
944  /* Make sure the PFN number is valid */
945  if (Pfn > MmHighestPhysicalPage) return NULL;
946 
947  /* Make sure this page actually has a PFN entry */
948  if ((MiPfnBitMap.Buffer) && !(RtlTestBit(&MiPfnBitMap, (ULONG)Pfn))) return NULL;
949 
950  /* Get the entry */
951  Page = &MmPfnDatabase[Pfn];
952 
953  /* Return it */
954  return Page;
955 };
956 
960 {
961  //
962  // This will return the Page Frame Number (PFN) from the MMPFN
963  //
964  return Pfn1 - MmPfnDatabase;
965 }
966 
968 NTAPI
969 MmGetLRUNextUserPage(PFN_NUMBER PreviousPage);
970 
972 NTAPI
974 
975 VOID
976 NTAPI
978 
979 VOID
980 NTAPI
982 
983 VOID
984 NTAPI
986  IN BOOLEAN StatusOnly
987 );
988 
989 VOID
990 NTAPI
992  VOID
993 );
994 
995 /* hypermap.c *****************************************************************/
996 
997 extern PEPROCESS HyperProcess;
998 extern KIRQL HyperIrql;
999 
1000 PVOID
1001 NTAPI
1003  IN PFN_NUMBER Page,
1004  IN PKIRQL OldIrql);
1005 
1006 VOID
1007 NTAPI
1009  IN PVOID Address,
1010  IN KIRQL OldIrql);
1011 
1012 PVOID
1013 NTAPI
1015  IN PFN_NUMBER NumberOfPages);
1016 
1017 VOID
1018 NTAPI
1020  IN PFN_NUMBER NumberOfPages);
1021 
1022 //
1023 // ReactOS Compatibility Layer
1024 //
1026 PVOID
1028 {
1029  HyperProcess = (PEPROCESS)KeGetCurrentThread()->ApcState.Process;
1031 }
1032 
1033 #define MmDeleteHyperspaceMapping(x) MiUnmapPageInHyperSpace(HyperProcess, x, HyperIrql);
1034 
1035 /* i386/page.c *********************************************************/
1036 
1037 NTSTATUS
1038 NTAPI
1040  struct _EPROCESS* Process,
1041  PVOID Address,
1042  ULONG flProtect,
1043  PPFN_NUMBER Pages,
1044  ULONG PageCount
1045 );
1046 
1047 NTSTATUS
1048 NTAPI
1050  struct _EPROCESS* Process,
1051  PVOID Address,
1052  ULONG flProtect,
1053  PPFN_NUMBER Pages,
1054  ULONG PageCount
1055 );
1056 
1057 ULONG
1058 NTAPI
1060  struct _EPROCESS* Process,
1061  PVOID Address);
1062 
1063 VOID
1064 NTAPI
1066  struct _EPROCESS* Process,
1067  PVOID Address,
1068  ULONG flProtect
1069 );
1070 
1071 BOOLEAN
1072 NTAPI
1074  struct _EPROCESS* Process,
1075  PVOID Address
1076 );
1077 
1078 BOOLEAN
1079 NTAPI
1081  struct _EPROCESS* Process,
1082  PVOID Address
1083 );
1084 
1085 VOID
1086 NTAPI
1088 
1089 VOID
1090 NTAPI
1092  struct _EPROCESS *Process,
1093  PVOID Address,
1094  SWAPENTRY* SwapEntry);
1095 
1096 VOID
1097 NTAPI
1099  struct _EPROCESS *Process,
1100  PVOID Address,
1101  SWAPENTRY* SwapEntry
1102 );
1103 
1104 NTSTATUS
1105 NTAPI
1107  struct _EPROCESS *Process,
1108  PVOID Address,
1109  SWAPENTRY SwapEntry
1110 );
1111 
1112 BOOLEAN
1113 NTAPI
1115  struct _EPROCESS *Process,
1116  PVOID Address
1117 );
1118 
1119 VOID
1120 NTAPI
1122  struct _EPROCESS *Process,
1123  PVOID Address
1124 );
1125 
1126 PFN_NUMBER
1127 NTAPI
1128 MmAllocPage(
1129  ULONG Consumer
1130 );
1131 
1132 VOID
1133 NTAPI
1135 
1136 VOID
1137 NTAPI
1139 
1140 ULONG
1141 NTAPI
1143 
1144 BOOLEAN
1145 NTAPI
1147 
1148 VOID
1149 NTAPI
1151  PFN_NUMBER Page,
1152  SWAPENTRY SavedSwapEntry);
1153 
1154 SWAPENTRY
1155 NTAPI
1157 
1158 VOID
1159 NTAPI
1161  struct _EPROCESS *Process,
1162  PVOID Address
1163 );
1164 
1165 VOID
1166 NTAPI
1168  struct _EPROCESS *Process,
1169  PVOID Address
1170 );
1171 
1172 PFN_NUMBER
1173 NTAPI
1175  struct _EPROCESS *Process,
1176  PVOID Address
1177 );
1178 
1179 BOOLEAN
1180 NTAPI
1182  IN ULONG MinWs,
1183  IN PEPROCESS Dest,
1184  IN PULONG_PTR DirectoryTableBase
1185 );
1186 
1187 NTSTATUS
1188 NTAPI
1191  IN PULONG_PTR DirectoryTableBase
1192 );
1193 
1194 NTSTATUS
1195 NTAPI
1198 );
1199 
1200 NTSTATUS
1201 NTAPI
1202 MmSetExecuteOptions(IN ULONG ExecuteOptions);
1203 
1204 NTSTATUS
1205 NTAPI
1206 MmGetExecuteOptions(IN PULONG ExecuteOptions);
1207 
1208 VOID
1209 NTAPI
1211  struct _EPROCESS *Process,
1212  PVOID Address,
1213  BOOLEAN* WasDirty,
1214  PPFN_NUMBER Page
1215 );
1216 
1217 BOOLEAN
1218 NTAPI
1220  struct _EPROCESS *Process,
1221  PVOID Address
1222 );
1223 
1224 /* wset.c ********************************************************************/
1225 
1226 NTSTATUS
1228  ULONG Target,
1229  ULONG Priority,
1230  PULONG NrFreedPages
1231 );
1232 
1233 /* region.c ************************************************************/
1234 
1235 NTSTATUS
1236 NTAPI
1240  PLIST_ENTRY RegionListHead,
1241  PVOID StartAddress,
1242  SIZE_T Length,
1243  ULONG NewType,
1244  ULONG NewProtect,
1245  PMM_ALTER_REGION_FUNC AlterFunc
1246 );
1247 
1248 VOID
1249 NTAPI
1251  PLIST_ENTRY RegionListHead,
1252  SIZE_T Length,
1253  ULONG Type,
1254  ULONG Protect
1255 );
1256 
1257 PMM_REGION
1258 NTAPI
1259 MmFindRegion(
1261  PLIST_ENTRY RegionListHead,
1262  PVOID Address,
1263  PVOID* RegionBaseAddress
1264 );
1265 
1266 /* section.c *****************************************************************/
1267 
1268 VOID
1269 NTAPI
1271  OUT PSECTION_IMAGE_INFORMATION ImageInformation
1272 );
1273 
1275 NTAPI
1277  IN PVOID Section
1278 );
1279 NTSTATUS
1280 NTAPI
1282  IN PVOID Address,
1284 );
1285 
1286 NTSTATUS
1287 NTAPI
1289  IN PVOID Section,
1291 );
1292 
1293 NTSTATUS
1294 NTAPI
1297  PVOID Address,
1300 );
1301 
1302 NTSTATUS
1303 NTAPI
1308  SIZE_T Length,
1309  ULONG Protect,
1310  PULONG OldProtect
1311 );
1312 
1313 NTSTATUS
1314 NTAPI
1316 
1317 NTSTATUS
1318 NTAPI
1322  PVOID Address,
1323  BOOLEAN Locked
1324 );
1325 
1326 NTSTATUS
1327 NTAPI
1331  PVOID Address,
1333 );
1334 
1335 NTSTATUS
1336 NTAPI
1338 
1339 NTSTATUS
1340 NTAPI
1344  PVOID Address
1345 );
1346 
1347 VOID
1348 NTAPI
1350 
1351 /* sysldr.c ******************************************************************/
1352 
1353 VOID
1354 NTAPI
1356  IN PLOADER_PARAMETER_BLOCK LoaderBlock
1357 );
1358 
1359 BOOLEAN
1360 NTAPI
1362  IN PLOADER_PARAMETER_BLOCK LoaderBlock
1363 );
1364 
1365 BOOLEAN
1366 NTAPI
1368 
1369 VOID
1370 NTAPI
1372 
1373 NTSTATUS
1374 NTAPI
1377  IN PUNICODE_STRING NamePrefix OPTIONAL,
1378  IN PUNICODE_STRING LoadedName OPTIONAL,
1379  IN ULONG Flags,
1380  OUT PVOID *ModuleObject,
1381  OUT PVOID *ImageBaseAddress
1382 );
1383 
1384 NTSTATUS
1385 NTAPI
1387  IN PVOID ImageHandle
1388 );
1389 
1390 NTSTATUS
1391 NTAPI
1393  IN HANDLE ImageHandle,
1394  IN BOOLEAN PurgeSection
1395 );
1396 
1397 NTSTATUS
1398 NTAPI
1400  IN PLDR_DATA_TABLE_ENTRY LdrEntry,
1401  IN PLIST_ENTRY ListHead
1402 );
1403 
1404 
1405 /* procsup.c *****************************************************************/
1406 
1407 NTSTATUS
1408 NTAPI
1410  IN PVOID StackPointer
1411 );
1412 
1413 
1415 VOID
1417 {
1418  KeAcquireGuardedMutex(&CONTAINING_RECORD(AddressSpace, EPROCESS, Vm)->AddressCreationLock);
1419 }
1420 
1422 VOID
1424 {
1425  KeReleaseGuardedMutex(&CONTAINING_RECORD(AddressSpace, EPROCESS, Vm)->AddressCreationLock);
1426 }
1427 
1429 PEPROCESS
1431 {
1432  if (AddressSpace == MmKernelAddressSpace) return NULL;
1434 }
1435 
1437 PMMSUPPORT
1439 {
1440  return &((PEPROCESS)KeGetCurrentThread()->ApcState.Process)->Vm;
1441 }
1442 
1444 PMMSUPPORT
1446 {
1447  return MmKernelAddressSpace;
1448 }
1449 
1450 
1451 /* expool.c ******************************************************************/
1452 
1453 VOID
1454 NTAPI
1456  PVOID P,
1458  ULONG Tag);
1459 
1460 VOID
1461 NTAPI
1463  IN PVOID P);
1464 
1465 
1466 /* mmsup.c *****************************************************************/
1467 
1468 NTSTATUS
1469 NTAPI
1471  IN SIZE_T WorkingSetMinimumInBytes,
1472  IN SIZE_T WorkingSetMaximumInBytes,
1473  IN ULONG SystemCache,
1474  IN BOOLEAN IncreaseOkay);
1475 
1476 
1477 /* session.c *****************************************************************/
1478 
1480 NTSTATUS
1481 NTAPI
1482 MmAttachSession(
1483  _Inout_ PVOID SessionEntry,
1485 
1487 VOID
1488 NTAPI
1489 MmDetachSession(
1490  _Inout_ PVOID SessionEntry,
1492 
1493 VOID
1494 NTAPI
1496  _Inout_ PVOID SessionEntry);
1497 
1498 PVOID
1499 NTAPI
1501  _In_ ULONG SessionId);
1502 
1504 VOID
1505 NTAPI
1506 MmSetSessionLocaleId(
1507  _In_ LCID LocaleId);
1508 
1509 /* shutdown.c *****************************************************************/
1510 
1511 VOID
1512 MmShutdownSystem(IN ULONG Phase);
1513 
1514 /* virtual.c *****************************************************************/
1515 
1516 NTSTATUS
1517 NTAPI
1518 MmCopyVirtualMemory(IN PEPROCESS SourceProcess,
1520  IN PEPROCESS TargetProcess,
1524  OUT PSIZE_T ReturnSize);
1525 
VOID NTAPI MmDereferencePage(PFN_NUMBER Page)
Definition: freelist.c:537
VOID NTAPI MmSetCleanAllRmaps(PFN_NUMBER Page)
Definition: rmap.c:191
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
NTSTATUS NTAPI MmAccessFaultSectionView(PMMSUPPORT AddressSpace, MEMORY_AREA *MemoryArea, PVOID Address)
Definition: section.c:1795
VOID FASTCALL KeReleaseQueuedSpinLockFromDpcLevel(IN OUT PKSPIN_LOCK_QUEUE LockQueue)
PRTL_BITMAP PagedPoolAllocationMap
Definition: mm.h:420
PULONG Buffer
Definition: typedefs.h:91
ULONG_PTR VirtualAddress
Definition: mm.h:182
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:740
PFILE_OBJECT NTAPI MmGetFileObjectForSection(IN PVOID Section)
Definition: section.c:1681
BOOLEAN WriteCopy
Definition: mm.h:176
PFN_NUMBER MmResidentAvailablePages
Definition: freelist.c:27
#define IN
Definition: typedefs.h:39
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:1282
PEPROCESS Process
Definition: mm.h:245
MM_MEMORY_CONSUMER MiMemoryConsumers[MC_MAXIMUM]
Definition: balance.c:29
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
LARGE_INTEGER MaximumSize
Definition: mm.h:202
VOID(* PMM_ALTER_REGION_FUNC)(PMMSUPPORT AddressSpace, PVOID BaseAddress, SIZE_T Length, ULONG OldType, ULONG OldProtect, ULONG NewType, ULONG NewProtect)
Definition: mm.h:450
VOID NTAPI MmFreeSectionSegments(PFILE_OBJECT FileObject)
Definition: section.c:805
ULONG Type
Definition: mm.h:220
ULONG MI_PFN_CURRENT_USAGE
Definition: pfnlist.c:63
struct _MEMORY_AREA * PMEMORY_AREA
_In_ ULONG Mode
Definition: hubbusif.h:303
ULONG Characteristics
Definition: mm.h:183
Definition: ntbasedef.h:629
NTSTATUS NTAPI MmAccessFault(IN ULONG FaultCode, IN PVOID Address, IN KPROCESSOR_MODE Mode, IN PVOID TrapInformation)
Definition: mmfault.c:204
VOID FASTCALL KeAcquireGuardedMutex(IN PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:42
VOID NTAPI MmInit1(VOID)
_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
NTSTATUS NTAPI MmGetFileNameForSection(IN PVOID Section, OUT POBJECT_NAME_INFORMATION *ModuleName)
Definition: section.c:1801
NTSTATUS NTAPI MmCreateVirtualMapping(struct _EPROCESS *Process, PVOID Address, ULONG flProtect, PPFN_NUMBER Pages, ULONG PageCount)
ULONG PFN_COUNT
Definition: mmtypes.h:102
ULONG NTAPI MmGetPageProtect(struct _EPROCESS *Process, PVOID Address)
BOOLEAN NTAPI MmIsPageInUse(PFN_NUMBER Page)
Definition: freelist.c:530
USHORT ReadInProgress
Definition: mm.h:299
struct _MM_RMAP_ENTRY *NTAPI MmGetRmapListHeadPage(PFN_NUMBER Page)
Definition: freelist.c:427
VOID NTAPI MmDumpArmPfnDatabase(IN BOOLEAN StatusOnly)
Definition: mminit.c:1474
BOOLEAN NTAPI MiInitializeLoadedModuleList(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: sysldr.c:2205
ULONG_PTR AweAllocation
Definition: mm.h:359
ULONG Signature
Definition: mm.h:410
LIST_ENTRY ListOfSegments
Definition: mm.h:186
ULONG PagesTarget
Definition: mm.h:392
VOID NTAPI MmDeleteRmap(PFN_NUMBER Page, struct _EPROCESS *Process, PVOID Address)
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG AddressSpace
Definition: iofuncs.h:2268
VOID NTAPI MmDeleteKernelStack(PVOID Stack, BOOLEAN GuiStack)
union _MEMORY_AREA::@1781 Data
VOID MmShutdownSystem(IN ULONG Phase)
Definition: shutdown.c:41
MMLISTS ListName
Definition: mm.h:378
char CHAR
Definition: xmlstorage.h:175
FORCEINLINE VOID MmUnlockAddressSpace(PMMSUPPORT AddressSpace)
Definition: mm.h:1423
VOID NTAPI MmBuildMdlFromPages(PMDL Mdl, PPFN_NUMBER Pages)
Definition: pagefile.c:94
ULONG SessionId
Definition: dllmain.c:28
PMEMORY_AREA NTAPI MmLocateMemoryAreaByRegion(PMMSUPPORT AddressSpace, PVOID Address, SIZE_T Length)
Definition: marea.c:106
PMM_RMAP_ENTRY RmapListHead
Definition: mm.h:349
struct _MM_PAGED_POOL_INFO MM_PAGED_POOL_INFO
NTSTATUS NTAPI MmCreatePhysicalMemorySection(VOID)
Definition: section.c:2753
Definition: mm.h:396
struct _MM_RMAP_ENTRY MM_RMAP_ENTRY
LONG NTSTATUS
Definition: precomp.h:26
PFN_NUMBER Size
Definition: mm.h:435
NTSTATUS NTAPI MiReadPageFile(_In_ PFN_NUMBER Page, _In_ ULONG PageFileIndex, _In_ ULONG_PTR PageFileOffset)
Definition: pagefile.c:197
PVOID NTAPI MmGetSessionById(_In_ ULONG SessionId)
Definition: session.c:1054
BOOLEAN NTAPI MmIsSessionAddress(IN PVOID Address)
Definition: session.c:49
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1075
PFN_NUMBER Flink
Definition: mm.h:315
struct _EPROCESS * PEPROCESS
Definition: nt_native.h:30
LIST_ENTRY RegionListHead
Definition: mm.h:233
NTSTATUS NTAPI MmReleasePageMemoryConsumer(ULONG Consumer, PFN_NUMBER Page)
Definition: balance.c:90
SIZE_T MmSharedCommit
Definition: freelist.c:31
BOOLEAN NTAPI MmIsDirtyPageRmap(PFN_NUMBER Page)
Definition: rmap.c:235
NTSTATUS NTAPI MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN MyWait, PPFN_NUMBER AllocatedPage)
Definition: balance.c:222
FORCEINLINE KIRQL MiAcquirePfnLock(VOID)
Definition: mm.h:900
VOID(* PMM_FREE_PAGE_FUNC)(PVOID Context, PMEMORY_AREA MemoryArea, PVOID Address, PFN_NUMBER Page, SWAPENTRY SwapEntry, BOOLEAN Dirty)
Definition: mm.h:461
USHORT Modified
Definition: mm.h:298
PMM_SECTION_SEGMENT Segment
Definition: mm.h:232
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)
struct _MMPFNENTRY MMPFNENTRY
VOID FASTCALL KeAcquireQueuedSpinLockAtDpcLevel(IN OUT PKSPIN_LOCK_QUEUE LockQueue)
PVOID MmTriageActionTaken
Definition: drvmgmt.c:27
USHORT RemovalRequested
Definition: mm.h:304
PVOID MmUnloadedDrivers
Definition: sysldr.c:43
DWORD LCID
Definition: nls.h:13
PFILE_OBJECT FileObject
Definition: mm.h:440
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
ULONG CacheCount
Definition: mm.h:173
NTSTATUS NTAPI MmGetFileNameForAddress(IN PVOID Address, OUT PUNICODE_STRING ModuleName)
Definition: section.c:1831
VOID NTAPI MmDeletePageFileMapping(struct _EPROCESS *Process, PVOID Address, SWAPENTRY *SwapEntry)
NTSTATUS NTAPI MmReadFromSwapPage(SWAPENTRY SwapEntry, PFN_NUMBER Page)
Definition: pagefile.c:190
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
PMEMORY_AREA NTAPI MmLocateMemoryAreaByAddress(PMMSUPPORT AddressSpace, PVOID Address)
Definition: marea.c:60
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:522
USHORT ReferenceCount
Definition: mm.h:334
PVOID NTAPI MmAllocateSpecialPool(IN SIZE_T NumberOfBytes, IN ULONG Tag, IN POOL_TYPE PoolType, IN ULONG SpecialType)
MMPFNLIST MmStandbyPageListHead
Definition: pfnlist.c:43
FORCEINLINE VOID MiReleasePfnLock(_In_ KIRQL OldIrql)
Definition: mm.h:907
USHORT PageLocation
Definition: mm.h:303
PMMPFN MmPfnDatabase
Definition: freelist.c:24
struct _MM_IMAGE_SECTION_OBJECT MM_IMAGE_SECTION_OBJECT
PFN_NUMBER Flink
Definition: mm.h:379
enum _MMLISTS MMLISTS
FORCEINLINE VOID MiReleasePfnLockFromDpcLevel(VOID)
Definition: mm.h:926
MMPFNLIST MmModifiedNoWritePageListHead
Definition: pfnlist.c:47
PVOID NTAPI MmFindGap(PMMSUPPORT AddressSpace, SIZE_T Length, ULONG_PTR Granularity, BOOLEAN TopDown)
Definition: marea.c:210
uint32_t ULONG_PTR
Definition: typedefs.h:65
VOID NTAPI MmMakeKernelResourceSectionWritable(VOID)
Definition: sysldr.c:2325
FORCEINLINE VOID MiAcquirePfnLockAtDpcLevel(VOID)
Definition: mm.h:915
MMWSLE Wsle
Definition: mm.h:370
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
USHORT PrototypePte
Definition: mm.h:301
PMM_IMAGE_SECTION_OBJECT ImageSection
Definition: mm.h:208
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:636
union _MMPFN::@1784 u1
UCHAR KIRQL
Definition: env_spec_w32.h:591
MMPFNENTRY e1
Definition: mm.h:335
ULONG * PPFN_NUMBER
Definition: ke.h:9
ULONG Magic
Definition: mm.h:224
NTSTATUS NTAPI MmQuerySectionView(PMEMORY_AREA MemoryArea, PVOID Address, PMEMORY_BASIC_INFORMATION Info, PSIZE_T ResultLength)
Definition: section.c:2559
BOOLEAN NTAPI MmIsPagePresent(struct _EPROCESS *Process, PVOID Address)
VOID NTAPI MmInitializeMemoryConsumer(ULONG Consumer, NTSTATUS(*Trim)(ULONG Target, ULONG Priority, PULONG NrFreed))
Definition: balance.c:75
VOID NTAPI MmInitPagingFile(VOID)
Definition: pagefile.c:255
USHORT CacheAttribute
Definition: mm.h:305
#define MC_MAXIMUM
Definition: mm.h:96
VOID NTAPI MmZeroPageThread(VOID)
Definition: zeropage.c:36
RTL_BITMAP MiPfnBitMap
Definition: init.c:44
ULONG PFN_NUMBER
Definition: ke.h:9
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:1754
ULONG_PTR MustBeCached
Definition: mm.h:361
ULONG_PTR * PSIZE_T
Definition: typedefs.h:80
VOID NTAPI MmSetDirtyPage(struct _EPROCESS *Process, PVOID Address)
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
NTSTATUS NTAPI MmInitSectionImplementation(VOID)
Definition: section.c:2804
PMMPTE LastPteForPagedPool
Definition: mm.h:423
ULONG Type
Definition: mm.h:398
struct _MM_MEMORY_CONSUMER * PMM_MEMORY_CONSUMER
struct _MMPFNLIST * PMMPFNLIST
ULONG_PTR ShareCount
Definition: mm.h:328
SIZE_T MmTotalCommitLimit
Definition: mminit.c:359
NTSTATUS NTAPI MmCallDllInitialize(IN PLDR_DATA_TABLE_ENTRY LdrEntry, IN PLIST_ENTRY ListHead)
Definition: sysldr.c:309
ULONG Protection
Definition: mm.h:174
VOID NTAPI MmRebalanceMemoryConsumers(VOID)
Definition: balance.c:211
long LONG
Definition: pedump.c:60
USHORT ParityError
Definition: mm.h:307
ULONG NTAPI MmGetSessionLocaleId(VOID)
Definition: session.c:57
_In_ PMEMORY_AREA _In_ PVOID _In_ BOOLEAN Locked
Definition: newmm.h:260
PFN_NUMBER Blink
Definition: mm.h:380
PKEVENT Event
Definition: mm.h:317
BOOLEAN NTAPI MmChangeKernelResourceSectionProtection(IN ULONG_PTR ProtectionMask)
Definition: sysldr.c:2294
PMMSUPPORT MmKernelAddressSpace
Definition: mminit.c:29
struct _MM_RMAP_ENTRY * PMM_RMAP_ENTRY
LIST_ENTRY List
Definition: mm.h:408
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER _Outptr_ PVOID * TargetAddress
Definition: iotypes.h:1018
struct _MMPAGING_FILE * PMMPAGING_FILE
PVOID NTAPI MiMapPageInHyperSpace(IN PEPROCESS Process, IN PFN_NUMBER Page, IN PKIRQL OldIrql)
Definition: hypermap.c:30
NTSTATUS NTAPI MmGetExecuteOptions(IN PULONG ExecuteOptions)
Definition: pagfault.c:2521
BOOLEAN Locked
Definition: mm.h:177
VOID NTAPI MmSetCleanPage(struct _EPROCESS *Process, PVOID Address)
unsigned char BOOLEAN
SIZE_T AllocatedPagedPool
Definition: mm.h:427
SIZE_T MmPeakCommitment
Definition: freelist.c:35
ULONG Protect
Definition: mm.h:221
static WCHAR Address[46]
Definition: ping.c:68
NTSTATUS NTAPI MmPageOutSectionView(PMMSUPPORT AddressSpace, PMEMORY_AREA MemoryArea, PVOID Address, ULONG_PTR Entry)
VOID NTAPI MmDeleteVirtualMapping(struct _EPROCESS *Process, PVOID Address, BOOLEAN *WasDirty, PPFN_NUMBER Page)
ULONG_PTR VerifierAllocation
Definition: mm.h:358
SIZE_T Length
Definition: mm.h:400
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define _Out_
Definition: no_sal2.h:160
NTSTATUS NTAPI MmPageOutPhysicalAddress(PFN_NUMBER Page)
Definition: rmap.c:53
Definition: bufpool.h:45
_Must_inspect_result_ _In_ WDFDMATRANSACTION _In_ PFN_WDF_PROGRAM_DMA _In_ WDF_DMA_DIRECTION _In_ PMDL _In_ PVOID VirtualAddress
ROS_SECTION_OBJECT * Section
Definition: mm.h:230
SIZE_T MmTotalCommittedPages
Definition: freelist.c:30
VOID NTAPI MmGetPageFileMapping(struct _EPROCESS *Process, PVOID Address, SWAPENTRY *SwapEntry)
VOID NTAPI MmQuitNextSession(_Inout_ PVOID SessionEntry)
Definition: session.c:1034
NTSTATUS NTAPI MmGrowKernelStack(IN PVOID StackPointer)
Definition: procsup.c:459
SIZE_T PagedPoolCommit
Definition: mm.h:426
PFN_NUMBER MaximumSize
Definition: mm.h:436
PFN_NUMBER MinimumSize
Definition: mm.h:437
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:169
UNICODE_STRING PageFileName
Definition: mm.h:441
struct _MM_IMAGE_SECTION_OBJECT * PMM_IMAGE_SECTION_OBJECT
_IRQL_requires_max_(APC_LEVEL) NTSTATUS NTAPI MmAttachSession(_Inout_ PVOID SessionEntry
Definition: cddata.c:197
ULONG Protect
Definition: mm.h:399
USHORT WriteInProgress
Definition: mm.h:300
NTSTATUS NTAPI MmCheckSystemImage(IN HANDLE ImageHandle, IN BOOLEAN PurgeSection)
Definition: sysldr.c:2706
NTSTATUS NTAPI MmUnloadSystemImage(IN PVOID ImageHandle)
Definition: sysldr.c:912
NTSTATUS NTAPI MmPageFault(ULONG Cs, PULONG Eip, PULONG Eax, ULONG Cr2, ULONG ErrorCode)
LARGE_INTEGER Length
Definition: mm.h:171
PMMPTE MmDebugPte
Definition: mmdbg.c:31
struct _MMPFN::@1786::@1792 e2
union _MMPFN::@1785 u2
ULONGLONG FileOffset
Definition: mm.h:181
FAST_MUTEX
Definition: extypes.h:17
BOOLEAN NTAPI MmIsSpecialPoolAddressFree(IN PVOID P)
PFN_COUNT Size
Definition: mm.h:409
VOID NTAPI MmCleanProcessAddressSpace(IN PEPROCESS Process)
Definition: procsup.c:1325
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
struct _ROS_SECTION_OBJECT ROS_SECTION_OBJECT
_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:263
POOL_TYPE NTAPI MmDeterminePoolType(IN PVOID VirtualAddress)
Definition: pool.c:406
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
_Out_ PCLIENT_ID ClientId
Definition: kefuncs.h:1163
PFILE_OBJECT FileObject
Definition: mm.h:205
#define ASSERT(a)
Definition: mode.c:45
PFN_NUMBER FreeSpace
Definition: mm.h:438
struct _MMPFNLIST MMPFNLIST
#define MAX_PAGING_FILES
Definition: mm.h:105
NTSTATUS NTAPI MmCreatePeb(IN PEPROCESS Process, IN PINITIAL_PEB InitialPeb, OUT PPEB *BasePeb)
Definition: procsup.c:500
Definition: mm.h:406
struct _MEMORY_AREA::@1781::@1782 SectionData
INT POOL_TYPE
Definition: typedefs.h:78
SWAPENTRY NTAPI MmAllocSwapPage(VOID)
Definition: pagefile.c:304
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:204
CSHORT Type
Definition: mm.h:200
NTSTATUS(* Trim)(ULONG Target, ULONG Priority, PULONG NrFreed)
Definition: mm.h:393
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:195
struct _MEMORY_AREA::@1781::@1783 VirtualMemoryData
struct _MMPAGING_FILE MMPAGING_FILE
BOOLEAN DeleteInProgress
Definition: mm.h:223
BOOLEAN NTAPI MmIsDisabledPage(struct _EPROCESS *Process, PVOID Address)
LARGE_INTEGER RawLength
Definition: mm.h:170
NTSTATUS NTAPI MmFreeMemoryArea(PMMSUPPORT AddressSpace, PMEMORY_AREA MemoryArea, PMM_FREE_PAGE_FUNC FreePage, PVOID FreePageContext)
Definition: marea.c:278
struct _ROS_SECTION_OBJECT * PROS_SECTION_OBJECT
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:1798
VOID NTAPI MmSetPageProtect(struct _EPROCESS *Process, PVOID Address, ULONG flProtect)
_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
#define _Inout_
Definition: no_sal2.h:162
PFN_NUMBER NTAPI MmAllocPage(ULONG Consumer)
Definition: freelist.c:569
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:1978
struct _MEMORY_AREA MEMORY_AREA
NTSTATUS NTAPI MmCreateMemoryArea(PMMSUPPORT AddressSpace, ULONG Type, PVOID *BaseAddress, SIZE_T Length, ULONG Protection, PMEMORY_AREA *Result, ULONG AllocationFlags, ULONG AllocationGranularity)
Definition: marea.c:410
ULONG NTAPI MmGetReferenceCountPage(PFN_NUMBER Page)
Definition: freelist.c:509
struct _MM_SECTION_SEGMENT * PMM_SECTION_SEGMENT
MMVAD VadNode
Definition: mm.h:218
ULONG Flags
Definition: mm.h:175
LIST_ENTRY MmLoadedUserImageList
Definition: sysldr.c:35
struct _MMFREE_POOL_ENTRY * Owner
Definition: mm.h:411
ULONG MmThrottleBottom
Definition: mminit.c:397
VOID NTAPI MmSetDirtyAllRmaps(PFN_NUMBER Page)
Definition: rmap.c:213
_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:420
unsigned __int64 ULONG64
Definition: imports.h:198
PVOID NTAPI MiMapPagesInZeroSpace(IN PMMPFN Pfn1, IN PFN_NUMBER NumberOfPages)
Definition: hypermap.c:113
VOID NTAPI MiUnmapPageInHyperSpace(IN PEPROCESS Process, IN PVOID Address, IN KIRQL OldIrql)
Definition: hypermap.c:93
_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:905
struct _MM_REGION MM_REGION
NTSTATUS NTAPI MmSetExecuteOptions(IN ULONG ExecuteOptions)
Definition: pagfault.c:2563
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:790
VOID NTAPI MmRemoveLRUUserPage(PFN_NUMBER Page)
Definition: freelist.c:116
#define NTSTATUS
Definition: precomp.h:20
#define VOID
Definition: acefi.h:82
Definition: mm.h:311
Definition: btrfs_drv.h:1922
KIRQL * PKIRQL
Definition: env_spec_w32.h:592
struct _MMFREE_POOL_ENTRY MMFREE_POOL_ENTRY
NTSTATUS NTAPI MmInitializeHandBuiltProcess2(IN PEPROCESS Process)
Definition: procsup.c:1148
VOID NTAPI MiInitBalancerThread(VOID)
Definition: balance.c:442
PMMPAGING_FILE MmPagingFile[MAX_PAGING_FILES]
Definition: pagefile.c:40
SIZE_T MmProcessCommit
Definition: freelist.c:33
Definition: typedefs.h:119
PFN_NUMBER NTAPI MmGetLRUFirstUserPage(VOID)
Definition: freelist.c:63
PEPROCESS HyperProcess
Definition: hypermap.c:23
ULONG ReferenceCount
Definition: mm.h:172
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:360
FORCEINLINE PMMPFN MiGetPfnEntry(IN PFN_NUMBER Pfn)
Definition: mm.h:939
#define P(row, col)
NTSTATUS ReadStatus
Definition: mm.h:318
PFN_NUMBER NTAPI MmGetLRUNextUserPage(PFN_NUMBER PreviousPage)
Definition: freelist.c:97
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:122
HANDLE FileHandle
Definition: mm.h:443
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
SIZE_T MmPagedPoolCommit
Definition: freelist.c:34
#define _In_
Definition: no_sal2.h:158
NTSTATUS NTAPI MmCreateVirtualMappingUnsafe(struct _EPROCESS *Process, PVOID Address, ULONG flProtect, PPFN_NUMBER Pages, ULONG PageCount)
ULONG_PTR SIZE_T
Definition: typedefs.h:80
Definition: compat.h:694
PFN_NUMBER CurrentUsage
Definition: mm.h:439
USHORT PageColor
Definition: mm.h:302
FORCEINLINE PMMSUPPORT MmGetKernelAddressSpace(VOID)
Definition: mm.h:1445
PFN_COUNT MmNumberOfPhysicalPages
Definition: init.c:48
PRTL_BITMAP Bitmap
Definition: mm.h:442
NTSTATUS NTAPI MmDeleteProcessAddressSpace(IN PEPROCESS Process)
NTSTATUS NTAPI MmDbgCopyMemory(IN ULONG64 Address, IN PVOID Buffer, IN ULONG Size, IN ULONG Flags)
Definition: mmdbg.c:124
struct _MM_REGION * PMM_REGION
NTSTATUS MmTrimUserMemory(ULONG Target, ULONG Priority, PULONG NrFreedPages)
Definition: balance.c:171
VOID NTAPI MiUnmapPagesInZeroSpace(IN PVOID VirtualAddress, IN PFN_NUMBER NumberOfPages)
Definition: hypermap.c:185
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:46
ULONG_PTR PteFrame
Definition: mm.h:356
struct _MMFREE_POOL_ENTRY * PMMFREE_POOL_ENTRY
PFN_COUNT MiUsedSwapPages
Definition: pagefile.c:52
PRTL_BITMAP EndOfPagedPoolBitmap
Definition: mm.h:421
PFN_NUMBER Total
Definition: mm.h:377
USHORT ShortFlags
Definition: mm.h:340
struct _MMPFN * PMMPFN
ULONG_PTR SWAPENTRY
Definition: mm.h:47
#define FORCEINLINE
Definition: wdftypes.h:67
NTSTATUS NTAPI MmSetMemoryPriorityProcess(IN PEPROCESS Process, IN UCHAR MemoryPriority)
Definition: procsup.c:469
_Out_ PKAPC_STATE ApcState
Definition: mm.h:1484
FORCEINLINE PEPROCESS MmGetAddressSpaceOwner(IN PMMSUPPORT AddressSpace)
Definition: mm.h:1430
FORCEINLINE PVOID MmCreateHyperspaceMapping(IN PFN_NUMBER Page)
Definition: mm.h:1027
_Must_inspect_result_ _In_ ULONG NewProtect
Definition: mmfuncs.h:682
ULONG SectionPageProtection
Definition: mm.h:203
USHORT Rom
Definition: mm.h:306
PMMPTE PteAddress
Definition: mm.h:324
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:1018
unsigned int * PULONG
Definition: retypes.h:1
ULONG_PTR EntireFrame
Definition: mm.h:353
#define NULL
Definition: types.h:112
MMPTE OriginalPte
Definition: mm.h:345
struct _MM_SECTION_SEGMENT MM_SECTION_SEGMENT
VOID NTAPI MmDeleteAllRmaps(PFN_NUMBER Page, PVOID Context, VOID(*DeleteMapping)(PVOID Context, struct _EPROCESS *Process, PVOID Address))
SWAPENTRY SwapEntry
Definition: mm.h:322
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
struct _MM_RMAP_ENTRY * Next
Definition: mm.h:244
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:1694
MM_DRIVER_VERIFIER_DATA MmVerifierData
Definition: drvmgmt.c:20
union _MMPFN::@1789 u4
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
ULONG WsIndex
Definition: mm.h:316
union _MMPFN::@1786 u3
enum _MI_PFN_USAGES MI_PFN_USAGES
FORCEINLINE VOID MmInitGlobalKernelPageDirectory(VOID)
Definition: mm.h:300
PFN_NUMBER Blink
Definition: mm.h:327
VOID NTAPI MmSetSavedSwapEntryPage(PFN_NUMBER Page, SWAPENTRY SavedSwapEntry)
Definition: freelist.c:454
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
NTSTATUS NTAPI MiCopyFromUserPage(PFN_NUMBER DestPage, const VOID *SrcAddress)
Definition: section.c:1044
NTSTATUS NTAPI MmProtectSectionView(PMMSUPPORT AddressSpace, PMEMORY_AREA MemoryArea, PVOID BaseAddress, SIZE_T Length, ULONG Protect, PULONG OldProtect)
Definition: section.c:2523
FAST_MUTEX Lock
Definition: mm.h:168
FORCEINLINE PFN_NUMBER MiGetPfnEntryIndex(IN PMMPFN Pfn1)
Definition: mm.h:959
struct tagContext Context
Definition: acpixf.h:1034
SECTION_IMAGE_INFORMATION ImageInformation
Definition: mm.h:192
PVOID MmLastUnloadedDrivers
Definition: sysldr.c:44
#define OUT
Definition: typedefs.h:40
_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:187
PFN_COUNT MiFreeSwapPages
Definition: pagefile.c:49
unsigned int ULONG
Definition: retypes.h:1
LIST_ENTRY RegionListEntry
Definition: mm.h:401
BOOLEAN NTAPI MmIsFileObjectAPagingFile(PFILE_OBJECT FileObject)
Definition: pagefile.c:105
Definition: mm.h:242
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:133
CSHORT Size
Definition: mm.h:201
ULONG NTAPI MmGetSessionId(IN PEPROCESS Process)
Definition: session.c:180
BOOLEAN NTAPI MmUseSpecialPool(IN SIZE_T NumberOfBytes, IN ULONG Tag)
ULONG AllocationAttributes
Definition: mm.h:204
struct _MM_MEMORY_CONSUMER MM_MEMORY_CONSUMER
_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
struct _MM_SECTION_SEGMENT::@1778 Image
ULONG PagesUsed
Definition: mm.h:391
VOID NTAPI MiInitializeNonPagedPool(VOID)
Definition: pool.c:276
ULONG PagedPoolHint
Definition: mm.h:425
PVOID Address
Definition: mm.h:246
ULONG_PTR InPageError
Definition: mm.h:357
LARGE_INTEGER ViewOffset
Definition: mm.h:231
BOOLEAN NTAPI MiRaisePoolQuota(IN POOL_TYPE PoolType, IN ULONG CurrentMaxQuota, OUT PULONG NewMaxQuota)
Definition: pool.c:1266
PVOID NTAPI MmCreateKernelStack(BOOLEAN GuiStack, UCHAR Node)
#define KeGetCurrentThread
Definition: hal.h:44
NTSTATUS NTAPI MmNotPresentFaultSectionView(PMMSUPPORT AddressSpace, MEMORY_AREA *MemoryArea, PVOID Address, BOOLEAN Locked)
Definition: section.c:1362
PMMPTE FirstPteForPagedPool
Definition: mm.h:422
KIRQL HyperIrql
Definition: hypermap.c:24
UCHAR MmDisablePagingExecutive
Definition: mminit.c:27
PMM_SECTION_SEGMENT Segment
Definition: mm.h:209
VOID NTAPI ExpCheckPoolAllocation(PVOID P, POOL_TYPE PoolType, ULONG Tag)
Definition: expool.c:288
MMPFNLIST MmFreePageListHead
Definition: pfnlist.c:42
VOID NTAPI MmInitializeRmapList(VOID)
Definition: rmap.c:39
VOID NTAPI MmReferencePage(PFN_NUMBER Page)
Definition: freelist.c:489
ULONG NTAPI MmGetSessionIdEx(IN PEPROCESS Process)
Definition: session.c:195
short CSHORT
Definition: umtypes.h:127
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS SourceAddress
Definition: iotypes.h:1110
SINGLE_LIST_ENTRY NextStackPfn
Definition: mm.h:319
VOID NTAPI MmInsertLRULastUserPage(PFN_NUMBER Page)
Definition: freelist.c:82
struct _MEMORY_AREA * MemoryArea
Definition: newmm.h:65
BOOLEAN NTAPI MmIsSpecialPoolAddress(IN PVOID P)
PVOID Vad
Definition: mm.h:225
NTSTATUS NTAPI MmInitializeHandBuiltProcess(IN PEPROCESS Process, IN PULONG_PTR DirectoryTableBase)
Definition: procsup.c:1123
#define APC_LEVEL
Definition: env_spec_w32.h:695
FORCEINLINE VOID MmLockAddressSpace(PMMSUPPORT AddressSpace)
Definition: mm.h:1416
BOOLEAN NTAPI MmIsDirtyPage(struct _EPROCESS *Process, PVOID Address)
ULONG Flags
Definition: mm.h:222
base of all file and directory entries
Definition: entries.h:82
FORCEINLINE PMMSUPPORT MmGetCurrentAddressSpace(VOID)
Definition: mm.h:1438
* PKAPC_STATE
Definition: ketypes.h:1280
LONG AweReferenceCount
Definition: mm.h:346
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:2819
SWAPENTRY NTAPI MmGetSavedSwapEntryPage(PFN_NUMBER Page)
Definition: freelist.c:470
PMMPDE NextPdeForPagedPoolExpansion
Definition: mm.h:424
SIZE_T MmDriverCommit
Definition: freelist.c:32
Definition: dlist.c:348
Definition: mm.h:375
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68