ReactOS  0.4.14-dev-114-gc8cbd56
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 #define MM_WAIT_ENTRY 0x7ffffc00
153 
154 #define InterlockedCompareExchangePte(PointerPte, Exchange, Comperand) \
155  InterlockedCompareExchange((PLONG)(PointerPte), Exchange, Comperand)
156 
157 #define InterlockedExchangePte(PointerPte, Value) \
158  InterlockedExchange((PLONG)(PointerPte), Value)
159 
160 typedef struct _MM_SECTION_SEGMENT
161 {
162  FAST_MUTEX Lock; /* lock which protects the page directory */
164  LARGE_INTEGER RawLength; /* length of the segment which is part of the mapped file */
165  LARGE_INTEGER Length; /* absolute length of the segment */
172 
173  struct
174  {
175  ULONGLONG FileOffset; /* start offset into the file for image sections */
176  ULONG_PTR VirtualAddress; /* start offset into the address range for image sections */
178  } Image;
179 
183 
185 {
191 
192 typedef struct _ROS_SECTION_OBJECT
193 {
200  union
201  {
204  };
206 
207 #define MA_GetStartingAddress(_MemoryArea) ((_MemoryArea)->VadNode.StartingVpn << PAGE_SHIFT)
208 #define MA_GetEndingAddress(_MemoryArea) (((_MemoryArea)->VadNode.EndingVpn + 1) << PAGE_SHIFT)
209 
210 typedef struct _MEMORY_AREA
211 {
213 
220  union
221  {
222  struct
223  {
228  } SectionData;
229  struct
230  {
233  } Data;
235 
236 typedef struct _MM_RMAP_ENTRY
237 {
241 #if DBG
242  PVOID Caller;
243 #endif
244 }
246 
247 #if MI_TRACE_PFNS
250 #define MI_SET_USAGE(x) MI_PFN_CURRENT_USAGE = x
251 #define MI_SET_PROCESS2(x) memcpy(MI_PFN_CURRENT_PROCESS_NAME, x, 16)
252 #else
253 #define MI_SET_USAGE(x)
254 #define MI_SET_PROCESS2(x)
255 #endif
256 
257 typedef enum _MI_PFN_USAGES
258 {
282 } MI_PFN_USAGES;
283 
284 //
285 // These two mappings are actually used by Windows itself, based on the ASSERTS
286 //
287 #define StartOfAllocation ReadInProgress
288 #define EndOfAllocation WriteInProgress
289 
290 typedef struct _MMPFNENTRY
291 {
293  USHORT ReadInProgress:1; // StartOfAllocation
294  USHORT WriteInProgress:1; // EndOfAllocation
302 } MMPFNENTRY;
303 
304 // Mm internal
305 typedef struct _MMPFN
306 {
307  union
308  {
314 
315  // HACK for ROSPFN
317  } u1;
319  union
320  {
323  } u2;
324  union
325  {
326  struct
327  {
330  };
331  struct
332  {
335  } e2;
336  } u3;
337  union
338  {
341 
342  // HACK for ROSPFN
344  };
345  union
346  {
348  struct
349  {
356  };
357  } u4;
358 #if MI_TRACE_PFNS
359  MI_PFN_USAGES PfnUsage;
360  CHAR ProcessName[16];
361 #endif
362 
363  // HACK until WS lists are supported
365 } MMPFN, *PMMPFN;
366 
367 extern PMMPFN MmPfnDatabase;
368 
369 typedef struct _MMPFNLIST
370 {
376 
382 
383 typedef struct _MM_MEMORY_CONSUMER
384 {
389 
390 typedef struct _MM_REGION
391 {
397 
398 // Mm internal
399 /* Entry describing free pool memory */
400 typedef struct _MMFREE_POOL_ENTRY
401 {
407 
408 /* Signature of a freed block */
409 #define MM_FREE_POOL_SIGNATURE 'ARM3'
410 
411 /* Paged pool information */
412 typedef struct _MM_PAGED_POOL_INFO
413 {
423 
425 
426 /* Page file information */
427 typedef struct _MMPAGING_FILE
428 {
438 }
440 
442 
443 typedef VOID
447  SIZE_T Length,
448  ULONG OldType,
449  ULONG OldProtect,
450  ULONG NewType,
452 );
453 
454 typedef VOID
456  PVOID Context,
458  PVOID Address,
459  PFN_NUMBER Page,
460  SWAPENTRY SwapEntry,
461  BOOLEAN Dirty
462 );
463 
464 //
465 // Mm copy support for Kd
466 //
467 NTSTATUS
468 NTAPI
471  IN PVOID Buffer,
472  IN ULONG Size,
473  IN ULONG Flags
474 );
475 
476 //
477 // Determines if a given address is a session address
478 //
479 BOOLEAN
480 NTAPI
483 );
484 
485 ULONG
486 NTAPI
489 );
490 
491 ULONG
492 NTAPI
495 );
496 
497 /* marea.c *******************************************************************/
498 
499 NTSTATUS
500 NTAPI
503  ULONG Type,
505  SIZE_T Length,
506  ULONG Protection,
508  ULONG AllocationFlags,
509  ULONG AllocationGranularity
510 );
511 
513 NTAPI
516  PVOID Address
517 );
518 
519 NTSTATUS
520 NTAPI
525  PVOID FreePageContext
526 );
527 
528 VOID
529 NTAPI
532  PMMVAD Vad);
533 
535 NTAPI
538  PVOID Address,
539  SIZE_T Length
540 );
541 
542 PVOID
543 NTAPI
544 MmFindGap(
546  SIZE_T Length,
547  ULONG_PTR Granularity,
548  BOOLEAN TopDown
549 );
550 
551 VOID
552 NTAPI
555 
556 VOID
557 NTAPI
559 
560 /* npool.c *******************************************************************/
561 
562 INIT_FUNCTION
563 VOID
564 NTAPI
566 
567 PVOID
568 NTAPI
571  IN SIZE_T SizeInBytes
572 );
573 
574 POOL_TYPE
575 NTAPI
578 );
579 
580 ULONG
581 NTAPI
583  IN PVOID StartingAddress
584 );
585 
586 /* pool.c *******************************************************************/
587 
588 BOOLEAN
589 NTAPI
592  IN ULONG CurrentMaxQuota,
593  OUT PULONG NewMaxQuota
594 );
595 
596 /* mdl.c *********************************************************************/
597 
598 VOID
599 NTAPI
601  PMDL Mdl,
602  PPFN_NUMBER Pages
603 );
604 
605 /* mminit.c ******************************************************************/
606 
607 VOID
608 NTAPI
609 MmInit1(
610  VOID
611 );
612 
613 INIT_FUNCTION
614 BOOLEAN
615 NTAPI
616 MmInitSystem(IN ULONG Phase,
617  IN PLOADER_PARAMETER_BLOCK LoaderBlock);
618 
619 
620 /* pagefile.c ****************************************************************/
621 
622 SWAPENTRY
623 NTAPI
625 
626 VOID
627 NTAPI
629 
630 INIT_FUNCTION
631 VOID
632 NTAPI
634 
635 BOOLEAN
636 NTAPI
638 
639 NTSTATUS
640 NTAPI
642  SWAPENTRY SwapEntry,
643  PFN_NUMBER Page
644 );
645 
646 NTSTATUS
647 NTAPI
649  SWAPENTRY SwapEntry,
650  PFN_NUMBER Page
651 );
652 
653 VOID
654 NTAPI
656 
657 NTSTATUS
658 NTAPI
660  _In_ PFN_NUMBER Page,
661  _In_ ULONG PageFileIndex,
662  _In_ ULONG_PTR PageFileOffset);
663 
664 /* process.c ****************************************************************/
665 
666 NTSTATUS
667 NTAPI
670  IN PEPROCESS Clone OPTIONAL,
671  IN PVOID Section OPTIONAL,
672  IN OUT PULONG Flags,
674 );
675 
676 NTSTATUS
677 NTAPI
680  IN PINITIAL_PEB InitialPeb,
681  OUT PPEB *BasePeb
682 );
683 
684 NTSTATUS
685 NTAPI
689  IN PINITIAL_TEB InitialTeb,
690  OUT PTEB* BaseTeb
691 );
692 
693 VOID
694 NTAPI
696  struct _EPROCESS *Process,
697  PTEB Teb
698 );
699 
700 VOID
701 NTAPI
703 
704 NTSTATUS
705 NTAPI
707 
708 ULONG
709 NTAPI
711 
712 NTSTATUS
713 NTAPI
716  IN UCHAR MemoryPriority
717 );
718 
719 /* i386/pfault.c *************************************************************/
720 
721 NTSTATUS
722 NTAPI
724  ULONG Cs,
725  PULONG Eip,
726  PULONG Eax,
727  ULONG Cr2,
729 );
730 
731 /* special.c *****************************************************************/
732 
733 VOID
734 NTAPI
736 
737 BOOLEAN
738 NTAPI
741  IN ULONG Tag);
742 
743 BOOLEAN
744 NTAPI
746  IN PVOID P);
747 
748 BOOLEAN
749 NTAPI
751  IN PVOID P);
752 
753 PVOID
754 NTAPI
757  IN ULONG Tag,
759  IN ULONG SpecialType);
760 
761 VOID
762 NTAPI
764  IN PVOID P);
765 
766 /* mm.c **********************************************************************/
767 
768 NTSTATUS
769 NTAPI
771  IN ULONG FaultCode,
772  IN PVOID Address,
774  IN PVOID TrapInformation
775 );
776 
777 /* kmap.c ********************************************************************/
778 
779 NTSTATUS
780 NTAPI
782  PFN_NUMBER DestPage,
783  const VOID *SrcAddress
784 );
785 
786 /* process.c *****************************************************************/
787 
788 PVOID
789 NTAPI
791 
792 VOID
793 NTAPI
795  BOOLEAN GuiStack);
796 
797 /* balance.c *****************************************************************/
798 
799 INIT_FUNCTION
800 VOID
801 NTAPI
803  ULONG Consumer,
804  NTSTATUS (*Trim)(ULONG Target, ULONG Priority, PULONG NrFreed)
805 );
806 
807 INIT_FUNCTION
808 VOID
809 NTAPI
811  ULONG NrAvailablePages,
812  ULONG NrSystemPages
813 );
814 
815 NTSTATUS
816 NTAPI
818  ULONG Consumer,
819  PFN_NUMBER Page
820 );
821 
822 NTSTATUS
823 NTAPI
825  ULONG Consumer,
826  BOOLEAN MyWait,
827  PPFN_NUMBER AllocatedPage
828 );
829 
830 INIT_FUNCTION
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 INIT_FUNCTION
877 VOID
878 NTAPI
880 
881 VOID
882 NTAPI
884 
885 VOID
886 NTAPI
888 
889 BOOLEAN
890 NTAPI
892 
893 NTSTATUS
894 NTAPI
896 
897 /* freelist.c **********************************************************/
898 
900 KIRQL
902 {
904 }
905 
907 VOID
910 {
912 }
913 
915 VOID
917 {
918  PKSPIN_LOCK_QUEUE LockQueue;
919 
921  LockQueue = &KeGetCurrentPrcb()->LockQueue[LockQueuePfnLock];
923 }
924 
926 VOID
928 {
929  PKSPIN_LOCK_QUEUE LockQueue;
930 
931  LockQueue = &KeGetCurrentPrcb()->LockQueue[LockQueuePfnLock];
934 }
935 
936 #define MI_ASSERT_PFN_LOCK_HELD() ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL)
937 
939 PMMPFN
941 {
942  PMMPFN Page;
943  extern RTL_BITMAP MiPfnBitMap;
944 
945  /* Make sure the PFN number is valid */
946  if (Pfn > MmHighestPhysicalPage) return NULL;
947 
948  /* Make sure this page actually has a PFN entry */
949  if ((MiPfnBitMap.Buffer) && !(RtlTestBit(&MiPfnBitMap, (ULONG)Pfn))) return NULL;
950 
951  /* Get the entry */
952  Page = &MmPfnDatabase[Pfn];
953 
954  /* Return it */
955  return Page;
956 };
957 
961 {
962  //
963  // This will return the Page Frame Number (PFN) from the MMPFN
964  //
965  return Pfn1 - MmPfnDatabase;
966 }
967 
969 NTAPI
970 MmGetLRUNextUserPage(PFN_NUMBER PreviousPage);
971 
973 NTAPI
975 
976 VOID
977 NTAPI
979 
980 VOID
981 NTAPI
983 
984 VOID
985 NTAPI
987  IN BOOLEAN StatusOnly
988 );
989 
990 VOID
991 NTAPI
993  VOID
994 );
995 
996 /* hypermap.c *****************************************************************/
997 
998 extern PEPROCESS HyperProcess;
999 extern KIRQL HyperIrql;
1000 
1001 PVOID
1002 NTAPI
1004  IN PFN_NUMBER Page,
1005  IN PKIRQL OldIrql);
1006 
1007 VOID
1008 NTAPI
1010  IN PVOID Address,
1011  IN KIRQL OldIrql);
1012 
1013 PVOID
1014 NTAPI
1016  IN PFN_NUMBER NumberOfPages);
1017 
1018 VOID
1019 NTAPI
1021  IN PFN_NUMBER NumberOfPages);
1022 
1023 //
1024 // ReactOS Compatibility Layer
1025 //
1027 PVOID
1029 {
1030  HyperProcess = (PEPROCESS)KeGetCurrentThread()->ApcState.Process;
1032 }
1033 
1034 #define MmDeleteHyperspaceMapping(x) MiUnmapPageInHyperSpace(HyperProcess, x, HyperIrql);
1035 
1036 /* i386/page.c *********************************************************/
1037 
1038 NTSTATUS
1039 NTAPI
1041  struct _EPROCESS* Process,
1042  PVOID Address,
1043  ULONG flProtect,
1044  PPFN_NUMBER Pages,
1045  ULONG PageCount
1046 );
1047 
1048 NTSTATUS
1049 NTAPI
1051  struct _EPROCESS* Process,
1052  PVOID Address,
1053  ULONG flProtect,
1054  PPFN_NUMBER Pages,
1055  ULONG PageCount
1056 );
1057 
1058 ULONG
1059 NTAPI
1061  struct _EPROCESS* Process,
1062  PVOID Address);
1063 
1064 VOID
1065 NTAPI
1067  struct _EPROCESS* Process,
1068  PVOID Address,
1069  ULONG flProtect
1070 );
1071 
1072 BOOLEAN
1073 NTAPI
1075  struct _EPROCESS* Process,
1076  PVOID Address
1077 );
1078 
1079 BOOLEAN
1080 NTAPI
1082  struct _EPROCESS* Process,
1083  PVOID Address
1084 );
1085 
1086 INIT_FUNCTION
1087 VOID
1088 NTAPI
1090 
1091 VOID
1092 NTAPI
1094  struct _EPROCESS *Process,
1095  PVOID Address,
1096  SWAPENTRY* SwapEntry);
1097 
1098 VOID
1099 NTAPI
1101  struct _EPROCESS *Process,
1102  PVOID Address,
1103  SWAPENTRY* SwapEntry
1104 );
1105 
1106 NTSTATUS
1107 NTAPI
1109  struct _EPROCESS *Process,
1110  PVOID Address,
1111  SWAPENTRY SwapEntry
1112 );
1113 
1114 BOOLEAN
1115 NTAPI
1117  struct _EPROCESS *Process,
1118  PVOID Address
1119 );
1120 
1121 VOID
1122 NTAPI
1124  struct _EPROCESS *Process,
1125  PVOID Address
1126 );
1127 
1128 PFN_NUMBER
1129 NTAPI
1130 MmAllocPage(
1131  ULONG Consumer
1132 );
1133 
1134 VOID
1135 NTAPI
1137 
1138 VOID
1139 NTAPI
1141 
1142 ULONG
1143 NTAPI
1145 
1146 BOOLEAN
1147 NTAPI
1149 
1150 VOID
1151 NTAPI
1153  PFN_NUMBER Page,
1154  SWAPENTRY SavedSwapEntry);
1155 
1156 SWAPENTRY
1157 NTAPI
1159 
1160 VOID
1161 NTAPI
1163  struct _EPROCESS *Process,
1164  PVOID Address
1165 );
1166 
1167 VOID
1168 NTAPI
1170  struct _EPROCESS *Process,
1171  PVOID Address
1172 );
1173 
1174 PFN_NUMBER
1175 NTAPI
1177  struct _EPROCESS *Process,
1178  PVOID Address
1179 );
1180 
1181 BOOLEAN
1182 NTAPI
1184  IN ULONG MinWs,
1185  IN PEPROCESS Dest,
1186  IN PULONG_PTR DirectoryTableBase
1187 );
1188 
1189 INIT_FUNCTION
1190 NTSTATUS
1191 NTAPI
1194  IN PULONG_PTR DirectoryTableBase
1195 );
1196 
1197 INIT_FUNCTION
1198 NTSTATUS
1199 NTAPI
1202 );
1203 
1204 NTSTATUS
1205 NTAPI
1206 MmSetExecuteOptions(IN ULONG ExecuteOptions);
1207 
1208 NTSTATUS
1209 NTAPI
1210 MmGetExecuteOptions(IN PULONG ExecuteOptions);
1211 
1212 VOID
1213 NTAPI
1215  struct _EPROCESS *Process,
1216  PVOID Address,
1217  BOOLEAN* WasDirty,
1218  PPFN_NUMBER Page
1219 );
1220 
1221 BOOLEAN
1222 NTAPI
1224  struct _EPROCESS *Process,
1225  PVOID Address
1226 );
1227 
1228 /* wset.c ********************************************************************/
1229 
1230 NTSTATUS
1232  ULONG Target,
1233  ULONG Priority,
1234  PULONG NrFreedPages
1235 );
1236 
1237 /* region.c ************************************************************/
1238 
1239 NTSTATUS
1240 NTAPI
1244  PLIST_ENTRY RegionListHead,
1245  PVOID StartAddress,
1246  SIZE_T Length,
1247  ULONG NewType,
1248  ULONG NewProtect,
1249  PMM_ALTER_REGION_FUNC AlterFunc
1250 );
1251 
1252 VOID
1253 NTAPI
1255  PLIST_ENTRY RegionListHead,
1256  SIZE_T Length,
1257  ULONG Type,
1258  ULONG Protect
1259 );
1260 
1261 PMM_REGION
1262 NTAPI
1263 MmFindRegion(
1265  PLIST_ENTRY RegionListHead,
1266  PVOID Address,
1267  PVOID* RegionBaseAddress
1268 );
1269 
1270 /* section.c *****************************************************************/
1271 
1272 VOID
1273 NTAPI
1275  OUT PSECTION_IMAGE_INFORMATION ImageInformation
1276 );
1277 
1279 NTAPI
1281  IN PVOID Section
1282 );
1283 NTSTATUS
1284 NTAPI
1286  IN PVOID Address,
1288 );
1289 
1290 NTSTATUS
1291 NTAPI
1293  IN PVOID Section,
1295 );
1296 
1297 NTSTATUS
1298 NTAPI
1301  PVOID Address,
1304 );
1305 
1306 NTSTATUS
1307 NTAPI
1312  SIZE_T Length,
1313  ULONG Protect,
1314  PULONG OldProtect
1315 );
1316 
1317 INIT_FUNCTION
1318 NTSTATUS
1319 NTAPI
1321 
1322 NTSTATUS
1323 NTAPI
1327  PVOID Address,
1328  BOOLEAN Locked
1329 );
1330 
1331 NTSTATUS
1332 NTAPI
1336  PVOID Address,
1338 );
1339 
1340 INIT_FUNCTION
1341 NTSTATUS
1342 NTAPI
1344 
1345 NTSTATUS
1346 NTAPI
1350  PVOID Address
1351 );
1352 
1353 VOID
1354 NTAPI
1356 
1357 /* sysldr.c ******************************************************************/
1358 
1359 INIT_FUNCTION
1360 VOID
1361 NTAPI
1363  IN PLOADER_PARAMETER_BLOCK LoaderBlock
1364 );
1365 
1366 INIT_FUNCTION
1367 BOOLEAN
1368 NTAPI
1370  IN PLOADER_PARAMETER_BLOCK LoaderBlock
1371 );
1372 
1373 BOOLEAN
1374 NTAPI
1376 
1377 VOID
1378 NTAPI
1380 
1381 NTSTATUS
1382 NTAPI
1385  IN PUNICODE_STRING NamePrefix OPTIONAL,
1386  IN PUNICODE_STRING LoadedName OPTIONAL,
1387  IN ULONG Flags,
1388  OUT PVOID *ModuleObject,
1389  OUT PVOID *ImageBaseAddress
1390 );
1391 
1392 NTSTATUS
1393 NTAPI
1395  IN PVOID ImageHandle
1396 );
1397 
1398 NTSTATUS
1399 NTAPI
1401  IN HANDLE ImageHandle,
1402  IN BOOLEAN PurgeSection
1403 );
1404 
1405 NTSTATUS
1406 NTAPI
1408  IN PLDR_DATA_TABLE_ENTRY LdrEntry,
1409  IN PLIST_ENTRY ListHead
1410 );
1411 
1412 
1413 /* procsup.c *****************************************************************/
1414 
1415 NTSTATUS
1416 NTAPI
1418  IN PVOID StackPointer
1419 );
1420 
1421 
1423 VOID
1425 {
1426  KeAcquireGuardedMutex(&CONTAINING_RECORD(AddressSpace, EPROCESS, Vm)->AddressCreationLock);
1427 }
1428 
1430 VOID
1432 {
1433  KeReleaseGuardedMutex(&CONTAINING_RECORD(AddressSpace, EPROCESS, Vm)->AddressCreationLock);
1434 }
1435 
1437 PEPROCESS
1439 {
1440  if (AddressSpace == MmKernelAddressSpace) return NULL;
1442 }
1443 
1445 PMMSUPPORT
1447 {
1448  return &((PEPROCESS)KeGetCurrentThread()->ApcState.Process)->Vm;
1449 }
1450 
1452 PMMSUPPORT
1454 {
1455  return MmKernelAddressSpace;
1456 }
1457 
1458 
1459 /* expool.c ******************************************************************/
1460 
1461 VOID
1462 NTAPI
1464  PVOID P,
1466  ULONG Tag);
1467 
1468 VOID
1469 NTAPI
1471  IN PVOID P);
1472 
1473 
1474 /* mmsup.c *****************************************************************/
1475 
1476 NTSTATUS
1477 NTAPI
1479  IN SIZE_T WorkingSetMinimumInBytes,
1480  IN SIZE_T WorkingSetMaximumInBytes,
1481  IN ULONG SystemCache,
1482  IN BOOLEAN IncreaseOkay);
1483 
1484 
1485 /* session.c *****************************************************************/
1486 
1488 NTSTATUS
1489 NTAPI
1490 MmAttachSession(
1491  _Inout_ PVOID SessionEntry,
1493 
1495 VOID
1496 NTAPI
1497 MmDetachSession(
1498  _Inout_ PVOID SessionEntry,
1500 
1501 VOID
1502 NTAPI
1504  _Inout_ PVOID SessionEntry);
1505 
1506 PVOID
1507 NTAPI
1509  _In_ ULONG SessionId);
1510 
1512 VOID
1513 NTAPI
1514 MmSetSessionLocaleId(
1515  _In_ LCID LocaleId);
1516 
1517 /* shutdown.c *****************************************************************/
1518 
1519 VOID
1520 MmShutdownSystem(IN ULONG Phase);
1521 
1522 /* virtual.c *****************************************************************/
1523 
1524 NTSTATUS
1525 NTAPI
1526 MmCopyVirtualMemory(IN PEPROCESS SourceProcess,
1528  IN PEPROCESS TargetProcess,
1532  OUT PSIZE_T ReturnSize);
1533 
VOID NTAPI MmDereferencePage(PFN_NUMBER Page)
Definition: freelist.c:537
VOID NTAPI MmSetCleanAllRmaps(PFN_NUMBER Page)
Definition: rmap.c:195
IN CINT OUT PVOID IN ULONG OUT PULONG ResultLength
Definition: conport.c:47
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
NTSTATUS NTAPI MmAccessFaultSectionView(PMMSUPPORT AddressSpace, MEMORY_AREA *MemoryArea, PVOID Address)
Definition: section.c:1797
VOID FASTCALL KeReleaseQueuedSpinLockFromDpcLevel(IN OUT PKSPIN_LOCK_QUEUE LockQueue)
PRTL_BITMAP PagedPoolAllocationMap
Definition: mm.h:414
PULONG Buffer
Definition: typedefs.h:89
ULONG_PTR VirtualAddress
Definition: mm.h:176
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:170
PFN_NUMBER MmResidentAvailablePages
Definition: freelist.c:27
#define IN
Definition: typedefs.h:38
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:1242
PEPROCESS Process
Definition: mm.h:239
MM_MEMORY_CONSUMER MiMemoryConsumers[MC_MAXIMUM]
Definition: balance.c:36
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
union _MMPFN::@1732 u1
INIT_FUNCTION NTSTATUS NTAPI MmInitSectionImplementation(VOID)
Definition: section.c:2806
LARGE_INTEGER MaximumSize
Definition: mm.h:196
VOID(* PMM_ALTER_REGION_FUNC)(PMMSUPPORT AddressSpace, PVOID BaseAddress, SIZE_T Length, ULONG OldType, ULONG OldProtect, ULONG NewType, ULONG NewProtect)
Definition: mm.h:444
VOID NTAPI MmFreeSectionSegments(PFILE_OBJECT FileObject)
Definition: section.c:807
ULONG Type
Definition: mm.h:214
ULONG MI_PFN_CURRENT_USAGE
Definition: pfnlist.c:63
struct _MEMORY_AREA * PMEMORY_AREA
Type
Definition: Type.h:6
INIT_FUNCTION VOID NTAPI MiInitializeNonPagedPool(VOID)
Definition: pool.c:276
_In_ ULONG Mode
Definition: hubbusif.h:303
ULONG Characteristics
Definition: mm.h:177
Definition: ntbasedef.h:635
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:293
struct _MM_RMAP_ENTRY *NTAPI MmGetRmapListHeadPage(PFN_NUMBER Page)
Definition: freelist.c:427
VOID NTAPI MmDumpArmPfnDatabase(IN BOOLEAN StatusOnly)
Definition: mminit.c:1474
ULONG_PTR AweAllocation
Definition: mm.h:353
ULONG Signature
Definition: mm.h:404
LIST_ENTRY ListOfSegments
Definition: mm.h:180
ULONG PagesTarget
Definition: mm.h:386
VOID NTAPI MmDeleteRmap(PFN_NUMBER Page, struct _EPROCESS *Process, PVOID Address)
INIT_FUNCTION BOOLEAN NTAPI MmInitSystem(IN ULONG Phase, IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: mminit.c:199
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG AddressSpace
Definition: iofuncs.h:2268
VOID NTAPI MmDeleteKernelStack(PVOID Stack, BOOLEAN GuiStack)
VOID MmShutdownSystem(IN ULONG Phase)
Definition: shutdown.c:41
MMLISTS ListName
Definition: mm.h:372
char CHAR
Definition: xmlstorage.h:175
FORCEINLINE VOID MmUnlockAddressSpace(PMMSUPPORT AddressSpace)
Definition: mm.h:1431
VOID NTAPI MmBuildMdlFromPages(PMDL Mdl, PPFN_NUMBER Pages)
Definition: pagefile.c:98
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:343
struct _MM_PAGED_POOL_INFO MM_PAGED_POOL_INFO
Definition: mm.h:390
INIT_FUNCTION NTSTATUS NTAPI MmInitializeHandBuiltProcess(IN PEPROCESS Process, IN PULONG_PTR DirectoryTableBase)
Definition: procsup.c:1033
struct _MM_RMAP_ENTRY MM_RMAP_ENTRY
LONG NTSTATUS
Definition: precomp.h:26
PFN_NUMBER Size
Definition: mm.h:429
NTSTATUS NTAPI MiReadPageFile(_In_ PFN_NUMBER Page, _In_ ULONG PageFileIndex, _In_ ULONG_PTR PageFileOffset)
Definition: pagefile.c:201
PVOID NTAPI MmGetSessionById(_In_ ULONG SessionId)
Definition: session.c:1045
BOOLEAN NTAPI MmIsSessionAddress(IN PVOID Address)
Definition: session.c:49
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1062
PFN_NUMBER Flink
Definition: mm.h:309
struct _EPROCESS * PEPROCESS
Definition: nt_native.h:30
_In_ KPRIORITY Priority
Definition: kefuncs.h:516
LIST_ENTRY RegionListHead
Definition: mm.h:227
NTSTATUS NTAPI MmReleasePageMemoryConsumer(ULONG Consumer, PFN_NUMBER Page)
Definition: balance.c:97
SIZE_T MmSharedCommit
Definition: freelist.c:31
BOOLEAN NTAPI MmIsDirtyPageRmap(PFN_NUMBER Page)
Definition: rmap.c:239
NTSTATUS NTAPI MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN MyWait, PPFN_NUMBER AllocatedPage)
Definition: balance.c:229
FORCEINLINE KIRQL MiAcquirePfnLock(VOID)
Definition: mm.h:901
VOID(* PMM_FREE_PAGE_FUNC)(PVOID Context, PMEMORY_AREA MemoryArea, PVOID Address, PFN_NUMBER Page, SWAPENTRY SwapEntry, BOOLEAN Dirty)
Definition: mm.h:455
USHORT Modified
Definition: mm.h:292
PMM_SECTION_SEGMENT Segment
Definition: mm.h:226
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)
struct _MM_SECTION_SEGMENT::@1726 Image
PVOID MmTriageActionTaken
Definition: drvmgmt.c:27
USHORT RemovalRequested
Definition: mm.h:298
PVOID MmUnloadedDrivers
Definition: sysldr.c:43
INIT_FUNCTION VOID NTAPI MiInitBalancerThread(VOID)
Definition: balance.c:449
DWORD LCID
Definition: nls.h:13
PFILE_OBJECT FileObject
Definition: mm.h:434
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:1264
ULONG CacheCount
Definition: mm.h:167
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:194
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:328
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:908
struct TraceInfo Info
USHORT PageLocation
Definition: mm.h:297
PMMPFN MmPfnDatabase
Definition: freelist.c:24
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER _Outptr_ PVOID * TargetAddress
Definition: iotypes.h:998
struct _MM_IMAGE_SECTION_OBJECT MM_IMAGE_SECTION_OBJECT
PFN_NUMBER Flink
Definition: mm.h:373
enum _MMLISTS MMLISTS
FORCEINLINE VOID MiReleasePfnLockFromDpcLevel(VOID)
Definition: mm.h:927
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:63
INIT_FUNCTION NTSTATUS NTAPI MmCreatePhysicalMemorySection(VOID)
Definition: section.c:2755
VOID NTAPI MmMakeKernelResourceSectionWritable(VOID)
Definition: sysldr.c:2317
FORCEINLINE VOID MiAcquirePfnLockAtDpcLevel(VOID)
Definition: mm.h:916
MMWSLE Wsle
Definition: mm.h:364
USHORT PrototypePte
Definition: mm.h:295
PMM_IMAGE_SECTION_OBJECT ImageSection
Definition: mm.h:202
UCHAR KIRQL
Definition: env_spec_w32.h:591
MMPFNENTRY e1
Definition: mm.h:329
ULONG * PPFN_NUMBER
Definition: ke.h:8
ULONG Magic
Definition: mm.h:218
NTSTATUS NTAPI MmQuerySectionView(PMEMORY_AREA MemoryArea, PVOID Address, PMEMORY_BASIC_INFORMATION Info, PSIZE_T ResultLength)
Definition: section.c:2561
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
BOOLEAN NTAPI MmIsPagePresent(struct _EPROCESS *Process, PVOID Address)
USHORT CacheAttribute
Definition: mm.h:299
#define MC_MAXIMUM
Definition: mm.h:96
VOID NTAPI MmZeroPageThread(VOID)
Definition: zeropage.c:37
RTL_BITMAP MiPfnBitMap
Definition: init.c:44
ULONG PFN_NUMBER
Definition: ke.h:8
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:355
ULONG_PTR * PSIZE_T
Definition: typedefs.h:78
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
PMMPTE LastPteForPagedPool
Definition: mm.h:417
ULONG Type
Definition: mm.h:392
struct _MM_MEMORY_CONSUMER * PMM_MEMORY_CONSUMER
struct _MMPFNLIST * PMMPFNLIST
ULONG_PTR ShareCount
Definition: mm.h:322
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:168
INIT_FUNCTION BOOLEAN NTAPI MiInitializeLoadedModuleList(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: sysldr.c:2197
VOID NTAPI MmRebalanceMemoryConsumers(VOID)
Definition: balance.c:218
long LONG
Definition: pedump.c:60
USHORT ParityError
Definition: mm.h:301
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:374
PKEVENT Event
Definition: mm.h:311
BOOLEAN NTAPI MmChangeKernelResourceSectionProtection(IN ULONG_PTR ProtectionMask)
Definition: sysldr.c:2286
union _MEMORY_AREA::@1729 Data
PMMSUPPORT MmKernelAddressSpace
Definition: mminit.c:29
struct _MM_RMAP_ENTRY * PMM_RMAP_ENTRY
LIST_ENTRY List
Definition: mm.h:402
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:171
VOID NTAPI MmSetCleanPage(struct _EPROCESS *Process, PVOID Address)
unsigned char BOOLEAN
SIZE_T AllocatedPagedPool
Definition: mm.h:421
SIZE_T MmPeakCommitment
Definition: freelist.c:35
smooth NULL
Definition: ftsmooth.c:416
ULONG Protect
Definition: mm.h:215
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:352
SIZE_T Length
Definition: mm.h:394
#define FORCEINLINE
Definition: ntbasedef.h:221
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define _Out_
Definition: no_sal2.h:323
NTSTATUS NTAPI MmPageOutPhysicalAddress(PFN_NUMBER Page)
Definition: rmap.c:57
Definition: bufpool.h:45
ROS_SECTION_OBJECT * Section
Definition: mm.h:224
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:1025
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
NTSTATUS NTAPI MmGrowKernelStack(IN PVOID StackPointer)
Definition: procsup.c:459
SIZE_T PagedPoolCommit
Definition: mm.h:420
PFN_NUMBER MaximumSize
Definition: mm.h:430
PFN_NUMBER MinimumSize
Definition: mm.h:431
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
PFILE_OBJECT FileObject
Definition: mm.h:163
UNICODE_STRING PageFileName
Definition: mm.h:435
struct _MEMORY_AREA::@1729::@1731 VirtualMemoryData
struct _MM_IMAGE_SECTION_OBJECT * PMM_IMAGE_SECTION_OBJECT
_IRQL_requires_max_(APC_LEVEL) NTSTATUS NTAPI MmAttachSession(_Inout_ PVOID SessionEntry
ULONG Protect
Definition: mm.h:393
USHORT WriteInProgress
Definition: mm.h:294
NTSTATUS NTAPI MmCheckSystemImage(IN HANDLE ImageHandle, IN BOOLEAN PurgeSection)
Definition: sysldr.c:2691
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:165
PMMPTE MmDebugPte
Definition: mmdbg.c:33
ULONGLONG FileOffset
Definition: mm.h:175
FAST_MUTEX
Definition: extypes.h:17
BOOLEAN NTAPI MmIsSpecialPoolAddressFree(IN PVOID P)
PFN_COUNT Size
Definition: mm.h:403
VOID NTAPI MmCleanProcessAddressSpace(IN PEPROCESS Process)
Definition: procsup.c:1235
INIT_FUNCTION VOID NTAPI MmInitializeRmapList(VOID)
Definition: rmap.c:43
struct _MMPFN::@1734::@1740 e2
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
struct _ROS_SECTION_OBJECT ROS_SECTION_OBJECT
INIT_FUNCTION VOID NTAPI MmInitializeMemoryConsumer(ULONG Consumer, NTSTATUS(*Trim)(ULONG Target, ULONG Priority, PULONG NrFreed))
Definition: balance.c:82
union _MMPFN::@1734 u3
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
VOID NTAPI MiInitializeSpecialPool(VOID)
Definition: special.c:123
INIT_FUNCTION NTSTATUS NTAPI MmInitializeHandBuiltProcess2(IN PEPROCESS Process)
Definition: procsup.c:1058
_MI_PFN_USAGES
Definition: mm.h:257
POOL_TYPE NTAPI MmDeterminePoolType(IN PVOID VirtualAddress)
Definition: pool.c:406
_Out_ PCLIENT_ID ClientId
Definition: kefuncs.h:1176
PFILE_OBJECT FileObject
Definition: mm.h:199
INIT_FUNCTION VOID NTAPI MmInitPagingFile(VOID)
Definition: pagefile.c:259
PFN_NUMBER FreeSpace
Definition: mm.h:432
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:400
INT POOL_TYPE
Definition: typedefs.h:76
SWAPENTRY NTAPI MmAllocSwapPage(VOID)
Definition: pagefile.c:308
uint64_t ULONGLONG
Definition: typedefs.h:65
PVOID MiDebugMapping
Definition: mmdbg.c:32
CSHORT Type
Definition: mm.h:194
NTSTATUS(* Trim)(ULONG Target, ULONG Priority, PULONG NrFreed)
Definition: mm.h:387
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:189
struct _MMPAGING_FILE MMPAGING_FILE
BOOLEAN DeleteInProgress
Definition: mm.h:217
BOOLEAN NTAPI MmIsDisabledPage(struct _EPROCESS *Process, PVOID Address)
LARGE_INTEGER RawLength
Definition: mm.h:164
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
#define BufferSize
Definition: classpnp.h:419
PVOID KernelVerifier
Definition: drvmgmt.c:28
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:1806
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:244
PFN_NUMBER NTAPI MmAllocPage(ULONG Consumer)
Definition: freelist.c:569
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
VOID NTAPI MiRosCheckMemoryAreas(PMMSUPPORT AddressSpace)
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
_Must_inspect_result_ typedef _In_ ULONG _In_ BOOLEAN Target
Definition: iotypes.h:1068
BOOLEAN NTAPI MmIsPageSwapEntry(struct _EPROCESS *Process, PVOID Address)
* PFILE_OBJECT
Definition: iotypes.h:1955
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:212
ULONG Flags
Definition: mm.h:169
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
LIST_ENTRY MmLoadedUserImageList
Definition: sysldr.c:35
struct _MMFREE_POOL_ENTRY * Owner
Definition: mm.h:405
ULONG MmThrottleBottom
Definition: mminit.c:397
VOID NTAPI MmSetDirtyAllRmaps(PFN_NUMBER Page)
Definition: rmap.c:217
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
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:803
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:305
Definition: btrfs_drv.h:1780
KIRQL * PKIRQL
Definition: env_spec_w32.h:592
struct _MMFREE_POOL_ENTRY MMFREE_POOL_ENTRY
PMMPAGING_FILE MmPagingFile[MAX_PAGING_FILES]
Definition: pagefile.c:44
SIZE_T MmProcessCommit
Definition: freelist.c:33
Definition: typedefs.h:117
PFN_NUMBER NTAPI MmGetLRUFirstUserPage(VOID)
Definition: freelist.c:63
_In_ ULONG _In_ BOOLEAN _Must_inspect_result_ PVOID * VirtualAddress
Definition: ndis.h:3791
PEPROCESS HyperProcess
Definition: hypermap.c:23
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
ULONG ReferenceCount
Definition: mm.h:166
KIRQL FASTCALL KeAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber)
Definition: spinlock.c:108
struct _MMPFN MMPFN
ULONG_PTR Priority
Definition: mm.h:354
FORCEINLINE PMMPFN MiGetPfnEntry(IN PFN_NUMBER Pfn)
Definition: mm.h:940
#define P(row, col)
NTSTATUS ReadStatus
Definition: mm.h:312
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:126
HANDLE FileHandle
Definition: mm.h:437
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
SIZE_T MmPagedPoolCommit
Definition: freelist.c:34
#define _In_
Definition: no_sal2.h:204
NTSTATUS NTAPI MmCreateVirtualMappingUnsafe(struct _EPROCESS *Process, PVOID Address, ULONG flProtect, PPFN_NUMBER Pages, ULONG PageCount)
ULONG_PTR SIZE_T
Definition: typedefs.h:78
Definition: compat.h:484
PFN_NUMBER CurrentUsage
Definition: mm.h:433
USHORT PageColor
Definition: mm.h:296
FORCEINLINE PMMSUPPORT MmGetKernelAddressSpace(VOID)
Definition: mm.h:1453
PFN_COUNT MmNumberOfPhysicalPages
Definition: init.c:48
PRTL_BITMAP Bitmap
Definition: mm.h:436
NTSTATUS NTAPI MmDeleteProcessAddressSpace(IN PEPROCESS Process)
NTSTATUS NTAPI MmDbgCopyMemory(IN ULONG64 Address, IN PVOID Buffer, IN ULONG Size, IN ULONG Flags)
Definition: mmdbg.c:126
struct _MM_REGION * PMM_REGION
NTSTATUS MmTrimUserMemory(ULONG Target, ULONG Priority, PULONG NrFreedPages)
Definition: balance.c:178
INIT_FUNCTION VOID NTAPI MiReloadBootLoadedDrivers(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: sysldr.c:1686
INIT_FUNCTION VOID NTAPI MmInitializeBalancer(ULONG NrAvailablePages, ULONG NrSystemPages)
Definition: balance.c:53
union _MMPFN::@1737 u4
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
ULONG_PTR PteFrame
Definition: mm.h:350
struct _MMFREE_POOL_ENTRY * PMMFREE_POOL_ENTRY
PFN_COUNT MiUsedSwapPages
Definition: pagefile.c:56
PRTL_BITMAP EndOfPagedPoolBitmap
Definition: mm.h:415
PFN_NUMBER Total
Definition: mm.h:371
USHORT ShortFlags
Definition: mm.h:334
struct _MMPFN * PMMPFN
ULONG_PTR SWAPENTRY
Definition: mm.h:47
NTSTATUS NTAPI MmSetMemoryPriorityProcess(IN PEPROCESS Process, IN UCHAR MemoryPriority)
Definition: procsup.c:469
_Out_ PKAPC_STATE ApcState
Definition: mm.h:1492
FORCEINLINE PEPROCESS MmGetAddressSpaceOwner(IN PMMSUPPORT AddressSpace)
Definition: mm.h:1438
FORCEINLINE PVOID MmCreateHyperspaceMapping(IN PFN_NUMBER Page)
Definition: mm.h:1028
_Must_inspect_result_ _In_ ULONG NewProtect
Definition: mmfuncs.h:683
ULONG SectionPageProtection
Definition: mm.h:197
USHORT Rom
Definition: mm.h:300
PMMPTE PteAddress
Definition: mm.h:318
unsigned int * PULONG
Definition: retypes.h:1
ULONG_PTR EntireFrame
Definition: mm.h:347
MMPTE OriginalPte
Definition: mm.h:339
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:316
struct _MM_RMAP_ENTRY * Next
Definition: mm.h:238
VOID FASTCALL KeReleaseGuardedMutex(IN OUT PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:53
MM_DRIVER_VERIFIER_DATA MmVerifierData
Definition: drvmgmt.c:20
ULONG MmNumberOfPagingFiles
Definition: pagefile.c:50
PFN_NUMBER MmHighestPhysicalPage
Definition: meminit.c:31
VOID NTAPI MmInitializeRegion(PLIST_ENTRY RegionListHead, SIZE_T Length, ULONG Type, ULONG Protect)
Definition: region.c:239
IN ULONG IN ULONG Tag
Definition: evtlib.h:159
ULONG WsIndex
Definition: mm.h:310
enum _MI_PFN_USAGES MI_PFN_USAGES
PFN_NUMBER Blink
Definition: mm.h:321
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:1046
NTSTATUS NTAPI MmProtectSectionView(PMMSUPPORT AddressSpace, PMEMORY_AREA MemoryArea, PVOID BaseAddress, SIZE_T Length, ULONG Protect, PULONG OldProtect)
Definition: section.c:2525
FAST_MUTEX Lock
Definition: mm.h:162
FORCEINLINE PFN_NUMBER MiGetPfnEntryIndex(IN PMMPFN Pfn1)
Definition: mm.h:960
SECTION_IMAGE_INFORMATION ImageInformation
Definition: mm.h:186
PVOID MmLastUnloadedDrivers
Definition: sysldr.c:44
#define OUT
Definition: typedefs.h:39
RTL_GENERIC_TABLE PageTable
Definition: mm.h:181
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:998
struct tagContext Context
Definition: acpixf.h:1024
PFN_COUNT MiFreeSwapPages
Definition: pagefile.c:53
unsigned int ULONG
Definition: retypes.h:1
LIST_ENTRY RegionListEntry
Definition: mm.h:395
BOOLEAN NTAPI MmIsFileObjectAPagingFile(PFILE_OBJECT FileObject)
Definition: pagefile.c:109
Definition: mm.h:236
VOID NTAPI MmFreeSpecialPool(IN PVOID P)
uint32_t * PULONG_PTR
Definition: typedefs.h:63
NTSTATUS NTAPI MmWriteToSwapPage(SWAPENTRY SwapEntry, PFN_NUMBER Page)
Definition: pagefile.c:137
CSHORT Size
Definition: mm.h:195
struct _MEMORY_AREA::@1729::@1730 SectionData
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:198
struct _MM_MEMORY_CONSUMER MM_MEMORY_CONSUMER
struct _MM_PAGED_POOL_INFO * PMM_PAGED_POOL_INFO
ULONG PagesUsed
Definition: mm.h:385
ULONG PagedPoolHint
Definition: mm.h:419
PVOID Address
Definition: mm.h:240
ULONG_PTR InPageError
Definition: mm.h:351
INIT_FUNCTION VOID FORCEINLINE MmInitGlobalKernelPageDirectory(VOID)
Definition: mm.h:296
LARGE_INTEGER ViewOffset
Definition: mm.h:225
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:1364
PMMPTE FirstPteForPagedPool
Definition: mm.h:416
KIRQL HyperIrql
Definition: hypermap.c:24
UCHAR MmDisablePagingExecutive
Definition: mminit.c:27
PMM_SECTION_SEGMENT Segment
Definition: mm.h:203
VOID NTAPI ExpCheckPoolAllocation(PVOID P, POOL_TYPE PoolType, ULONG Tag)
Definition: expool.c:288
MMPFNLIST MmFreePageListHead
Definition: pfnlist.c:42
union _MMPFN::@1733 u2
VOID NTAPI MmReferencePage(PFN_NUMBER Page)
Definition: freelist.c:489
_Must_inspect_result_ _In_ FLT_CONTEXT_TYPE _In_ SIZE_T _In_ POOL_TYPE PoolType
Definition: fltkernel.h:1444
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:1090
SINGLE_LIST_ENTRY NextStackPfn
Definition: mm.h:313
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:219
#define APC_LEVEL
Definition: env_spec_w32.h:695
FORCEINLINE VOID MmLockAddressSpace(PMMSUPPORT AddressSpace)
Definition: mm.h:1424
BOOLEAN NTAPI MmIsDirtyPage(struct _EPROCESS *Process, PVOID Address)
ULONG Flags
Definition: mm.h:216
base of all file and directory entries
Definition: entries.h:82
FORCEINLINE PMMSUPPORT MmGetCurrentAddressSpace(VOID)
Definition: mm.h:1446
* PKAPC_STATE
Definition: ketypes.h:1273
LONG AweReferenceCount
Definition: mm.h:340
VOID NTAPI MmFreeSwapPage(SWAPENTRY Entry)
Definition: pagefile.c:278
CHAR MI_PFN_CURRENT_PROCESS_NAME[16]
Definition: pfnlist.c:64
VOID NTAPI MmDeletePageTable(struct _EPROCESS *Process, PVOID Address)
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:2804
SWAPENTRY NTAPI MmGetSavedSwapEntryPage(PFN_NUMBER Page)
Definition: freelist.c:470
PMMPDE NextPdeForPagedPoolExpansion
Definition: mm.h:418
SIZE_T MmDriverCommit
Definition: freelist.c:32
Definition: dlist.c:348
Definition: mm.h:369
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68