ReactOS  r74406
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 
20 
22 
24 
28 extern PVOID KernelVerifier;
30 
33 extern SIZE_T MmSharedCommit;
34 extern SIZE_T MmDriverCommit;
35 extern SIZE_T MmProcessCommit;
39 
40 extern PVOID MiDebugMapping; // internal
41 extern PMMPTE MmDebugPte; // internal
42 
43 struct _KTRAP_FRAME;
44 struct _EPROCESS;
46 typedef ULONG_PTR SWAPENTRY;
47 
48 //
49 // MmDbgCopyMemory Flags
50 //
51 #define MMDBG_COPY_WRITE 0x00000001
52 #define MMDBG_COPY_PHYSICAL 0x00000002
53 #define MMDBG_COPY_UNSAFE 0x00000004
54 #define MMDBG_COPY_CACHED 0x00000008
55 #define MMDBG_COPY_UNCACHED 0x00000010
56 #define MMDBG_COPY_WRITE_COMBINED 0x00000020
57 
58 //
59 // Maximum chunk size per copy
60 //
61 #define MMDBG_COPY_MAX_SIZE 0x8
62 
63 #if defined(_X86_) // intenal for marea.c
64 #define MI_STATIC_MEMORY_AREAS (14)
65 #else
66 #define MI_STATIC_MEMORY_AREAS (13)
67 #endif
68 
69 #define MEMORY_AREA_SECTION_VIEW (1)
70 #define MEMORY_AREA_CACHE (2)
71 #define MEMORY_AREA_OWNED_BY_ARM3 (15)
72 #define MEMORY_AREA_STATIC (0x80000000)
73 
74 /* Although Microsoft says this isn't hardcoded anymore,
75  they won't be able to change it. Stuff depends on it */
76 #define MM_VIRTMEM_GRANULARITY (64 * 1024)
77 
78 #define STATUS_MM_RESTART_OPERATION ((NTSTATUS)0xD0000001)
79 
80 /*
81  * Additional flags for protection attributes
82  */
83 #define PAGE_WRITETHROUGH (1024)
84 #define PAGE_SYSTEM (2048)
85 
86 #define SEC_PHYSICALMEMORY (0x80000000)
87 
88 #define MM_PAGEFILE_SEGMENT (0x1)
89 #define MM_DATAFILE_SEGMENT (0x2)
90 
91 #define MC_CACHE (0)
92 #define MC_USER (1)
93 #define MC_SYSTEM (2)
94 #define MC_MAXIMUM (3)
95 
96 #define PAGED_POOL_MASK 1
97 #define MUST_SUCCEED_POOL_MASK 2
98 #define CACHE_ALIGNED_POOL_MASK 4
99 #define QUOTA_POOL_MASK 8
100 #define SESSION_POOL_MASK 32
101 #define VERIFIER_POOL_MASK 64
102 
103 // FIXME: use ALIGN_UP_BY
104 #define MM_ROUND_UP(x,s) \
105  ((PVOID)(((ULONG_PTR)(x)+(s)-1) & ~((ULONG_PTR)(s)-1)))
106 
107 #define MM_ROUND_DOWN(x,s) \
108  ((PVOID)(((ULONG_PTR)(x)) & ~((ULONG_PTR)(s)-1)))
109 
110 #define PAGE_FLAGS_VALID_FOR_SECTION \
111  (PAGE_READONLY | \
112  PAGE_READWRITE | \
113  PAGE_WRITECOPY | \
114  PAGE_EXECUTE | \
115  PAGE_EXECUTE_READ | \
116  PAGE_EXECUTE_READWRITE | \
117  PAGE_EXECUTE_WRITECOPY | \
118  PAGE_NOACCESS | \
119  PAGE_NOCACHE)
120 
121 #define PAGE_IS_READABLE \
122  (PAGE_READONLY | \
123  PAGE_READWRITE | \
124  PAGE_WRITECOPY | \
125  PAGE_EXECUTE_READ | \
126  PAGE_EXECUTE_READWRITE | \
127  PAGE_EXECUTE_WRITECOPY)
128 
129 #define PAGE_IS_WRITABLE \
130  (PAGE_READWRITE | \
131  PAGE_WRITECOPY | \
132  PAGE_EXECUTE_READWRITE | \
133  PAGE_EXECUTE_WRITECOPY)
134 
135 #define PAGE_IS_EXECUTABLE \
136  (PAGE_EXECUTE | \
137  PAGE_EXECUTE_READ | \
138  PAGE_EXECUTE_READWRITE | \
139  PAGE_EXECUTE_WRITECOPY)
140 
141 #define PAGE_IS_WRITECOPY \
142  (PAGE_WRITECOPY | \
143  PAGE_EXECUTE_WRITECOPY)
144 
145 //
146 // Wait entry for marking pages that are being serviced
147 //
148 #define MM_WAIT_ENTRY 0x7ffffc00
149 
150 #define InterlockedCompareExchangePte(PointerPte, Exchange, Comperand) \
151  InterlockedCompareExchange((PLONG)(PointerPte), Exchange, Comperand)
152 
153 #define InterlockedExchangePte(PointerPte, Value) \
154  InterlockedExchange((PLONG)(PointerPte), Value)
155 
156 typedef struct _MM_SECTION_SEGMENT
157 {
158  FAST_MUTEX Lock; /* lock which protects the page directory */
160  LARGE_INTEGER RawLength; /* length of the segment which is part of the mapped file */
161  LARGE_INTEGER Length; /* absolute length of the segment */
168 
169  struct
170  {
171  ULONGLONG FileOffset; /* start offset into the file for image sections */
172  ULONG_PTR VirtualAddress; /* start offset into the address range for image sections */
174  } Image;
175 
179 
181 {
185  PMM_SECTION_SEGMENT Segments;
187 
188 typedef struct _ROS_SECTION_OBJECT
189 {
196  union
197  {
198  PMM_IMAGE_SECTION_OBJECT ImageSection;
199  PMM_SECTION_SEGMENT Segment;
200  };
202 
203 #define MA_GetStartingAddress(_MemoryArea) ((_MemoryArea)->StartingVpn << PAGE_SHIFT)
204 #define MA_GetEndingAddress(_MemoryArea) (((_MemoryArea)->EndingVpn + 1) << PAGE_SHIFT)
205 
206 typedef struct _MEMORY_AREA
207 {
220  union
221  {
222  struct
223  {
226  PMM_SECTION_SEGMENT Segment;
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
343  PMM_RMAP_ENTRY RmapListHead;
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 typedef VOID
430  SIZE_T Length,
431  ULONG OldType,
432  ULONG OldProtect,
433  ULONG NewType,
435 );
436 
437 typedef VOID
439  PVOID Context,
440  PMEMORY_AREA MemoryArea,
441  PVOID Address,
442  PFN_NUMBER Page,
443  SWAPENTRY SwapEntry,
444  BOOLEAN Dirty
445 );
446 
447 //
448 // Mm copy support for Kd
449 //
450 NTSTATUS
451 NTAPI
453  IN ULONG64 Address,
454  IN PVOID Buffer,
455  IN ULONG Size,
456  IN ULONG Flags
457 );
458 
459 //
460 // Determines if a given address is a session address
461 //
462 BOOLEAN
463 NTAPI
465  IN PVOID Address
466 );
467 
468 ULONG
469 NTAPI
472 );
473 
474 ULONG
475 NTAPI
478 );
479 
480 /* marea.c *******************************************************************/
481 
482 NTSTATUS
483 NTAPI
485  PMMSUPPORT AddressSpace,
486  ULONG Type,
487  PVOID *BaseAddress,
488  SIZE_T Length,
489  ULONG Protection,
490  PMEMORY_AREA *Result,
491  ULONG AllocationFlags,
492  ULONG AllocationGranularity
493 );
494 
495 PMEMORY_AREA
496 NTAPI
498  PMMSUPPORT AddressSpace,
499  PVOID Address
500 );
501 
502 NTSTATUS
503 NTAPI
505  PMMSUPPORT AddressSpace,
506  PMEMORY_AREA MemoryArea,
508  PVOID FreePageContext
509 );
510 
511 VOID
512 NTAPI
515  PMMVAD Vad);
516 
517 PMEMORY_AREA
518 NTAPI
520  PMMSUPPORT AddressSpace,
521  PVOID Address,
522  SIZE_T Length
523 );
524 
525 PVOID
526 NTAPI
527 MmFindGap(
528  PMMSUPPORT AddressSpace,
529  SIZE_T Length,
530  ULONG_PTR Granularity,
531  BOOLEAN TopDown
532 );
533 
534 VOID
535 NTAPI
537  PMMSUPPORT AddressSpace);
538 
539 VOID
540 NTAPI
542 
543 /* npool.c *******************************************************************/
544 
545 VOID
546 NTAPI
548 
549 PVOID
550 NTAPI
553  IN SIZE_T SizeInBytes
554 );
555 
556 POOL_TYPE
557 NTAPI
560 );
561 
562 ULONG
563 NTAPI
565  IN PVOID StartingAddress
566 );
567 
568 /* pool.c *******************************************************************/
569 
570 BOOLEAN
571 NTAPI
574  IN ULONG CurrentMaxQuota,
575  OUT PULONG NewMaxQuota
576 );
577 
578 /* mdl.c *********************************************************************/
579 
580 VOID
581 NTAPI
583  PMDL Mdl,
584  PPFN_NUMBER Pages
585 );
586 
587 /* mminit.c ******************************************************************/
588 
589 VOID
590 NTAPI
591 MmInit1(
592  VOID
593 );
594 
595 BOOLEAN
596 NTAPI
597 MmInitSystem(IN ULONG Phase,
598  IN PLOADER_PARAMETER_BLOCK LoaderBlock);
599 
600 
601 /* pagefile.c ****************************************************************/
602 
603 SWAPENTRY
604 NTAPI
606 
607 VOID
608 NTAPI
610 
611 VOID
612 NTAPI
614 
615 BOOLEAN
616 NTAPI
618 
619 NTSTATUS
620 NTAPI
622  SWAPENTRY SwapEntry,
623  PFN_NUMBER Page
624 );
625 
626 NTSTATUS
627 NTAPI
629  SWAPENTRY SwapEntry,
630  PFN_NUMBER Page
631 );
632 
633 VOID
634 NTAPI
636 
637 NTSTATUS
638 NTAPI
640  _In_ PFN_NUMBER Page,
641  _In_ ULONG PageFileIndex,
642  _In_ ULONG_PTR PageFileOffset);
643 
644 /* process.c ****************************************************************/
645 
646 NTSTATUS
647 NTAPI
650  IN PEPROCESS Clone OPTIONAL,
651  IN PVOID Section OPTIONAL,
652  IN OUT PULONG Flags,
653  IN POBJECT_NAME_INFORMATION *AuditName OPTIONAL
654 );
655 
656 NTSTATUS
657 NTAPI
660  IN PINITIAL_PEB InitialPeb,
661  OUT PPEB *BasePeb
662 );
663 
664 NTSTATUS
665 NTAPI
669  IN PINITIAL_TEB InitialTeb,
670  OUT PTEB* BaseTeb
671 );
672 
673 VOID
674 NTAPI
676  struct _EPROCESS *Process,
677  PTEB Teb
678 );
679 
680 VOID
681 NTAPI
683 
684 NTSTATUS
685 NTAPI
687 
688 ULONG
689 NTAPI
691 
692 NTSTATUS
693 NTAPI
696  IN UCHAR MemoryPriority
697 );
698 
699 /* i386/pfault.c *************************************************************/
700 
701 NTSTATUS
702 NTAPI
704  ULONG Cs,
705  PULONG Eip,
706  PULONG Eax,
707  ULONG Cr2,
709 );
710 
711 /* special.c *****************************************************************/
712 
713 VOID
714 NTAPI
716 
717 BOOLEAN
718 NTAPI
721  IN ULONG Tag);
722 
723 BOOLEAN
724 NTAPI
726  IN PVOID P);
727 
728 BOOLEAN
729 NTAPI
731  IN PVOID P);
732 
733 PVOID
734 NTAPI
737  IN ULONG Tag,
739  IN ULONG SpecialType);
740 
741 VOID
742 NTAPI
744  IN PVOID P);
745 
746 /* mm.c **********************************************************************/
747 
748 NTSTATUS
749 NTAPI
751  IN BOOLEAN StoreInstruction,
752  IN PVOID Address,
754  IN PVOID TrapInformation
755 );
756 
757 /* kmap.c ********************************************************************/
758 
759 NTSTATUS
760 NTAPI
762  PFN_NUMBER NewPage,
763  PFN_NUMBER OldPage
764 );
765 
766 /* process.c *****************************************************************/
767 
768 PVOID
769 NTAPI
771 
772 VOID
773 NTAPI
775  BOOLEAN GuiStack);
776 
777 /* balace.c ******************************************************************/
778 
779 VOID
780 NTAPI
782  ULONG Consumer,
783  NTSTATUS (*Trim)(ULONG Target, ULONG Priority, PULONG NrFreed)
784 );
785 
786 VOID
787 NTAPI
789  ULONG NrAvailablePages,
790  ULONG NrSystemPages
791 );
792 
793 NTSTATUS
794 NTAPI
796  ULONG Consumer,
797  PFN_NUMBER Page
798 );
799 
800 NTSTATUS
801 NTAPI
803  ULONG Consumer,
804  BOOLEAN MyWait,
805  PPFN_NUMBER AllocatedPage
806 );
807 
808 VOID
809 NTAPI
811 
812 VOID
813 NTAPI
815 
816 /* rmap.c **************************************************************/
817 
818 VOID
819 NTAPI
821  PFN_NUMBER Page,
822  struct _MM_RMAP_ENTRY* ListHead
823 );
824 
825 struct _MM_RMAP_ENTRY*
826 NTAPI
828 
829 VOID
830 NTAPI
832  PFN_NUMBER Page,
833  struct _EPROCESS *Process,
834  PVOID Address
835 );
836 
837 VOID
838 NTAPI
840  PFN_NUMBER Page,
841  PVOID Context,
842  VOID (*DeleteMapping)(PVOID Context, struct _EPROCESS *Process, PVOID Address)
843 );
844 
845 VOID
846 NTAPI
848  PFN_NUMBER Page,
849  struct _EPROCESS *Process,
850  PVOID Address
851 );
852 
853 VOID
854 NTAPI
856 
857 VOID
858 NTAPI
860 
861 VOID
862 NTAPI
864 
865 BOOLEAN
866 NTAPI
868 
869 NTSTATUS
870 NTAPI
872 
873 /* freelist.c **********************************************************/
874 
876 PMMPFN
878 {
879  PMMPFN Page;
880  extern RTL_BITMAP MiPfnBitMap;
881 
882  /* Make sure the PFN number is valid */
883  if (Pfn > MmHighestPhysicalPage) return NULL;
884 
885  /* Make sure this page actually has a PFN entry */
886  if ((MiPfnBitMap.Buffer) && !(RtlTestBit(&MiPfnBitMap, (ULONG)Pfn))) return NULL;
887 
888  /* Get the entry */
889  Page = &MmPfnDatabase[Pfn];
890 
891  /* Return it */
892  return Page;
893 };
894 
897 MiGetPfnEntryIndex(IN PMMPFN Pfn1)
898 {
899  //
900  // This will return the Page Frame Number (PFN) from the MMPFN
901  //
902  return Pfn1 - MmPfnDatabase;
903 }
904 
906 NTAPI
907 MmGetLRUNextUserPage(PFN_NUMBER PreviousPage);
908 
910 NTAPI
912 
913 VOID
914 NTAPI
916 
917 VOID
918 NTAPI
920 
921 VOID
922 NTAPI
924  IN BOOLEAN StatusOnly
925 );
926 
927 VOID
928 NTAPI
930  VOID
931 );
932 
933 /* hypermap.c *****************************************************************/
934 
935 extern PEPROCESS HyperProcess;
936 extern KIRQL HyperIrql;
937 
938 PVOID
939 NTAPI
941  IN PFN_NUMBER Page,
942  IN PKIRQL OldIrql);
943 
944 VOID
945 NTAPI
947  IN PVOID Address,
948  IN KIRQL OldIrql);
949 
950 PVOID
951 NTAPI
952 MiMapPagesInZeroSpace(IN PMMPFN Pfn1,
953  IN PFN_NUMBER NumberOfPages);
954 
955 VOID
956 NTAPI
958  IN PFN_NUMBER NumberOfPages);
959 
960 //
961 // ReactOS Compatibility Layer
962 //
964 PVOID
966 {
967  HyperProcess = (PEPROCESS)KeGetCurrentThread()->ApcState.Process;
968  return MiMapPageInHyperSpace(HyperProcess, Page, &HyperIrql);
969 }
970 
971 #define MmDeleteHyperspaceMapping(x) MiUnmapPageInHyperSpace(HyperProcess, x, HyperIrql);
972 
973 /* i386/page.c *********************************************************/
974 
975 NTSTATUS
976 NTAPI
978  struct _EPROCESS* Process,
979  PVOID Address,
980  ULONG flProtect,
981  PPFN_NUMBER Pages,
982  ULONG PageCount
983 );
984 
985 NTSTATUS
986 NTAPI
988  struct _EPROCESS* Process,
989  PVOID Address,
990  ULONG flProtect,
991  PPFN_NUMBER Pages,
992  ULONG PageCount
993 );
994 
995 ULONG
996 NTAPI
998  struct _EPROCESS* Process,
999  PVOID Address);
1000 
1001 VOID
1002 NTAPI
1004  struct _EPROCESS* Process,
1005  PVOID Address,
1006  ULONG flProtect
1007 );
1008 
1009 BOOLEAN
1010 NTAPI
1012  struct _EPROCESS* Process,
1013  PVOID Address
1014 );
1015 
1016 BOOLEAN
1017 NTAPI
1019  struct _EPROCESS* Process,
1020  PVOID Address
1021 );
1022 
1023 VOID
1024 NTAPI
1026 
1027 VOID
1028 NTAPI
1030  struct _EPROCESS *Process,
1031  PVOID Address,
1032  SWAPENTRY* SwapEntry);
1033 
1034 VOID
1035 NTAPI
1037  struct _EPROCESS *Process,
1038  PVOID Address,
1039  SWAPENTRY* SwapEntry
1040 );
1041 
1042 NTSTATUS
1043 NTAPI
1045  struct _EPROCESS *Process,
1046  PVOID Address,
1047  SWAPENTRY SwapEntry
1048 );
1049 
1050 BOOLEAN
1051 NTAPI
1053  struct _EPROCESS *Process,
1054  PVOID Address
1055 );
1056 
1057 VOID
1058 NTAPI
1060  struct _EPROCESS *Process,
1061  PVOID Address
1062 );
1063 
1064 PFN_NUMBER
1065 NTAPI
1066 MmAllocPage(
1067  ULONG Consumer
1068 );
1069 
1070 VOID
1071 NTAPI
1073 
1074 VOID
1075 NTAPI
1077 
1078 ULONG
1079 NTAPI
1081 
1082 BOOLEAN
1083 NTAPI
1085 
1086 VOID
1087 NTAPI
1089  PFN_NUMBER Page,
1090  SWAPENTRY SavedSwapEntry);
1091 
1092 SWAPENTRY
1093 NTAPI
1095 
1096 VOID
1097 NTAPI
1099  struct _EPROCESS *Process,
1100  PVOID Address
1101 );
1102 
1103 VOID
1104 NTAPI
1106  struct _EPROCESS *Process,
1107  PVOID Address
1108 );
1109 
1110 PFN_NUMBER
1111 NTAPI
1113  struct _EPROCESS *Process,
1114  PVOID Address
1115 );
1116 
1117 BOOLEAN
1118 NTAPI
1120  IN ULONG MinWs,
1121  IN PEPROCESS Dest,
1122  IN PULONG_PTR DirectoryTableBase
1123 );
1124 
1125 NTSTATUS
1126 NTAPI
1129  IN PULONG_PTR DirectoryTableBase
1130 );
1131 
1132 
1133 NTSTATUS
1134 NTAPI
1137 );
1138 
1139 NTSTATUS
1140 NTAPI
1141 MmSetExecuteOptions(IN ULONG ExecuteOptions);
1142 
1143 NTSTATUS
1144 NTAPI
1145 MmGetExecuteOptions(IN PULONG ExecuteOptions);
1146 
1147 VOID
1148 NTAPI
1150  struct _EPROCESS *Process,
1151  PVOID Address,
1152  BOOLEAN* WasDirty,
1153  PPFN_NUMBER Page
1154 );
1155 
1156 BOOLEAN
1157 NTAPI
1159  struct _EPROCESS *Process,
1160  PVOID Address
1161 );
1162 
1163 /* wset.c ********************************************************************/
1164 
1165 NTSTATUS
1167  ULONG Target,
1168  ULONG Priority,
1169  PULONG NrFreedPages
1170 );
1171 
1172 /* region.c ************************************************************/
1173 
1174 NTSTATUS
1175 NTAPI
1177  PMMSUPPORT AddressSpace,
1178  PVOID BaseAddress,
1179  PLIST_ENTRY RegionListHead,
1180  PVOID StartAddress,
1181  SIZE_T Length,
1182  ULONG NewType,
1183  ULONG NewProtect,
1184  PMM_ALTER_REGION_FUNC AlterFunc
1185 );
1186 
1187 VOID
1188 NTAPI
1190  PLIST_ENTRY RegionListHead,
1191  SIZE_T Length,
1192  ULONG Type,
1193  ULONG Protect
1194 );
1195 
1196 PMM_REGION
1197 NTAPI
1198 MmFindRegion(
1199  PVOID BaseAddress,
1200  PLIST_ENTRY RegionListHead,
1201  PVOID Address,
1202  PVOID* RegionBaseAddress
1203 );
1204 
1205 /* section.c *****************************************************************/
1206 
1207 VOID
1208 NTAPI
1210  OUT PSECTION_IMAGE_INFORMATION ImageInformation
1211 );
1212 
1214 NTAPI
1216  IN PVOID Section
1217 );
1218 NTSTATUS
1219 NTAPI
1221  IN PVOID Address,
1223 );
1224 
1225 NTSTATUS
1226 NTAPI
1228  IN PVOID Section,
1230 );
1231 
1232 NTSTATUS
1233 NTAPI
1235  PMEMORY_AREA MemoryArea,
1236  PVOID Address,
1239 );
1240 
1241 NTSTATUS
1242 NTAPI
1244  PMMSUPPORT AddressSpace,
1245  PMEMORY_AREA MemoryArea,
1246  PVOID BaseAddress,
1247  SIZE_T Length,
1248  ULONG Protect,
1249  PULONG OldProtect
1250 );
1251 
1252 NTSTATUS
1253 NTAPI
1255 
1256 NTSTATUS
1257 NTAPI
1259  PMMSUPPORT AddressSpace,
1260  MEMORY_AREA* MemoryArea,
1261  PVOID Address,
1262  BOOLEAN Locked
1263 );
1264 
1265 NTSTATUS
1266 NTAPI
1268  PMMSUPPORT AddressSpace,
1269  PMEMORY_AREA MemoryArea,
1270  PVOID Address,
1272 );
1273 
1274 NTSTATUS
1275 NTAPI
1277 
1278 NTSTATUS
1279 NTAPI
1281  PMMSUPPORT AddressSpace,
1282  MEMORY_AREA* MemoryArea,
1283  PVOID Address
1284 );
1285 
1286 VOID
1287 NTAPI
1289 
1290 /* sysldr.c ******************************************************************/
1291 
1292 VOID
1293 NTAPI
1295  IN PLOADER_PARAMETER_BLOCK LoaderBlock
1296 );
1297 
1298 BOOLEAN
1299 NTAPI
1301  IN PLOADER_PARAMETER_BLOCK LoaderBlock
1302 );
1303 
1304 NTSTATUS
1305 NTAPI
1308  IN PUNICODE_STRING NamePrefix OPTIONAL,
1309  IN PUNICODE_STRING LoadedName OPTIONAL,
1310  IN ULONG Flags,
1311  OUT PVOID *ModuleObject,
1312  OUT PVOID *ImageBaseAddress
1313 );
1314 
1315 NTSTATUS
1316 NTAPI
1319 );
1320 
1321 NTSTATUS
1322 NTAPI
1325  IN BOOLEAN PurgeSection
1326 );
1327 
1328 NTSTATUS
1329 NTAPI
1331  IN PLDR_DATA_TABLE_ENTRY LdrEntry,
1332  IN PLIST_ENTRY ListHead
1333 );
1334 
1335 
1336 /* procsup.c *****************************************************************/
1337 
1338 NTSTATUS
1339 NTAPI
1341  IN PVOID StackPointer
1342 );
1343 
1344 
1346 VOID
1348 {
1349  KeAcquireGuardedMutex(&CONTAINING_RECORD(AddressSpace, EPROCESS, Vm)->AddressCreationLock);
1350 }
1351 
1353 VOID
1355 {
1356  KeReleaseGuardedMutex(&CONTAINING_RECORD(AddressSpace, EPROCESS, Vm)->AddressCreationLock);
1357 }
1358 
1360 PEPROCESS
1362 {
1363  if (AddressSpace == MmKernelAddressSpace) return NULL;
1364  return CONTAINING_RECORD(AddressSpace, EPROCESS, Vm);
1365 }
1366 
1368 PMMSUPPORT
1370 {
1371  return &((PEPROCESS)KeGetCurrentThread()->ApcState.Process)->Vm;
1372 }
1373 
1375 PMMSUPPORT
1377 {
1378  return MmKernelAddressSpace;
1379 }
1380 
1381 
1382 /* expool.c ******************************************************************/
1383 
1384 VOID
1385 NTAPI
1387  PVOID P,
1389  ULONG Tag);
1390 
1391 VOID
1392 NTAPI
1394  IN PVOID P);
1395 
1396 
1397 /* mmsup.c *****************************************************************/
1398 
1399 NTSTATUS
1400 NTAPI
1402  IN SIZE_T WorkingSetMinimumInBytes,
1403  IN SIZE_T WorkingSetMaximumInBytes,
1404  IN ULONG SystemCache,
1405  IN BOOLEAN IncreaseOkay);
1406 
1407 
1408 /* session.c *****************************************************************/
1409 
1411 NTSTATUS
1412 NTAPI
1413 MmAttachSession(
1414  _Inout_ PVOID SessionEntry,
1416 
1418 VOID
1419 NTAPI
1420 MmDetachSession(
1421  _Inout_ PVOID SessionEntry,
1422  _Out_ PKAPC_STATE ApcState);
1423 
1424 VOID
1425 NTAPI
1427  _Inout_ PVOID SessionEntry);
1428 
1429 PVOID
1430 NTAPI
1432  _In_ ULONG SessionId);
1433 
1435 VOID
1436 NTAPI
1437 MmSetSessionLocaleId(
1438  _In_ LCID LocaleId);
1439 
1440 
1441 /* virtual.c *****************************************************************/
1442 
1443 NTSTATUS
1444 NTAPI
1445 MmCopyVirtualMemory(IN PEPROCESS SourceProcess,
1447  IN PEPROCESS TargetProcess,
1451  OUT PSIZE_T ReturnSize);
1452 
VOID NTAPI MmDereferencePage(PFN_NUMBER Page)
Definition: freelist.c:537
DWORD *typedef PVOID
Definition: winlogon.h:52
VOID NTAPI MmSetCleanAllRmaps(PFN_NUMBER Page)
Definition: rmap.c:195
IN CINT OUT PVOID IN ULONG OUT PULONG ResultLength
Definition: conport.c:47
NTSTATUS NTAPI MmAccessFaultSectionView(PMMSUPPORT AddressSpace, MEMORY_AREA *MemoryArea, PVOID Address)
Definition: section.c:1692
Definition: video.h:583
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 const char UINT32 const char const char * ModuleName
Definition: acpixf.h:1255
PRTL_BITMAP PagedPoolAllocationMap
Definition: mm.h:414
PULONG Buffer
Definition: typedefs.h:90
ULONG_PTR VirtualAddress
Definition: mm.h:172
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:742
PFILE_OBJECT NTAPI MmGetFileObjectForSection(IN PVOID Section)
Definition: section.c:1679
BOOLEAN WriteCopy
Definition: mm.h:166
PFN_NUMBER MmResidentAvailablePages
Definition: freelist.c:27
#define IN
Definition: typedefs.h:39
union _MEMORY_AREA::@1488 Data
ULONG_PTR StartingVpn
Definition: mm.h:209
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
PVOID ULONG Address
Definition: oprghdlr.h:14
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:4417
LARGE_INTEGER MaximumSize
Definition: mm.h:192
VOID NTAPI MmFreeSectionSegments(PFILE_OBJECT FileObject)
Definition: section.c:804
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
VOID FORCEINLINE MmInitGlobalKernelPageDirectory(VOID)
Definition: mm.h:276
_In_ ULONG Mode
Definition: hubbusif.h:303
ULONG Characteristics
Definition: mm.h:173
Definition: ntbasedef.h:627
VOID FASTCALL KeAcquireGuardedMutex(IN PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:42
VOID NTAPI MmInit1(VOID)
NTSTATUS(* Trim)(ULONG Target, ULONG Priority, PULONG NrFreed)
Definition: mm.h:387
NTSTATUS NTAPI MmGetFileNameForSection(IN PVOID Section, OUT POBJECT_NAME_INFORMATION *ModuleName)
Definition: section.c:1799
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:1464
BOOLEAN NTAPI MiInitializeLoadedModuleList(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: sysldr.c:2188
ULONG_PTR AweAllocation
Definition: mm.h:353
ULONG Signature
Definition: mm.h:404
LIST_ENTRY ListOfSegments
Definition: mm.h:176
ULONG PagesTarget
Definition: mm.h:386
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)
VOID(* PMM_FREE_PAGE_FUNC)(PVOID Context, PMEMORY_AREA MemoryArea, PVOID Address, PFN_NUMBER Page, SWAPENTRY SwapEntry, BOOLEAN Dirty)
Definition: mm.h:438
MMLISTS ListName
Definition: mm.h:372
char CHAR
Definition: xmlstorage.h:175
FORCEINLINE VOID MmUnlockAddressSpace(PMMSUPPORT AddressSpace)
Definition: mm.h:1354
VOID NTAPI MmBuildMdlFromPages(PMDL Mdl, PPFN_NUMBER Pages)
Definition: pagefile.c:126
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
NTSTATUS NTAPI MmCreatePhysicalMemorySection(VOID)
Definition: section.c:2737
Definition: mm.h:390
struct _MM_RMAP_ENTRY MM_RMAP_ENTRY
NTSTATUS NTAPI MiReadPageFile(_In_ PFN_NUMBER Page, _In_ ULONG PageFileIndex, _In_ ULONG_PTR PageFileOffset)
Definition: pagefile.c:287
PVOID NTAPI MmGetSessionById(_In_ ULONG SessionId)
Definition: session.c:1040
BOOLEAN NTAPI MmIsSessionAddress(IN PVOID Address)
Definition: session.c:49
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
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
PVOID MmTriageActionTaken
Definition: drvmgmt.c:27
USHORT RemovalRequested
Definition: mm.h:298
PVOID MmUnloadedDrivers
Definition: sysldr.c:43
ULONG CacheCount
Definition: mm.h:163
_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
NTSTATUS NTAPI MmGetFileNameForAddress(IN PVOID Address, OUT PUNICODE_STRING ModuleName)
Definition: section.c:1829
VOID NTAPI MmDeletePageFileMapping(struct _EPROCESS *Process, PVOID Address, SWAPENTRY *SwapEntry)
NTSTATUS NTAPI MmReadFromSwapPage(SWAPENTRY SwapEntry, PFN_NUMBER Page)
Definition: pagefile.c:280
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
PVOID PMDL
Definition: usb.h:39
VOID NTAPI MmDeleteTeb(struct _EPROCESS *Process, PTEB Teb)
VOID NTAPI MiRosCleanupMemoryArea(PEPROCESS Process, PMMVAD Vad)
Definition: marea.c:524
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
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:997
struct _MM_IMAGE_SECTION_OBJECT MM_IMAGE_SECTION_OBJECT
PFN_NUMBER Flink
Definition: mm.h:373
enum _MMLISTS MMLISTS
MMPFNLIST MmModifiedNoWritePageListHead
Definition: pfnlist.c:47
PVOID NTAPI MmFindGap(PMMSUPPORT AddressSpace, SIZE_T Length, ULONG_PTR Granularity, BOOLEAN TopDown)
Definition: marea.c:212
uint32_t ULONG_PTR
Definition: typedefs.h:64
MMWSLE Wsle
Definition: mm.h:364
USHORT PrototypePte
Definition: mm.h:295
PMM_IMAGE_SECTION_OBJECT ImageSection
Definition: mm.h:198
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:2543
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
BOOLEAN NTAPI MmIsPagePresent(struct _EPROCESS *Process, PVOID Address)
VOID NTAPI MmInitializeMemoryConsumer(ULONG Consumer, NTSTATUS(*Trim)(ULONG Target, ULONG Priority, PULONG NrFreed))
Definition: balance.c:82
VOID NTAPI MmInitPagingFile(VOID)
Definition: pagefile.c:346
USHORT CacheAttribute
Definition: mm.h:299
#define MC_MAXIMUM
Definition: mm.h:94
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:1752
ULONG_PTR MustBeCached
Definition: mm.h:355
ULONG_PTR * PSIZE_T
Definition: typedefs.h:79
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:2788
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:358
NTSTATUS NTAPI MmCallDllInitialize(IN PLDR_DATA_TABLE_ENTRY LdrEntry, IN PLIST_ENTRY ListHead)
Definition: sysldr.c:309
_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
ULONG Protection
Definition: mm.h:164
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
uint64_t ULONG64
Definition: typedefs.h:66
PMMSUPPORT MmKernelAddressSpace
Definition: mminit.c:32
UINTN * BufferSize
Definition: acefiex.h:370
struct _MM_RMAP_ENTRY * PMM_RMAP_ENTRY
LIST_ENTRY List
Definition: mm.h:402
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:2453
BOOLEAN Locked
Definition: mm.h:167
VOID NTAPI MmSetCleanPage(struct _EPROCESS *Process, PVOID Address)
SIZE_T AllocatedPagedPool
Definition: mm.h:421
SIZE_T MmPeakCommitment
Definition: freelist.c:35
smooth NULL
Definition: ftsmooth.c:464
ULONG Protect
Definition: mm.h:215
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:213
_In_ PFILE_OBJECT FileObject
Definition: classpnp.h:1229
#define _Out_
Definition: no_sal2.h:323
NTSTATUS NTAPI MmPageOutPhysicalAddress(PFN_NUMBER Page)
Definition: rmap.c:57
Definition: bufpool.h:45
struct _MEMORY_AREA::@1488::@1489 SectionData
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:1020
NTSTATUS NTAPI MmGrowKernelStack(IN PVOID StackPointer)
Definition: procsup.c:461
SIZE_T PagedPoolCommit
Definition: mm.h:420
VOID NTAPI MmSetRmapListHeadPage(PFN_NUMBER Page, struct _MM_RMAP_ENTRY *ListHead)
PFILE_OBJECT FileObject
Definition: mm.h:159
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
UINTN Size
Definition: acefiex.h:550
NTSTATUS NTAPI MmCheckSystemImage(IN HANDLE ImageHandle, IN BOOLEAN PurgeSection)
Definition: sysldr.c:2728
NTSTATUS NTAPI MmUnloadSystemImage(IN PVOID ImageHandle)
Definition: sysldr.c:911
NTSTATUS NTAPI MmPageFault(ULONG Cs, PULONG Eip, PULONG Eax, ULONG Cr2, ULONG ErrorCode)
LARGE_INTEGER Length
Definition: mm.h:161
PMMPTE MmDebugPte
Definition: mmdbg.c:33
ULONGLONG FileOffset
Definition: mm.h:171
FAST_MUTEX
Definition: extypes.h:17
union _MMPFN::@1491 u1
BOOLEAN NTAPI MmIsSpecialPoolAddressFree(IN PVOID P)
PFN_COUNT Size
Definition: mm.h:403
VOID NTAPI MmCleanProcessAddressSpace(IN PEPROCESS Process)
Definition: procsup.c:1237
unsigned char BOOLEAN
_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: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:195
struct _MMPFNLIST MMPFNLIST
NTSTATUS NTAPI MmCreatePeb(IN PEPROCESS Process, IN PINITIAL_PEB InitialPeb, OUT PPEB *BasePeb)
Definition: procsup.c:502
Definition: mm.h:400
INT POOL_TYPE
Definition: typedefs.h:77
SWAPENTRY NTAPI MmAllocSwapPage(VOID)
Definition: pagefile.c:422
uint64_t ULONGLONG
Definition: typedefs.h:66
PVOID MiDebugMapping
Definition: mmdbg.c:32
struct _MM_SECTION_SEGMENT::@1485 Image
BOOLEAN NTAPI MmInitSystem(IN ULONG Phase, IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: mminit.c:269
CSHORT Type
Definition: mm.h:190
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:185
BOOLEAN DeleteInProgress
Definition: mm.h:217
BOOLEAN NTAPI MmIsDisabledPage(struct _EPROCESS *Process, PVOID Address)
LARGE_INTEGER RawLength
Definition: mm.h:160
NTSTATUS NTAPI MmFreeMemoryArea(PMMSUPPORT AddressSpace, PMEMORY_AREA MemoryArea, PMM_FREE_PAGE_FUNC FreePage, PVOID FreePageContext)
Definition: marea.c:280
struct _ROS_SECTION_OBJECT * PROS_SECTION_OBJECT
PVOID KernelVerifier
Definition: drvmgmt.c:28
PFN_NUMBER MmLowestPhysicalPage
Definition: meminit.c:30
VOID NTAPI ExReturnPoolQuota(IN PVOID P)
Definition: expool.c:1514
VOID NTAPI MmSetPageProtect(struct _EPROCESS *Process, PVOID Address, ULONG flProtect)
MMPFNLIST MmModifiedPageListHead
Definition: pfnlist.c:45
#define _Inout_
Definition: no_sal2.h:244
PFN_NUMBER NTAPI MmAllocPage(ULONG Consumer)
Definition: freelist.c:569
VOID NTAPI MiRosCheckMemoryAreas(PMMSUPPORT AddressSpace)
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
_Must_inspect_result_ typedef _In_ ULONG _In_ BOOLEAN Target
Definition: iotypes.h:1067
BOOLEAN NTAPI MmIsPageSwapEntry(struct _EPROCESS *Process, PVOID Address)
* PFILE_OBJECT
Definition: iotypes.h:1949
struct _MEMORY_AREA MEMORY_AREA
struct _MEMORY_AREA * Parent
Definition: mm.h:211
NTSTATUS NTAPI MmCreateMemoryArea(PMMSUPPORT AddressSpace, ULONG Type, PVOID *BaseAddress, SIZE_T Length, ULONG Protection, PMEMORY_AREA *Result, ULONG AllocationFlags, ULONG AllocationGranularity)
Definition: marea.c:412
ULONG NTAPI MmGetReferenceCountPage(PFN_NUMBER Page)
Definition: freelist.c:509
struct _MM_SECTION_SEGMENT * PMM_SECTION_SEGMENT
MMVAD VadNode
Definition: mm.h:208
ULONG Flags
Definition: mm.h:165
LIST_ENTRY MmLoadedUserImageList
Definition: sysldr.c:35
struct _MMFREE_POOL_ENTRY * Owner
Definition: mm.h:405
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
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:903
ULONG_PTR EndingVpn
Definition: mm.h:210
struct _MM_REGION MM_REGION
NTSTATUS NTAPI MmSetExecuteOptions(IN ULONG ExecuteOptions)
Definition: pagfault.c:2495
IN REFCLSID IN PUNKNOWN IN POOL_TYPE PoolType
Definition: unknown.h:68
NTSTATUS NTAPI MmAccessFault(IN BOOLEAN StoreInstruction, IN PVOID Address, IN KPROCESSOR_MODE Mode, IN PVOID TrapInformation)
Definition: mmfault.c:204
VOID UINTN Length
Definition: acefiex.h:718
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
IN SIZE_T NumberOfBytes
Definition: ndis.h:3914
VOID NTAPI MmRemoveLRUUserPage(PFN_NUMBER Page)
Definition: freelist.c:116
#define VOID
Definition: acefi.h:69
Definition: mm.h:305
Definition: ntddk_ex.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:427
KIRQL * PKIRQL
Definition: env_spec_w32.h:592
struct _MMFREE_POOL_ENTRY MMFREE_POOL_ENTRY
NTSTATUS NTAPI MmInitializeHandBuiltProcess2(IN PEPROCESS Process)
Definition: procsup.c:1060
VOID NTAPI MiInitBalancerThread(VOID)
Definition: balance.c:449
SIZE_T MmProcessCommit
Definition: freelist.c:33
Definition: typedefs.h:118
PFN_NUMBER NTAPI MmGetLRUFirstUserPage(VOID)
Definition: freelist.c:63
_In_ ULONG _In_ BOOLEAN _Must_inspect_result_ PVOID * VirtualAddress
Definition: ndis.h:3772
PEPROCESS HyperProcess
Definition: hypermap.c:23
ULONG ReferenceCount
Definition: mm.h:162
_Must_inspect_result_ NTSYSAPI BOOLEAN NTAPI RtlTestBit(_In_ PRTL_BITMAP BitMapHeader, _In_range_(<, BitMapHeader->SizeOfBitMap) ULONG BitNumber)
Definition: bitmap.c:434
ACPI_EFI_HANDLE ACPI_EFI_DEVICE_PATH VOID UINTN ACPI_EFI_HANDLE * ImageHandle
Definition: acefiex.h:463
struct _MMPFN MMPFN
ULONG_PTR Priority
Definition: mm.h:354
FORCEINLINE PMMPFN MiGetPfnEntry(IN PFN_NUMBER Pfn)
Definition: mm.h:877
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)
VOID NTAPI MmShowOutOfSpaceMessagePagingFile(VOID)
Definition: pagefile.c:154
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:79
Definition: compat.h:484
USHORT PageColor
Definition: mm.h:296
FORCEINLINE PMMSUPPORT MmGetKernelAddressSpace(VOID)
Definition: mm.h:1376
PFN_COUNT MmNumberOfPhysicalPages
Definition: init.c:48
DWORD *typedef HANDLE
Definition: winlogon.h:52
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 _MEMORY_AREA * LeftChild
Definition: mm.h:212
LONG NTSTATUS
Definition: DriverTester.h:11
struct _MM_REGION * PMM_REGION
NTSTATUS MmTrimUserMemory(ULONG Target, ULONG Priority, PULONG NrFreedPages)
Definition: balance.c:178
Definition: ntddk_ex.h:242
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:53
ULONG_PTR PteFrame
Definition: mm.h:350
struct _MMPFN::@1493::@1499 e2
struct _MMFREE_POOL_ENTRY * PMMFREE_POOL_ENTRY
PFN_COUNT MiUsedSwapPages
Definition: pagefile.c:86
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:45
NTSTATUS NTAPI MmSetMemoryPriorityProcess(IN PEPROCESS Process, IN UCHAR MemoryPriority)
Definition: procsup.c:471
_Out_ PKAPC_STATE ApcState
Definition: mm.h:1415
FORCEINLINE PEPROCESS MmGetAddressSpaceOwner(IN PMMSUPPORT AddressSpace)
Definition: mm.h:1361
FORCEINLINE PVOID MmCreateHyperspaceMapping(IN PFN_NUMBER Page)
Definition: mm.h:965
_Must_inspect_result_ _In_ ULONG NewProtect
Definition: mmfuncs.h:683
ULONG SectionPageProtection
Definition: mm.h:193
USHORT Rom
Definition: mm.h:300
PMMPTE PteAddress
Definition: mm.h:318
union _MMPFN::@1493 u3
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
VOID NTAPI MiReloadBootLoadedDrivers(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: sysldr.c:1673
MM_DRIVER_VERIFIER_DATA MmVerifierData
Definition: drvmgmt.c:20
ULONG MmNumberOfPagingFiles
Definition: pagefile.c:80
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:153
ULONG WsIndex
Definition: mm.h:310
enum _MI_PFN_USAGES MI_PFN_USAGES
PFN_NUMBER Blink
Definition: mm.h:321
struct _MEMORY_AREA * RightChild
Definition: mm.h:213
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 MmProtectSectionView(PMMSUPPORT AddressSpace, PMEMORY_AREA MemoryArea, PVOID BaseAddress, SIZE_T Length, ULONG Protect, PULONG OldProtect)
Definition: section.c:2507
FAST_MUTEX Lock
Definition: mm.h:158
FORCEINLINE PFN_NUMBER MiGetPfnEntryIndex(IN PMMPFN Pfn1)
Definition: mm.h:897
SECTION_IMAGE_INFORMATION ImageInformation
Definition: mm.h:182
union _MMPFN::@1492 u2
PVOID MmLastUnloadedDrivers
Definition: sysldr.c:44
#define OUT
Definition: typedefs.h:40
RTL_GENERIC_TABLE PageTable
Definition: mm.h:177
struct tagContext Context
Definition: acpixf.h:1013
PFN_COUNT MiFreeSwapPages
Definition: pagefile.c:83
unsigned int ULONG
Definition: retypes.h:1
LIST_ENTRY RegionListEntry
Definition: mm.h:395
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
BOOLEAN NTAPI MmIsFileObjectAPagingFile(PFILE_OBJECT FileObject)
Definition: pagefile.c:137
Definition: mm.h:236
VOID NTAPI MmFreeSpecialPool(IN PVOID P)
uint32_t * PULONG_PTR
Definition: typedefs.h:64
NTSTATUS NTAPI MmWriteToSwapPage(SWAPENTRY SwapEntry, PFN_NUMBER Page)
Definition: pagefile.c:222
CSHORT Size
Definition: mm.h:191
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:194
struct _MM_MEMORY_CONSUMER MM_MEMORY_CONSUMER
struct _MM_PAGED_POOL_INFO * PMM_PAGED_POOL_INFO
#define NTSTATUS
Definition: env_spec_w32.h:77
ULONG PagesUsed
Definition: mm.h:385
VOID NTAPI MiInitializeNonPagedPool(VOID)
Definition: pool.c:276
ULONG PagedPoolHint
Definition: mm.h:419
PVOID Address
Definition: mm.h:240
struct _MEMORY_AREA::@1488::@1490 VirtualMemoryData
ULONG_PTR InPageError
Definition: mm.h:351
LARGE_INTEGER ViewOffset
Definition: mm.h:225
BOOLEAN NTAPI MiRaisePoolQuota(IN POOL_TYPE PoolType, IN ULONG CurrentMaxQuota, OUT PULONG NewMaxQuota)
Definition: pool.c:1264
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:1282
PMMPTE FirstPteForPagedPool
Definition: mm.h:416
KIRQL HyperIrql
Definition: hypermap.c:24
union _MMPFN::@1496 u4
UCHAR MmDisablePagingExecutive
Definition: mminit.c:30
PMM_SECTION_SEGMENT Segment
Definition: mm.h:199
VOID NTAPI ExpCheckPoolAllocation(PVOID P, POOL_TYPE PoolType, ULONG Tag)
Definition: expool.c:286
NTSTATUS NTAPI MiCopyFromUserPage(PFN_NUMBER NewPage, PFN_NUMBER OldPage)
Definition: section.c:1043
MMPFNLIST MmFreePageListHead
Definition: pfnlist.c:42
VOID NTAPI MmInitializeRmapList(VOID)
Definition: rmap.c:43
VOID NTAPI MmReferencePage(PFN_NUMBER Page)
Definition: freelist.c:489
ULONG NTAPI MmGetSessionIdEx(IN PEPROCESS Process)
Definition: session.c:195
DWORD LCID
Definition: nls.h:14
short CSHORT
Definition: umtypes.h:115
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS SourceAddress
Definition: iotypes.h:1089
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
NTSTATUS NTAPI MmInitializeHandBuiltProcess(IN PEPROCESS Process, IN PULONG_PTR DirectoryTableBase)
Definition: procsup.c:1035
#define APC_LEVEL
Definition: env_spec_w32.h:695
FORCEINLINE VOID MmLockAddressSpace(PMMSUPPORT AddressSpace)
Definition: mm.h:1347
BOOLEAN NTAPI MmIsDirtyPage(struct _EPROCESS *Process, PVOID Address)
IN HDEVINFO IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL
Definition: devinst.c:44
ULONG Flags
Definition: mm.h:216
base of all file and directory entries
Definition: entries.h:82
FORCEINLINE PMMSUPPORT MmGetCurrentAddressSpace(VOID)
Definition: mm.h:1369
* PKAPC_STATE
Definition: ketypes.h:1258
LONG AweReferenceCount
Definition: mm.h:340
VOID NTAPI MmFreeSwapPage(SWAPENTRY Entry)
Definition: pagefile.c:392
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:2841
SWAPENTRY NTAPI MmGetSavedSwapEntryPage(PFN_NUMBER Page)
Definition: freelist.c:470
PMMPDE NextPdeForPagedPoolExpansion
Definition: mm.h:418
SIZE_T MmDriverCommit
Definition: freelist.c:32
Definition: mm.h:369
#define P(a, b, c, d, e, x)