ReactOS  r76032
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->VadNode.StartingVpn << PAGE_SHIFT)
204 #define MA_GetEndingAddress(_MemoryArea) ((_MemoryArea->VadNode.EndingVpn + 1) << PAGE_SHIFT)
205 
206 typedef struct _MEMORY_AREA
207 {
209 
216  union
217  {
218  struct
219  {
222  PMM_SECTION_SEGMENT Segment;
224  } SectionData;
225  struct
226  {
229  } Data;
231 
232 typedef struct _MM_RMAP_ENTRY
233 {
237 #if DBG
238  PVOID Caller;
239 #endif
240 }
242 
243 #if MI_TRACE_PFNS
246 #define MI_SET_USAGE(x) MI_PFN_CURRENT_USAGE = x
247 #define MI_SET_PROCESS2(x) memcpy(MI_PFN_CURRENT_PROCESS_NAME, x, 16)
248 #else
249 #define MI_SET_USAGE(x)
250 #define MI_SET_PROCESS2(x)
251 #endif
252 
253 typedef enum _MI_PFN_USAGES
254 {
278 } MI_PFN_USAGES;
279 
280 //
281 // These two mappings are actually used by Windows itself, based on the ASSERTS
282 //
283 #define StartOfAllocation ReadInProgress
284 #define EndOfAllocation WriteInProgress
285 
286 typedef struct _MMPFNENTRY
287 {
289  USHORT ReadInProgress:1; // StartOfAllocation
290  USHORT WriteInProgress:1; // EndOfAllocation
298 } MMPFNENTRY;
299 
300 // Mm internal
301 typedef struct _MMPFN
302 {
303  union
304  {
310 
311  // HACK for ROSPFN
313  } u1;
315  union
316  {
319  } u2;
320  union
321  {
322  struct
323  {
326  };
327  struct
328  {
331  } e2;
332  } u3;
333  union
334  {
337 
338  // HACK for ROSPFN
339  PMM_RMAP_ENTRY RmapListHead;
340  };
341  union
342  {
344  struct
345  {
352  };
353  } u4;
354 #if MI_TRACE_PFNS
355  MI_PFN_USAGES PfnUsage;
356  CHAR ProcessName[16];
357 #endif
358 
359  // HACK until WS lists are supported
361 } MMPFN, *PMMPFN;
362 
363 extern PMMPFN MmPfnDatabase;
364 
365 typedef struct _MMPFNLIST
366 {
372 
378 
379 typedef struct _MM_MEMORY_CONSUMER
380 {
385 
386 typedef struct _MM_REGION
387 {
393 
394 // Mm internal
395 /* Entry describing free pool memory */
396 typedef struct _MMFREE_POOL_ENTRY
397 {
403 
404 /* Signature of a freed block */
405 #define MM_FREE_POOL_SIGNATURE 'ARM3'
406 
407 /* Paged pool information */
408 typedef struct _MM_PAGED_POOL_INFO
409 {
419 
421 
422 typedef VOID
426  SIZE_T Length,
427  ULONG OldType,
428  ULONG OldProtect,
429  ULONG NewType,
431 );
432 
433 typedef VOID
435  PVOID Context,
436  PMEMORY_AREA MemoryArea,
437  PVOID Address,
438  PFN_NUMBER Page,
439  SWAPENTRY SwapEntry,
440  BOOLEAN Dirty
441 );
442 
443 //
444 // Mm copy support for Kd
445 //
446 NTSTATUS
447 NTAPI
449  IN ULONG64 Address,
450  IN PVOID Buffer,
451  IN ULONG Size,
452  IN ULONG Flags
453 );
454 
455 //
456 // Determines if a given address is a session address
457 //
458 BOOLEAN
459 NTAPI
461  IN PVOID Address
462 );
463 
464 ULONG
465 NTAPI
468 );
469 
470 ULONG
471 NTAPI
474 );
475 
476 /* marea.c *******************************************************************/
477 
478 NTSTATUS
479 NTAPI
481  PMMSUPPORT AddressSpace,
482  ULONG Type,
483  PVOID *BaseAddress,
484  SIZE_T Length,
485  ULONG Protection,
486  PMEMORY_AREA *Result,
487  ULONG AllocationFlags,
488  ULONG AllocationGranularity
489 );
490 
491 PMEMORY_AREA
492 NTAPI
494  PMMSUPPORT AddressSpace,
495  PVOID Address
496 );
497 
498 NTSTATUS
499 NTAPI
501  PMMSUPPORT AddressSpace,
502  PMEMORY_AREA MemoryArea,
504  PVOID FreePageContext
505 );
506 
507 VOID
508 NTAPI
511  PMMVAD Vad);
512 
513 PMEMORY_AREA
514 NTAPI
516  PMMSUPPORT AddressSpace,
517  PVOID Address,
518  SIZE_T Length
519 );
520 
521 PVOID
522 NTAPI
523 MmFindGap(
524  PMMSUPPORT AddressSpace,
525  SIZE_T Length,
526  ULONG_PTR Granularity,
527  BOOLEAN TopDown
528 );
529 
530 VOID
531 NTAPI
533  PMMSUPPORT AddressSpace);
534 
535 VOID
536 NTAPI
538 
539 /* npool.c *******************************************************************/
540 
541 VOID
542 NTAPI
544 
545 PVOID
546 NTAPI
549  IN SIZE_T SizeInBytes
550 );
551 
552 POOL_TYPE
553 NTAPI
556 );
557 
558 ULONG
559 NTAPI
561  IN PVOID StartingAddress
562 );
563 
564 /* pool.c *******************************************************************/
565 
566 BOOLEAN
567 NTAPI
570  IN ULONG CurrentMaxQuota,
571  OUT PULONG NewMaxQuota
572 );
573 
574 /* mdl.c *********************************************************************/
575 
576 VOID
577 NTAPI
579  PMDL Mdl,
580  PPFN_NUMBER Pages
581 );
582 
583 /* mminit.c ******************************************************************/
584 
585 VOID
586 NTAPI
587 MmInit1(
588  VOID
589 );
590 
591 BOOLEAN
592 NTAPI
593 MmInitSystem(IN ULONG Phase,
594  IN PLOADER_PARAMETER_BLOCK LoaderBlock);
595 
596 
597 /* pagefile.c ****************************************************************/
598 
599 SWAPENTRY
600 NTAPI
602 
603 VOID
604 NTAPI
606 
607 VOID
608 NTAPI
610 
611 BOOLEAN
612 NTAPI
614 
615 NTSTATUS
616 NTAPI
618  SWAPENTRY SwapEntry,
619  PFN_NUMBER Page
620 );
621 
622 NTSTATUS
623 NTAPI
625  SWAPENTRY SwapEntry,
626  PFN_NUMBER Page
627 );
628 
629 VOID
630 NTAPI
632 
633 NTSTATUS
634 NTAPI
636  _In_ PFN_NUMBER Page,
637  _In_ ULONG PageFileIndex,
638  _In_ ULONG_PTR PageFileOffset);
639 
640 /* process.c ****************************************************************/
641 
642 NTSTATUS
643 NTAPI
646  IN PEPROCESS Clone OPTIONAL,
647  IN PVOID Section OPTIONAL,
648  IN OUT PULONG Flags,
649  IN POBJECT_NAME_INFORMATION *AuditName OPTIONAL
650 );
651 
652 NTSTATUS
653 NTAPI
656  IN PINITIAL_PEB InitialPeb,
657  OUT PPEB *BasePeb
658 );
659 
660 NTSTATUS
661 NTAPI
665  IN PINITIAL_TEB InitialTeb,
666  OUT PTEB* BaseTeb
667 );
668 
669 VOID
670 NTAPI
672  struct _EPROCESS *Process,
673  PTEB Teb
674 );
675 
676 VOID
677 NTAPI
679 
680 NTSTATUS
681 NTAPI
683 
684 ULONG
685 NTAPI
687 
688 NTSTATUS
689 NTAPI
692  IN UCHAR MemoryPriority
693 );
694 
695 /* i386/pfault.c *************************************************************/
696 
697 NTSTATUS
698 NTAPI
700  ULONG Cs,
701  PULONG Eip,
702  PULONG Eax,
703  ULONG Cr2,
705 );
706 
707 /* special.c *****************************************************************/
708 
709 VOID
710 NTAPI
712 
713 BOOLEAN
714 NTAPI
717  IN ULONG Tag);
718 
719 BOOLEAN
720 NTAPI
722  IN PVOID P);
723 
724 BOOLEAN
725 NTAPI
727  IN PVOID P);
728 
729 PVOID
730 NTAPI
733  IN ULONG Tag,
735  IN ULONG SpecialType);
736 
737 VOID
738 NTAPI
740  IN PVOID P);
741 
742 /* mm.c **********************************************************************/
743 
744 NTSTATUS
745 NTAPI
747  IN BOOLEAN StoreInstruction,
748  IN PVOID Address,
750  IN PVOID TrapInformation
751 );
752 
753 /* kmap.c ********************************************************************/
754 
755 NTSTATUS
756 NTAPI
758  PFN_NUMBER NewPage,
759  PFN_NUMBER OldPage
760 );
761 
762 /* process.c *****************************************************************/
763 
764 PVOID
765 NTAPI
767 
768 VOID
769 NTAPI
771  BOOLEAN GuiStack);
772 
773 /* balace.c ******************************************************************/
774 
775 VOID
776 NTAPI
778  ULONG Consumer,
779  NTSTATUS (*Trim)(ULONG Target, ULONG Priority, PULONG NrFreed)
780 );
781 
782 VOID
783 NTAPI
785  ULONG NrAvailablePages,
786  ULONG NrSystemPages
787 );
788 
789 NTSTATUS
790 NTAPI
792  ULONG Consumer,
793  PFN_NUMBER Page
794 );
795 
796 NTSTATUS
797 NTAPI
799  ULONG Consumer,
800  BOOLEAN MyWait,
801  PPFN_NUMBER AllocatedPage
802 );
803 
804 VOID
805 NTAPI
807 
808 VOID
809 NTAPI
811 
812 /* rmap.c **************************************************************/
813 
814 VOID
815 NTAPI
817  PFN_NUMBER Page,
818  struct _MM_RMAP_ENTRY* ListHead
819 );
820 
821 struct _MM_RMAP_ENTRY*
822 NTAPI
824 
825 VOID
826 NTAPI
828  PFN_NUMBER Page,
829  struct _EPROCESS *Process,
830  PVOID Address
831 );
832 
833 VOID
834 NTAPI
836  PFN_NUMBER Page,
837  PVOID Context,
838  VOID (*DeleteMapping)(PVOID Context, struct _EPROCESS *Process, PVOID Address)
839 );
840 
841 VOID
842 NTAPI
844  PFN_NUMBER Page,
845  struct _EPROCESS *Process,
846  PVOID Address
847 );
848 
849 VOID
850 NTAPI
852 
853 VOID
854 NTAPI
856 
857 VOID
858 NTAPI
860 
861 BOOLEAN
862 NTAPI
864 
865 NTSTATUS
866 NTAPI
868 
869 /* freelist.c **********************************************************/
870 
872 PMMPFN
874 {
875  PMMPFN Page;
876  extern RTL_BITMAP MiPfnBitMap;
877 
878  /* Make sure the PFN number is valid */
879  if (Pfn > MmHighestPhysicalPage) return NULL;
880 
881  /* Make sure this page actually has a PFN entry */
882  if ((MiPfnBitMap.Buffer) && !(RtlTestBit(&MiPfnBitMap, (ULONG)Pfn))) return NULL;
883 
884  /* Get the entry */
885  Page = &MmPfnDatabase[Pfn];
886 
887  /* Return it */
888  return Page;
889 };
890 
893 MiGetPfnEntryIndex(IN PMMPFN Pfn1)
894 {
895  //
896  // This will return the Page Frame Number (PFN) from the MMPFN
897  //
898  return Pfn1 - MmPfnDatabase;
899 }
900 
902 NTAPI
903 MmGetLRUNextUserPage(PFN_NUMBER PreviousPage);
904 
906 NTAPI
908 
909 VOID
910 NTAPI
912 
913 VOID
914 NTAPI
916 
917 VOID
918 NTAPI
920  IN BOOLEAN StatusOnly
921 );
922 
923 VOID
924 NTAPI
926  VOID
927 );
928 
929 /* hypermap.c *****************************************************************/
930 
931 extern PEPROCESS HyperProcess;
932 extern KIRQL HyperIrql;
933 
934 PVOID
935 NTAPI
937  IN PFN_NUMBER Page,
938  IN PKIRQL OldIrql);
939 
940 VOID
941 NTAPI
943  IN PVOID Address,
944  IN KIRQL OldIrql);
945 
946 PVOID
947 NTAPI
948 MiMapPagesInZeroSpace(IN PMMPFN Pfn1,
949  IN PFN_NUMBER NumberOfPages);
950 
951 VOID
952 NTAPI
954  IN PFN_NUMBER NumberOfPages);
955 
956 //
957 // ReactOS Compatibility Layer
958 //
960 PVOID
962 {
963  HyperProcess = (PEPROCESS)KeGetCurrentThread()->ApcState.Process;
964  return MiMapPageInHyperSpace(HyperProcess, Page, &HyperIrql);
965 }
966 
967 #define MmDeleteHyperspaceMapping(x) MiUnmapPageInHyperSpace(HyperProcess, x, HyperIrql);
968 
969 /* i386/page.c *********************************************************/
970 
971 NTSTATUS
972 NTAPI
974  struct _EPROCESS* Process,
975  PVOID Address,
976  ULONG flProtect,
977  PPFN_NUMBER Pages,
978  ULONG PageCount
979 );
980 
981 NTSTATUS
982 NTAPI
984  struct _EPROCESS* Process,
985  PVOID Address,
986  ULONG flProtect,
987  PPFN_NUMBER Pages,
988  ULONG PageCount
989 );
990 
991 ULONG
992 NTAPI
994  struct _EPROCESS* Process,
995  PVOID Address);
996 
997 VOID
998 NTAPI
1000  struct _EPROCESS* Process,
1001  PVOID Address,
1002  ULONG flProtect
1003 );
1004 
1005 BOOLEAN
1006 NTAPI
1008  struct _EPROCESS* Process,
1009  PVOID Address
1010 );
1011 
1012 BOOLEAN
1013 NTAPI
1015  struct _EPROCESS* Process,
1016  PVOID Address
1017 );
1018 
1019 VOID
1020 NTAPI
1022 
1023 VOID
1024 NTAPI
1026  struct _EPROCESS *Process,
1027  PVOID Address,
1028  SWAPENTRY* SwapEntry);
1029 
1030 VOID
1031 NTAPI
1033  struct _EPROCESS *Process,
1034  PVOID Address,
1035  SWAPENTRY* SwapEntry
1036 );
1037 
1038 NTSTATUS
1039 NTAPI
1041  struct _EPROCESS *Process,
1042  PVOID Address,
1043  SWAPENTRY SwapEntry
1044 );
1045 
1046 BOOLEAN
1047 NTAPI
1049  struct _EPROCESS *Process,
1050  PVOID Address
1051 );
1052 
1053 VOID
1054 NTAPI
1056  struct _EPROCESS *Process,
1057  PVOID Address
1058 );
1059 
1060 PFN_NUMBER
1061 NTAPI
1062 MmAllocPage(
1063  ULONG Consumer
1064 );
1065 
1066 VOID
1067 NTAPI
1069 
1070 VOID
1071 NTAPI
1073 
1074 ULONG
1075 NTAPI
1077 
1078 BOOLEAN
1079 NTAPI
1081 
1082 VOID
1083 NTAPI
1085  PFN_NUMBER Page,
1086  SWAPENTRY SavedSwapEntry);
1087 
1088 SWAPENTRY
1089 NTAPI
1091 
1092 VOID
1093 NTAPI
1095  struct _EPROCESS *Process,
1096  PVOID Address
1097 );
1098 
1099 VOID
1100 NTAPI
1102  struct _EPROCESS *Process,
1103  PVOID Address
1104 );
1105 
1106 PFN_NUMBER
1107 NTAPI
1109  struct _EPROCESS *Process,
1110  PVOID Address
1111 );
1112 
1113 BOOLEAN
1114 NTAPI
1116  IN ULONG MinWs,
1117  IN PEPROCESS Dest,
1118  IN PULONG_PTR DirectoryTableBase
1119 );
1120 
1121 NTSTATUS
1122 NTAPI
1125  IN PULONG_PTR DirectoryTableBase
1126 );
1127 
1128 
1129 NTSTATUS
1130 NTAPI
1133 );
1134 
1135 NTSTATUS
1136 NTAPI
1137 MmSetExecuteOptions(IN ULONG ExecuteOptions);
1138 
1139 NTSTATUS
1140 NTAPI
1141 MmGetExecuteOptions(IN PULONG ExecuteOptions);
1142 
1143 VOID
1144 NTAPI
1146  struct _EPROCESS *Process,
1147  PVOID Address,
1148  BOOLEAN* WasDirty,
1149  PPFN_NUMBER Page
1150 );
1151 
1152 BOOLEAN
1153 NTAPI
1155  struct _EPROCESS *Process,
1156  PVOID Address
1157 );
1158 
1159 /* wset.c ********************************************************************/
1160 
1161 NTSTATUS
1163  ULONG Target,
1164  ULONG Priority,
1165  PULONG NrFreedPages
1166 );
1167 
1168 /* region.c ************************************************************/
1169 
1170 NTSTATUS
1171 NTAPI
1173  PMMSUPPORT AddressSpace,
1174  PVOID BaseAddress,
1175  PLIST_ENTRY RegionListHead,
1176  PVOID StartAddress,
1177  SIZE_T Length,
1178  ULONG NewType,
1179  ULONG NewProtect,
1180  PMM_ALTER_REGION_FUNC AlterFunc
1181 );
1182 
1183 VOID
1184 NTAPI
1186  PLIST_ENTRY RegionListHead,
1187  SIZE_T Length,
1188  ULONG Type,
1189  ULONG Protect
1190 );
1191 
1192 PMM_REGION
1193 NTAPI
1194 MmFindRegion(
1195  PVOID BaseAddress,
1196  PLIST_ENTRY RegionListHead,
1197  PVOID Address,
1198  PVOID* RegionBaseAddress
1199 );
1200 
1201 /* section.c *****************************************************************/
1202 
1203 VOID
1204 NTAPI
1206  OUT PSECTION_IMAGE_INFORMATION ImageInformation
1207 );
1208 
1210 NTAPI
1212  IN PVOID Section
1213 );
1214 NTSTATUS
1215 NTAPI
1217  IN PVOID Address,
1219 );
1220 
1221 NTSTATUS
1222 NTAPI
1224  IN PVOID Section,
1226 );
1227 
1228 NTSTATUS
1229 NTAPI
1231  PMEMORY_AREA MemoryArea,
1232  PVOID Address,
1235 );
1236 
1237 NTSTATUS
1238 NTAPI
1240  PMMSUPPORT AddressSpace,
1241  PMEMORY_AREA MemoryArea,
1242  PVOID BaseAddress,
1243  SIZE_T Length,
1244  ULONG Protect,
1245  PULONG OldProtect
1246 );
1247 
1248 NTSTATUS
1249 NTAPI
1251 
1252 NTSTATUS
1253 NTAPI
1255  PMMSUPPORT AddressSpace,
1256  MEMORY_AREA* MemoryArea,
1257  PVOID Address,
1258  BOOLEAN Locked
1259 );
1260 
1261 NTSTATUS
1262 NTAPI
1264  PMMSUPPORT AddressSpace,
1265  PMEMORY_AREA MemoryArea,
1266  PVOID Address,
1268 );
1269 
1270 NTSTATUS
1271 NTAPI
1273 
1274 NTSTATUS
1275 NTAPI
1277  PMMSUPPORT AddressSpace,
1278  MEMORY_AREA* MemoryArea,
1279  PVOID Address
1280 );
1281 
1282 VOID
1283 NTAPI
1285 
1286 /* sysldr.c ******************************************************************/
1287 
1288 VOID
1289 NTAPI
1291  IN PLOADER_PARAMETER_BLOCK LoaderBlock
1292 );
1293 
1294 BOOLEAN
1295 NTAPI
1297  IN PLOADER_PARAMETER_BLOCK LoaderBlock
1298 );
1299 
1300 NTSTATUS
1301 NTAPI
1304  IN PUNICODE_STRING NamePrefix OPTIONAL,
1305  IN PUNICODE_STRING LoadedName OPTIONAL,
1306  IN ULONG Flags,
1307  OUT PVOID *ModuleObject,
1308  OUT PVOID *ImageBaseAddress
1309 );
1310 
1311 NTSTATUS
1312 NTAPI
1315 );
1316 
1317 NTSTATUS
1318 NTAPI
1321  IN BOOLEAN PurgeSection
1322 );
1323 
1324 NTSTATUS
1325 NTAPI
1327  IN PLDR_DATA_TABLE_ENTRY LdrEntry,
1328  IN PLIST_ENTRY ListHead
1329 );
1330 
1331 
1332 /* procsup.c *****************************************************************/
1333 
1334 NTSTATUS
1335 NTAPI
1337  IN PVOID StackPointer
1338 );
1339 
1340 
1342 VOID
1344 {
1345  KeAcquireGuardedMutex(&CONTAINING_RECORD(AddressSpace, EPROCESS, Vm)->AddressCreationLock);
1346 }
1347 
1349 VOID
1351 {
1352  KeReleaseGuardedMutex(&CONTAINING_RECORD(AddressSpace, EPROCESS, Vm)->AddressCreationLock);
1353 }
1354 
1356 PEPROCESS
1358 {
1359  if (AddressSpace == MmKernelAddressSpace) return NULL;
1360  return CONTAINING_RECORD(AddressSpace, EPROCESS, Vm);
1361 }
1362 
1364 PMMSUPPORT
1366 {
1367  return &((PEPROCESS)KeGetCurrentThread()->ApcState.Process)->Vm;
1368 }
1369 
1371 PMMSUPPORT
1373 {
1374  return MmKernelAddressSpace;
1375 }
1376 
1377 
1378 /* expool.c ******************************************************************/
1379 
1380 VOID
1381 NTAPI
1383  PVOID P,
1385  ULONG Tag);
1386 
1387 VOID
1388 NTAPI
1390  IN PVOID P);
1391 
1392 
1393 /* mmsup.c *****************************************************************/
1394 
1395 NTSTATUS
1396 NTAPI
1398  IN SIZE_T WorkingSetMinimumInBytes,
1399  IN SIZE_T WorkingSetMaximumInBytes,
1400  IN ULONG SystemCache,
1401  IN BOOLEAN IncreaseOkay);
1402 
1403 
1404 /* session.c *****************************************************************/
1405 
1407 NTSTATUS
1408 NTAPI
1409 MmAttachSession(
1410  _Inout_ PVOID SessionEntry,
1412 
1414 VOID
1415 NTAPI
1416 MmDetachSession(
1417  _Inout_ PVOID SessionEntry,
1418  _Out_ PKAPC_STATE ApcState);
1419 
1420 VOID
1421 NTAPI
1423  _Inout_ PVOID SessionEntry);
1424 
1425 PVOID
1426 NTAPI
1428  _In_ ULONG SessionId);
1429 
1431 VOID
1432 NTAPI
1433 MmSetSessionLocaleId(
1434  _In_ LCID LocaleId);
1435 
1436 
1437 /* virtual.c *****************************************************************/
1438 
1439 NTSTATUS
1440 NTAPI
1441 MmCopyVirtualMemory(IN PEPROCESS SourceProcess,
1443  IN PEPROCESS TargetProcess,
1447  OUT PSIZE_T ReturnSize);
1448 
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:1256
PRTL_BITMAP PagedPoolAllocationMap
Definition: mm.h:410
PULONG Buffer
Definition: typedefs.h:89
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:1681
BOOLEAN WriteCopy
Definition: mm.h:166
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
PVOID ULONG Address
Definition: oprghdlr.h:14
PEPROCESS Process
Definition: mm.h:235
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
union _MEMORY_AREA::@1561 Data
VOID NTAPI MmFreeSectionSegments(PFILE_OBJECT FileObject)
Definition: section.c:804
ULONG Type
Definition: mm.h:210
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:383
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:289
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:349
ULONG Signature
Definition: mm.h:400
LIST_ENTRY ListOfSegments
Definition: mm.h:176
ULONG PagesTarget
Definition: mm.h:382
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:434
MMLISTS ListName
Definition: mm.h:368
char CHAR
Definition: xmlstorage.h:175
FORCEINLINE VOID MmUnlockAddressSpace(PMMSUPPORT AddressSpace)
Definition: mm.h:1350
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:339
struct _MM_PAGED_POOL_INFO MM_PAGED_POOL_INFO
NTSTATUS NTAPI MmCreatePhysicalMemorySection(VOID)
Definition: section.c:2737
Definition: mm.h:386
struct _MM_SECTION_SEGMENT::@1558 Image
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:1045
BOOLEAN NTAPI MmIsSessionAddress(IN PVOID Address)
Definition: session.c:49
PFN_NUMBER Flink
Definition: mm.h:305
struct _EPROCESS * PEPROCESS
Definition: nt_native.h:30
_In_ KPRIORITY Priority
Definition: kefuncs.h:516
LIST_ENTRY RegionListHead
Definition: mm.h:223
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:288
PMM_SECTION_SEGMENT Segment
Definition: mm.h:222
NTSTATUS NTAPI MmCreatePageFileMapping(struct _EPROCESS *Process, PVOID Address, SWAPENTRY SwapEntry)
VOID NTAPI MiCheckAllProcessMemoryAreas(VOID)
struct _MMPFNENTRY MMPFNENTRY
union _MMPFN::@1569 u4
PVOID MmTriageActionTaken
Definition: drvmgmt.c:27
USHORT RemovalRequested
Definition: mm.h:294
PVOID MmUnloadedDrivers
Definition: sysldr.c:43
DWORD LCID
Definition: nls.h:13
ULONG CacheCount
Definition: mm.h:163
struct _MEMORY_AREA::@1561::@1563 VirtualMemoryData
_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:1831
VOID NTAPI MmDeletePageFileMapping(struct _EPROCESS *Process, PVOID Address, SWAPENTRY *SwapEntry)
NTSTATUS NTAPI MmReadFromSwapPage(SWAPENTRY SwapEntry, PFN_NUMBER Page)
Definition: pagefile.c:280
union _MMPFN::@1564 u1
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:522
USHORT ReferenceCount
Definition: mm.h:324
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:293
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:369
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:210
uint32_t ULONG_PTR
Definition: typedefs.h:63
MMWSLE Wsle
Definition: mm.h:360
USHORT PrototypePte
Definition: mm.h:291
PMM_IMAGE_SECTION_OBJECT ImageSection
Definition: mm.h:198
UCHAR KIRQL
Definition: env_spec_w32.h:591
MMPFNENTRY e1
Definition: mm.h:325
ULONG * PPFN_NUMBER
Definition: ke.h:8
ULONG Magic
Definition: mm.h:214
union _MMPFN::@1566 u3
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:295
#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:1754
ULONG_PTR MustBeCached
Definition: mm.h:351
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
NTSTATUS NTAPI MmInitSectionImplementation(VOID)
Definition: section.c:2788
PMMPTE LastPteForPagedPool
Definition: mm.h:413
ULONG Type
Definition: mm.h:388
struct _MM_MEMORY_CONSUMER * PMM_MEMORY_CONSUMER
struct _MMPFNLIST * PMMPFNLIST
ULONG_PTR ShareCount
Definition: mm.h:318
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:297
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:370
PKEVENT Event
Definition: mm.h:307
uint64_t ULONG64
Definition: typedefs.h:65
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:398
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:2454
BOOLEAN Locked
Definition: mm.h:167
VOID NTAPI MmSetCleanPage(struct _EPROCESS *Process, PVOID Address)
SIZE_T AllocatedPagedPool
Definition: mm.h:417
SIZE_T MmPeakCommitment
Definition: freelist.c:35
smooth NULL
Definition: ftsmooth.c:557
ULONG Protect
Definition: mm.h:211
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:348
SIZE_T Length
Definition: mm.h:390
#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
ROS_SECTION_OBJECT * Section
Definition: mm.h:220
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
NTSTATUS NTAPI MmGrowKernelStack(IN PVOID StackPointer)
Definition: procsup.c:461
SIZE_T PagedPoolCommit
Definition: mm.h:416
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:389
USHORT WriteInProgress
Definition: mm.h:290
UINTN Size
Definition: acefiex.h:555
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
BOOLEAN NTAPI MmIsSpecialPoolAddressFree(IN PVOID P)
PFN_COUNT Size
Definition: mm.h:399
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:253
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:396
INT POOL_TYPE
Definition: typedefs.h:76
SWAPENTRY NTAPI MmAllocSwapPage(VOID)
Definition: pagefile.c:422
uint64_t ULONGLONG
Definition: typedefs.h:65
PVOID MiDebugMapping
Definition: mmdbg.c:32
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:213
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:278
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)
_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
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
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:208
ULONG Flags
Definition: mm.h:165
LIST_ENTRY MmLoadedUserImageList
Definition: sysldr.c:35
struct _MMFREE_POOL_ENTRY * Owner
Definition: mm.h:401
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
struct _MM_REGION MM_REGION
NTSTATUS NTAPI MmSetExecuteOptions(IN ULONG ExecuteOptions)
Definition: pagfault.c:2496
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:744
_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:82
Definition: mm.h:301
Definition: btrfs_drv.h:1710
VOID(* PMM_ALTER_REGION_FUNC)(PMMSUPPORT AddressSpace, PVOID BaseAddress, SIZE_T Length, ULONG OldType, ULONG OldProtect, ULONG NewType, ULONG NewProtect)
Definition: mm.h:423
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:117
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
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:350
FORCEINLINE PMMPFN MiGetPfnEntry(IN PFN_NUMBER Pfn)
Definition: mm.h:873
NTSTATUS ReadStatus
Definition: mm.h:308
struct _MEMORY_AREA::@1561::@1562 SectionData
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:78
Definition: compat.h:484
USHORT PageColor
Definition: mm.h:292
FORCEINLINE PMMSUPPORT MmGetKernelAddressSpace(VOID)
Definition: mm.h:1372
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
LONG NTSTATUS
Definition: DriverTester.h:11
struct _MM_REGION * PMM_REGION
NTSTATUS MmTrimUserMemory(ULONG Target, ULONG Priority, PULONG NrFreedPages)
Definition: balance.c:178
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:346
struct _MMFREE_POOL_ENTRY * PMMFREE_POOL_ENTRY
PFN_COUNT MiUsedSwapPages
Definition: pagefile.c:86
PRTL_BITMAP EndOfPagedPoolBitmap
Definition: mm.h:411
PFN_NUMBER Total
Definition: mm.h:367
USHORT ShortFlags
Definition: mm.h:330
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:1411
FORCEINLINE PEPROCESS MmGetAddressSpaceOwner(IN PMMSUPPORT AddressSpace)
Definition: mm.h:1357
FORCEINLINE PVOID MmCreateHyperspaceMapping(IN PFN_NUMBER Page)
Definition: mm.h:961
_Must_inspect_result_ _In_ ULONG NewProtect
Definition: mmfuncs.h:683
ULONG SectionPageProtection
Definition: mm.h:193
USHORT Rom
Definition: mm.h:296
PMMPTE PteAddress
Definition: mm.h:314
unsigned int * PULONG
Definition: retypes.h:1
ULONG_PTR EntireFrame
Definition: mm.h:343
MMPTE OriginalPte
Definition: mm.h:335
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:312
struct _MM_RMAP_ENTRY * Next
Definition: mm.h:234
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
struct _MMPFN::@1566::@1572 e2
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:155
ULONG WsIndex
Definition: mm.h:306
enum _MI_PFN_USAGES MI_PFN_USAGES
PFN_NUMBER Blink
Definition: mm.h:317
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:893
SECTION_IMAGE_INFORMATION ImageInformation
Definition: mm.h:182
PVOID MmLastUnloadedDrivers
Definition: sysldr.c:44
#define OUT
Definition: typedefs.h:39
RTL_GENERIC_TABLE PageTable
Definition: mm.h:177
struct tagContext Context
Definition: acpixf.h:1014
PFN_COUNT MiFreeSwapPages
Definition: pagefile.c:83
unsigned int ULONG
Definition: retypes.h:1
LIST_ENTRY RegionListEntry
Definition: mm.h:391
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:259
BOOLEAN NTAPI MmIsFileObjectAPagingFile(PFILE_OBJECT FileObject)
Definition: pagefile.c:137
Definition: mm.h:232
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: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:381
VOID NTAPI MiInitializeNonPagedPool(VOID)
Definition: pool.c:276
ULONG PagedPoolHint
Definition: mm.h:415
PVOID Address
Definition: mm.h:236
ULONG_PTR InPageError
Definition: mm.h:347
LARGE_INTEGER ViewOffset
Definition: mm.h:221
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:412
KIRQL HyperIrql
Definition: hypermap.c:24
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
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:309
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:215
NTSTATUS NTAPI MmInitializeHandBuiltProcess(IN PEPROCESS Process, IN PULONG_PTR DirectoryTableBase)
Definition: procsup.c:1035
union _MMPFN::@1565 u2
#define APC_LEVEL
Definition: env_spec_w32.h:695
FORCEINLINE VOID MmLockAddressSpace(PMMSUPPORT AddressSpace)
Definition: mm.h:1343
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:212
base of all file and directory entries
Definition: entries.h:82
FORCEINLINE PMMSUPPORT MmGetCurrentAddressSpace(VOID)
Definition: mm.h:1365
* PKAPC_STATE
Definition: ketypes.h:1258
LONG AweReferenceCount
Definition: mm.h:336
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
#define P(row, col)
Definition: m_matrix.c:147
PMMPDE NextPdeForPagedPoolExpansion
Definition: mm.h:414
SIZE_T MmDriverCommit
Definition: freelist.c:32
Definition: mm.h:365