ReactOS  0.4.11-dev-433-g473ca91
mm.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <internal/arch/mm.h>
4 
5 /* TYPES *********************************************************************/
6 
7 struct _EPROCESS;
8 
18 extern ULONG MmThrottleTop;
19 extern ULONG MmThrottleBottom;
20 
22 
24 
26 
30 extern PVOID KernelVerifier;
32 
35 extern SIZE_T MmSharedCommit;
36 extern SIZE_T MmDriverCommit;
37 extern SIZE_T MmProcessCommit;
41 
42 extern PVOID MiDebugMapping; // internal
43 extern PMMPTE MmDebugPte; // internal
44 
45 struct _KTRAP_FRAME;
46 struct _EPROCESS;
48 typedef ULONG_PTR SWAPENTRY;
49 
50 //
51 // MmDbgCopyMemory Flags
52 //
53 #define MMDBG_COPY_WRITE 0x00000001
54 #define MMDBG_COPY_PHYSICAL 0x00000002
55 #define MMDBG_COPY_UNSAFE 0x00000004
56 #define MMDBG_COPY_CACHED 0x00000008
57 #define MMDBG_COPY_UNCACHED 0x00000010
58 #define MMDBG_COPY_WRITE_COMBINED 0x00000020
59 
60 //
61 // Maximum chunk size per copy
62 //
63 #define MMDBG_COPY_MAX_SIZE 0x8
64 
65 #if defined(_X86_) // intenal for marea.c
66 #define MI_STATIC_MEMORY_AREAS (14)
67 #else
68 #define MI_STATIC_MEMORY_AREAS (13)
69 #endif
70 
71 #define MEMORY_AREA_SECTION_VIEW (1)
72 #define MEMORY_AREA_CACHE (2)
73 #define MEMORY_AREA_OWNED_BY_ARM3 (15)
74 #define MEMORY_AREA_STATIC (0x80000000)
75 
76 /* Although Microsoft says this isn't hardcoded anymore,
77  they won't be able to change it. Stuff depends on it */
78 #define MM_VIRTMEM_GRANULARITY (64 * 1024)
79 
80 #define STATUS_MM_RESTART_OPERATION ((NTSTATUS)0xD0000001)
81 
82 /*
83  * Additional flags for protection attributes
84  */
85 #define PAGE_WRITETHROUGH (1024)
86 #define PAGE_SYSTEM (2048)
87 
88 #define SEC_PHYSICALMEMORY (0x80000000)
89 
90 #define MM_PAGEFILE_SEGMENT (0x1)
91 #define MM_DATAFILE_SEGMENT (0x2)
92 
93 #define MC_CACHE (0)
94 #define MC_USER (1)
95 #define MC_SYSTEM (2)
96 #define MC_MAXIMUM (3)
97 
98 #define PAGED_POOL_MASK 1
99 #define MUST_SUCCEED_POOL_MASK 2
100 #define CACHE_ALIGNED_POOL_MASK 4
101 #define QUOTA_POOL_MASK 8
102 #define SESSION_POOL_MASK 32
103 #define VERIFIER_POOL_MASK 64
104 
105 #define MAX_PAGING_FILES (16)
106 
107 // FIXME: use ALIGN_UP_BY
108 #define MM_ROUND_UP(x,s) \
109  ((PVOID)(((ULONG_PTR)(x)+(s)-1) & ~((ULONG_PTR)(s)-1)))
110 
111 #define MM_ROUND_DOWN(x,s) \
112  ((PVOID)(((ULONG_PTR)(x)) & ~((ULONG_PTR)(s)-1)))
113 
114 #define PAGE_FLAGS_VALID_FOR_SECTION \
115  (PAGE_READONLY | \
116  PAGE_READWRITE | \
117  PAGE_WRITECOPY | \
118  PAGE_EXECUTE | \
119  PAGE_EXECUTE_READ | \
120  PAGE_EXECUTE_READWRITE | \
121  PAGE_EXECUTE_WRITECOPY | \
122  PAGE_NOACCESS | \
123  PAGE_NOCACHE)
124 
125 #define PAGE_IS_READABLE \
126  (PAGE_READONLY | \
127  PAGE_READWRITE | \
128  PAGE_WRITECOPY | \
129  PAGE_EXECUTE_READ | \
130  PAGE_EXECUTE_READWRITE | \
131  PAGE_EXECUTE_WRITECOPY)
132 
133 #define PAGE_IS_WRITABLE \
134  (PAGE_READWRITE | \
135  PAGE_WRITECOPY | \
136  PAGE_EXECUTE_READWRITE | \
137  PAGE_EXECUTE_WRITECOPY)
138 
139 #define PAGE_IS_EXECUTABLE \
140  (PAGE_EXECUTE | \
141  PAGE_EXECUTE_READ | \
142  PAGE_EXECUTE_READWRITE | \
143  PAGE_EXECUTE_WRITECOPY)
144 
145 #define PAGE_IS_WRITECOPY \
146  (PAGE_WRITECOPY | \
147  PAGE_EXECUTE_WRITECOPY)
148 
149 //
150 // Wait entry for marking pages that are being serviced
151 //
152 #define MM_WAIT_ENTRY 0x7ffffc00
153 
154 #define InterlockedCompareExchangePte(PointerPte, Exchange, Comperand) \
155  InterlockedCompareExchange((PLONG)(PointerPte), Exchange, Comperand)
156 
157 #define InterlockedExchangePte(PointerPte, Value) \
158  InterlockedExchange((PLONG)(PointerPte), Value)
159 
160 typedef struct _MM_SECTION_SEGMENT
161 {
162  FAST_MUTEX Lock; /* lock which protects the page directory */
164  LARGE_INTEGER RawLength; /* length of the segment which is part of the mapped file */
165  LARGE_INTEGER Length; /* absolute length of the segment */
172 
173  struct
174  {
175  ULONGLONG FileOffset; /* start offset into the file for image sections */
176  ULONG_PTR VirtualAddress; /* start offset into the address range for image sections */
178  } Image;
179 
183 
185 {
189  PMM_SECTION_SEGMENT Segments;
191 
192 typedef struct _ROS_SECTION_OBJECT
193 {
200  union
201  {
202  PMM_IMAGE_SECTION_OBJECT ImageSection;
203  PMM_SECTION_SEGMENT Segment;
204  };
206 
207 #define MA_GetStartingAddress(_MemoryArea) ((_MemoryArea)->VadNode.StartingVpn << PAGE_SHIFT)
208 #define MA_GetEndingAddress(_MemoryArea) (((_MemoryArea)->VadNode.EndingVpn + 1) << PAGE_SHIFT)
209 
210 typedef struct _MEMORY_AREA
211 {
213 
220  union
221  {
222  struct
223  {
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 /* Page file information */
427 typedef struct _MMPAGING_FILE
428 {
438 }
440 
441 extern PMMPAGING_FILE MmPagingFile[MAX_PAGING_FILES];
442 
443 typedef VOID
447  SIZE_T Length,
448  ULONG OldType,
449  ULONG OldProtect,
450  ULONG NewType,
452 );
453 
454 typedef VOID
456  PVOID Context,
457  PMEMORY_AREA MemoryArea,
458  PVOID Address,
459  PFN_NUMBER Page,
460  SWAPENTRY SwapEntry,
461  BOOLEAN Dirty
462 );
463 
464 //
465 // Mm copy support for Kd
466 //
467 NTSTATUS
468 NTAPI
470  IN ULONG64 Address,
471  IN PVOID Buffer,
472  IN ULONG Size,
473  IN ULONG Flags
474 );
475 
476 //
477 // Determines if a given address is a session address
478 //
479 BOOLEAN
480 NTAPI
482  IN PVOID Address
483 );
484 
485 ULONG
486 NTAPI
489 );
490 
491 ULONG
492 NTAPI
495 );
496 
497 /* marea.c *******************************************************************/
498 
499 NTSTATUS
500 NTAPI
502  PMMSUPPORT AddressSpace,
503  ULONG Type,
504  PVOID *BaseAddress,
505  SIZE_T Length,
506  ULONG Protection,
507  PMEMORY_AREA *Result,
508  ULONG AllocationFlags,
509  ULONG AllocationGranularity
510 );
511 
512 PMEMORY_AREA
513 NTAPI
515  PMMSUPPORT AddressSpace,
516  PVOID Address
517 );
518 
519 NTSTATUS
520 NTAPI
522  PMMSUPPORT AddressSpace,
523  PMEMORY_AREA MemoryArea,
525  PVOID FreePageContext
526 );
527 
528 VOID
529 NTAPI
532  PMMVAD Vad);
533 
534 PMEMORY_AREA
535 NTAPI
537  PMMSUPPORT AddressSpace,
538  PVOID Address,
539  SIZE_T Length
540 );
541 
542 PVOID
543 NTAPI
544 MmFindGap(
545  PMMSUPPORT AddressSpace,
546  SIZE_T Length,
547  ULONG_PTR Granularity,
548  BOOLEAN TopDown
549 );
550 
551 VOID
552 NTAPI
554  PMMSUPPORT AddressSpace);
555 
556 VOID
557 NTAPI
559 
560 /* npool.c *******************************************************************/
561 
562 VOID
563 NTAPI
565 
566 PVOID
567 NTAPI
570  IN SIZE_T SizeInBytes
571 );
572 
573 POOL_TYPE
574 NTAPI
577 );
578 
579 ULONG
580 NTAPI
582  IN PVOID StartingAddress
583 );
584 
585 /* pool.c *******************************************************************/
586 
587 BOOLEAN
588 NTAPI
591  IN ULONG CurrentMaxQuota,
592  OUT PULONG NewMaxQuota
593 );
594 
595 /* mdl.c *********************************************************************/
596 
597 VOID
598 NTAPI
600  PMDL Mdl,
601  PPFN_NUMBER Pages
602 );
603 
604 /* mminit.c ******************************************************************/
605 
606 VOID
607 NTAPI
608 MmInit1(
609  VOID
610 );
611 
612 BOOLEAN
613 NTAPI
614 MmInitSystem(IN ULONG Phase,
615  IN PLOADER_PARAMETER_BLOCK LoaderBlock);
616 
617 
618 /* pagefile.c ****************************************************************/
619 
620 SWAPENTRY
621 NTAPI
623 
624 VOID
625 NTAPI
627 
628 VOID
629 NTAPI
631 
632 BOOLEAN
633 NTAPI
635 
636 NTSTATUS
637 NTAPI
639  SWAPENTRY SwapEntry,
640  PFN_NUMBER Page
641 );
642 
643 NTSTATUS
644 NTAPI
646  SWAPENTRY SwapEntry,
647  PFN_NUMBER Page
648 );
649 
650 VOID
651 NTAPI
653 
654 NTSTATUS
655 NTAPI
657  _In_ PFN_NUMBER Page,
658  _In_ ULONG PageFileIndex,
659  _In_ ULONG_PTR PageFileOffset);
660 
661 /* process.c ****************************************************************/
662 
663 NTSTATUS
664 NTAPI
667  IN PEPROCESS Clone OPTIONAL,
668  IN PVOID Section OPTIONAL,
669  IN OUT PULONG Flags,
670  IN POBJECT_NAME_INFORMATION *AuditName OPTIONAL
671 );
672 
673 NTSTATUS
674 NTAPI
677  IN PINITIAL_PEB InitialPeb,
678  OUT PPEB *BasePeb
679 );
680 
681 NTSTATUS
682 NTAPI
686  IN PINITIAL_TEB InitialTeb,
687  OUT PTEB* BaseTeb
688 );
689 
690 VOID
691 NTAPI
693  struct _EPROCESS *Process,
694  PTEB Teb
695 );
696 
697 VOID
698 NTAPI
700 
701 NTSTATUS
702 NTAPI
704 
705 ULONG
706 NTAPI
708 
709 NTSTATUS
710 NTAPI
713  IN UCHAR MemoryPriority
714 );
715 
716 /* i386/pfault.c *************************************************************/
717 
718 NTSTATUS
719 NTAPI
721  ULONG Cs,
722  PULONG Eip,
723  PULONG Eax,
724  ULONG Cr2,
726 );
727 
728 /* special.c *****************************************************************/
729 
730 VOID
731 NTAPI
733 
734 BOOLEAN
735 NTAPI
738  IN ULONG Tag);
739 
740 BOOLEAN
741 NTAPI
743  IN PVOID P);
744 
745 BOOLEAN
746 NTAPI
748  IN PVOID P);
749 
750 PVOID
751 NTAPI
754  IN ULONG Tag,
756  IN ULONG SpecialType);
757 
758 VOID
759 NTAPI
761  IN PVOID P);
762 
763 /* mm.c **********************************************************************/
764 
765 NTSTATUS
766 NTAPI
768  IN ULONG FaultCode,
769  IN PVOID Address,
771  IN PVOID TrapInformation
772 );
773 
774 /* kmap.c ********************************************************************/
775 
776 NTSTATUS
777 NTAPI
779  PFN_NUMBER DestPage,
780  const VOID *SrcAddress
781 );
782 
783 /* process.c *****************************************************************/
784 
785 PVOID
786 NTAPI
788 
789 VOID
790 NTAPI
792  BOOLEAN GuiStack);
793 
794 /* balace.c ******************************************************************/
795 
796 VOID
797 NTAPI
799  ULONG Consumer,
800  NTSTATUS (*Trim)(ULONG Target, ULONG Priority, PULONG NrFreed)
801 );
802 
803 VOID
804 NTAPI
806  ULONG NrAvailablePages,
807  ULONG NrSystemPages
808 );
809 
810 NTSTATUS
811 NTAPI
813  ULONG Consumer,
814  PFN_NUMBER Page
815 );
816 
817 NTSTATUS
818 NTAPI
820  ULONG Consumer,
821  BOOLEAN MyWait,
822  PPFN_NUMBER AllocatedPage
823 );
824 
825 VOID
826 NTAPI
828 
829 VOID
830 NTAPI
832 
833 /* rmap.c **************************************************************/
834 
835 VOID
836 NTAPI
838  PFN_NUMBER Page,
839  struct _MM_RMAP_ENTRY* ListHead
840 );
841 
842 struct _MM_RMAP_ENTRY*
843 NTAPI
845 
846 VOID
847 NTAPI
849  PFN_NUMBER Page,
850  struct _EPROCESS *Process,
851  PVOID Address
852 );
853 
854 VOID
855 NTAPI
857  PFN_NUMBER Page,
858  PVOID Context,
859  VOID (*DeleteMapping)(PVOID Context, struct _EPROCESS *Process, PVOID Address)
860 );
861 
862 VOID
863 NTAPI
865  PFN_NUMBER Page,
866  struct _EPROCESS *Process,
867  PVOID Address
868 );
869 
870 VOID
871 NTAPI
873 
874 VOID
875 NTAPI
877 
878 VOID
879 NTAPI
881 
882 BOOLEAN
883 NTAPI
885 
886 NTSTATUS
887 NTAPI
889 
890 /* freelist.c **********************************************************/
891 
893 KIRQL
895 {
897 }
898 
900 VOID
903 {
905 }
906 
908 VOID
910 {
911  PKSPIN_LOCK_QUEUE LockQueue;
912 
914  LockQueue = &KeGetCurrentPrcb()->LockQueue[LockQueuePfnLock];
916 }
917 
919 VOID
921 {
922  PKSPIN_LOCK_QUEUE LockQueue;
923 
924  LockQueue = &KeGetCurrentPrcb()->LockQueue[LockQueuePfnLock];
927 }
928 
929 #define MI_ASSERT_PFN_LOCK_HELD() ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL)
930 
932 PMMPFN
934 {
935  PMMPFN Page;
936  extern RTL_BITMAP MiPfnBitMap;
937 
938  /* Make sure the PFN number is valid */
939  if (Pfn > MmHighestPhysicalPage) return NULL;
940 
941  /* Make sure this page actually has a PFN entry */
942  if ((MiPfnBitMap.Buffer) && !(RtlTestBit(&MiPfnBitMap, (ULONG)Pfn))) return NULL;
943 
944  /* Get the entry */
945  Page = &MmPfnDatabase[Pfn];
946 
947  /* Return it */
948  return Page;
949 };
950 
953 MiGetPfnEntryIndex(IN PMMPFN Pfn1)
954 {
955  //
956  // This will return the Page Frame Number (PFN) from the MMPFN
957  //
958  return Pfn1 - MmPfnDatabase;
959 }
960 
962 NTAPI
963 MmGetLRUNextUserPage(PFN_NUMBER PreviousPage);
964 
966 NTAPI
968 
969 VOID
970 NTAPI
972 
973 VOID
974 NTAPI
976 
977 VOID
978 NTAPI
980  IN BOOLEAN StatusOnly
981 );
982 
983 VOID
984 NTAPI
986  VOID
987 );
988 
989 /* hypermap.c *****************************************************************/
990 
991 extern PEPROCESS HyperProcess;
992 extern KIRQL HyperIrql;
993 
994 PVOID
995 NTAPI
997  IN PFN_NUMBER Page,
998  IN PKIRQL OldIrql);
999 
1000 VOID
1001 NTAPI
1003  IN PVOID Address,
1004  IN KIRQL OldIrql);
1005 
1006 PVOID
1007 NTAPI
1008 MiMapPagesInZeroSpace(IN PMMPFN Pfn1,
1009  IN PFN_NUMBER NumberOfPages);
1010 
1011 VOID
1012 NTAPI
1014  IN PFN_NUMBER NumberOfPages);
1015 
1016 //
1017 // ReactOS Compatibility Layer
1018 //
1020 PVOID
1022 {
1023  HyperProcess = (PEPROCESS)KeGetCurrentThread()->ApcState.Process;
1024  return MiMapPageInHyperSpace(HyperProcess, Page, &HyperIrql);
1025 }
1026 
1027 #define MmDeleteHyperspaceMapping(x) MiUnmapPageInHyperSpace(HyperProcess, x, HyperIrql);
1028 
1029 /* i386/page.c *********************************************************/
1030 
1031 NTSTATUS
1032 NTAPI
1034  struct _EPROCESS* Process,
1035  PVOID Address,
1036  ULONG flProtect,
1037  PPFN_NUMBER Pages,
1038  ULONG PageCount
1039 );
1040 
1041 NTSTATUS
1042 NTAPI
1044  struct _EPROCESS* Process,
1045  PVOID Address,
1046  ULONG flProtect,
1047  PPFN_NUMBER Pages,
1048  ULONG PageCount
1049 );
1050 
1051 ULONG
1052 NTAPI
1054  struct _EPROCESS* Process,
1055  PVOID Address);
1056 
1057 VOID
1058 NTAPI
1060  struct _EPROCESS* Process,
1061  PVOID Address,
1062  ULONG flProtect
1063 );
1064 
1065 BOOLEAN
1066 NTAPI
1068  struct _EPROCESS* Process,
1069  PVOID Address
1070 );
1071 
1072 BOOLEAN
1073 NTAPI
1075  struct _EPROCESS* Process,
1076  PVOID Address
1077 );
1078 
1079 VOID
1080 NTAPI
1082 
1083 VOID
1084 NTAPI
1086  struct _EPROCESS *Process,
1087  PVOID Address,
1088  SWAPENTRY* SwapEntry);
1089 
1090 VOID
1091 NTAPI
1093  struct _EPROCESS *Process,
1094  PVOID Address,
1095  SWAPENTRY* SwapEntry
1096 );
1097 
1098 NTSTATUS
1099 NTAPI
1101  struct _EPROCESS *Process,
1102  PVOID Address,
1103  SWAPENTRY SwapEntry
1104 );
1105 
1106 BOOLEAN
1107 NTAPI
1109  struct _EPROCESS *Process,
1110  PVOID Address
1111 );
1112 
1113 VOID
1114 NTAPI
1116  struct _EPROCESS *Process,
1117  PVOID Address
1118 );
1119 
1120 PFN_NUMBER
1121 NTAPI
1122 MmAllocPage(
1123  ULONG Consumer
1124 );
1125 
1126 VOID
1127 NTAPI
1129 
1130 VOID
1131 NTAPI
1133 
1134 ULONG
1135 NTAPI
1137 
1138 BOOLEAN
1139 NTAPI
1141 
1142 VOID
1143 NTAPI
1145  PFN_NUMBER Page,
1146  SWAPENTRY SavedSwapEntry);
1147 
1148 SWAPENTRY
1149 NTAPI
1151 
1152 VOID
1153 NTAPI
1155  struct _EPROCESS *Process,
1156  PVOID Address
1157 );
1158 
1159 VOID
1160 NTAPI
1162  struct _EPROCESS *Process,
1163  PVOID Address
1164 );
1165 
1166 PFN_NUMBER
1167 NTAPI
1169  struct _EPROCESS *Process,
1170  PVOID Address
1171 );
1172 
1173 BOOLEAN
1174 NTAPI
1176  IN ULONG MinWs,
1177  IN PEPROCESS Dest,
1178  IN PULONG_PTR DirectoryTableBase
1179 );
1180 
1181 NTSTATUS
1182 NTAPI
1185  IN PULONG_PTR DirectoryTableBase
1186 );
1187 
1188 
1189 NTSTATUS
1190 NTAPI
1193 );
1194 
1195 NTSTATUS
1196 NTAPI
1197 MmSetExecuteOptions(IN ULONG ExecuteOptions);
1198 
1199 NTSTATUS
1200 NTAPI
1201 MmGetExecuteOptions(IN PULONG ExecuteOptions);
1202 
1203 VOID
1204 NTAPI
1206  struct _EPROCESS *Process,
1207  PVOID Address,
1208  BOOLEAN* WasDirty,
1209  PPFN_NUMBER Page
1210 );
1211 
1212 BOOLEAN
1213 NTAPI
1215  struct _EPROCESS *Process,
1216  PVOID Address
1217 );
1218 
1219 /* wset.c ********************************************************************/
1220 
1221 NTSTATUS
1223  ULONG Target,
1224  ULONG Priority,
1225  PULONG NrFreedPages
1226 );
1227 
1228 /* region.c ************************************************************/
1229 
1230 NTSTATUS
1231 NTAPI
1233  PMMSUPPORT AddressSpace,
1234  PVOID BaseAddress,
1235  PLIST_ENTRY RegionListHead,
1236  PVOID StartAddress,
1237  SIZE_T Length,
1238  ULONG NewType,
1239  ULONG NewProtect,
1240  PMM_ALTER_REGION_FUNC AlterFunc
1241 );
1242 
1243 VOID
1244 NTAPI
1246  PLIST_ENTRY RegionListHead,
1247  SIZE_T Length,
1248  ULONG Type,
1249  ULONG Protect
1250 );
1251 
1252 PMM_REGION
1253 NTAPI
1254 MmFindRegion(
1255  PVOID BaseAddress,
1256  PLIST_ENTRY RegionListHead,
1257  PVOID Address,
1258  PVOID* RegionBaseAddress
1259 );
1260 
1261 /* section.c *****************************************************************/
1262 
1263 VOID
1264 NTAPI
1266  OUT PSECTION_IMAGE_INFORMATION ImageInformation
1267 );
1268 
1270 NTAPI
1272  IN PVOID Section
1273 );
1274 NTSTATUS
1275 NTAPI
1277  IN PVOID Address,
1279 );
1280 
1281 NTSTATUS
1282 NTAPI
1284  IN PVOID Section,
1286 );
1287 
1288 NTSTATUS
1289 NTAPI
1291  PMEMORY_AREA MemoryArea,
1292  PVOID Address,
1295 );
1296 
1297 NTSTATUS
1298 NTAPI
1300  PMMSUPPORT AddressSpace,
1301  PMEMORY_AREA MemoryArea,
1302  PVOID BaseAddress,
1303  SIZE_T Length,
1304  ULONG Protect,
1305  PULONG OldProtect
1306 );
1307 
1308 NTSTATUS
1309 NTAPI
1311 
1312 NTSTATUS
1313 NTAPI
1315  PMMSUPPORT AddressSpace,
1316  MEMORY_AREA* MemoryArea,
1317  PVOID Address,
1318  BOOLEAN Locked
1319 );
1320 
1321 NTSTATUS
1322 NTAPI
1324  PMMSUPPORT AddressSpace,
1325  PMEMORY_AREA MemoryArea,
1326  PVOID Address,
1328 );
1329 
1330 NTSTATUS
1331 NTAPI
1333 
1334 NTSTATUS
1335 NTAPI
1337  PMMSUPPORT AddressSpace,
1338  MEMORY_AREA* MemoryArea,
1339  PVOID Address
1340 );
1341 
1342 VOID
1343 NTAPI
1345 
1346 /* sysldr.c ******************************************************************/
1347 
1348 VOID
1349 NTAPI
1351  IN PLOADER_PARAMETER_BLOCK LoaderBlock
1352 );
1353 
1354 BOOLEAN
1355 NTAPI
1357  IN PLOADER_PARAMETER_BLOCK LoaderBlock
1358 );
1359 
1360 NTSTATUS
1361 NTAPI
1364  IN PUNICODE_STRING NamePrefix OPTIONAL,
1365  IN PUNICODE_STRING LoadedName OPTIONAL,
1366  IN ULONG Flags,
1367  OUT PVOID *ModuleObject,
1368  OUT PVOID *ImageBaseAddress
1369 );
1370 
1371 NTSTATUS
1372 NTAPI
1375 );
1376 
1377 NTSTATUS
1378 NTAPI
1381  IN BOOLEAN PurgeSection
1382 );
1383 
1384 NTSTATUS
1385 NTAPI
1387  IN PLDR_DATA_TABLE_ENTRY LdrEntry,
1388  IN PLIST_ENTRY ListHead
1389 );
1390 
1391 
1392 /* procsup.c *****************************************************************/
1393 
1394 NTSTATUS
1395 NTAPI
1397  IN PVOID StackPointer
1398 );
1399 
1400 
1402 VOID
1404 {
1405  KeAcquireGuardedMutex(&CONTAINING_RECORD(AddressSpace, EPROCESS, Vm)->AddressCreationLock);
1406 }
1407 
1409 VOID
1411 {
1412  KeReleaseGuardedMutex(&CONTAINING_RECORD(AddressSpace, EPROCESS, Vm)->AddressCreationLock);
1413 }
1414 
1416 PEPROCESS
1418 {
1419  if (AddressSpace == MmKernelAddressSpace) return NULL;
1420  return CONTAINING_RECORD(AddressSpace, EPROCESS, Vm);
1421 }
1422 
1424 PMMSUPPORT
1426 {
1427  return &((PEPROCESS)KeGetCurrentThread()->ApcState.Process)->Vm;
1428 }
1429 
1431 PMMSUPPORT
1433 {
1434  return MmKernelAddressSpace;
1435 }
1436 
1437 
1438 /* expool.c ******************************************************************/
1439 
1440 VOID
1441 NTAPI
1443  PVOID P,
1445  ULONG Tag);
1446 
1447 VOID
1448 NTAPI
1450  IN PVOID P);
1451 
1452 
1453 /* mmsup.c *****************************************************************/
1454 
1455 NTSTATUS
1456 NTAPI
1458  IN SIZE_T WorkingSetMinimumInBytes,
1459  IN SIZE_T WorkingSetMaximumInBytes,
1460  IN ULONG SystemCache,
1461  IN BOOLEAN IncreaseOkay);
1462 
1463 
1464 /* session.c *****************************************************************/
1465 
1467 NTSTATUS
1468 NTAPI
1469 MmAttachSession(
1470  _Inout_ PVOID SessionEntry,
1472 
1474 VOID
1475 NTAPI
1476 MmDetachSession(
1477  _Inout_ PVOID SessionEntry,
1478  _Out_ PKAPC_STATE ApcState);
1479 
1480 VOID
1481 NTAPI
1483  _Inout_ PVOID SessionEntry);
1484 
1485 PVOID
1486 NTAPI
1488  _In_ ULONG SessionId);
1489 
1491 VOID
1492 NTAPI
1493 MmSetSessionLocaleId(
1494  _In_ LCID LocaleId);
1495 
1496 /* shutdown.c *****************************************************************/
1497 
1498 VOID
1499 MmShutdownSystem(IN ULONG Phase);
1500 
1501 /* virtual.c *****************************************************************/
1502 
1503 NTSTATUS
1504 NTAPI
1505 MmCopyVirtualMemory(IN PEPROCESS SourceProcess,
1507  IN PEPROCESS TargetProcess,
1511  OUT PSIZE_T ReturnSize);
1512 
VOID NTAPI MmDereferencePage(PFN_NUMBER Page)
Definition: freelist.c:537
DWORD *typedef PVOID
Definition: winlogon.h:61
VOID NTAPI MmSetCleanAllRmaps(PFN_NUMBER Page)
Definition: rmap.c:195
IN CINT OUT PVOID IN ULONG OUT PULONG ResultLength
Definition: conport.c:47
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
NTSTATUS NTAPI MmAccessFaultSectionView(PMMSUPPORT AddressSpace, MEMORY_AREA *MemoryArea, PVOID Address)
Definition: section.c:1690
struct _MMPFN::@1722::@1728 e2
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
VOID FASTCALL KeReleaseQueuedSpinLockFromDpcLevel(IN OUT PKSPIN_LOCK_QUEUE LockQueue)
PRTL_BITMAP PagedPoolAllocationMap
Definition: mm.h:414
PULONG Buffer
Definition: typedefs.h:89
ULONG_PTR VirtualAddress
Definition: mm.h:176
PMM_REGION NTAPI MmFindRegion(PVOID BaseAddress, PLIST_ENTRY RegionListHead, PVOID Address, PVOID *RegionBaseAddress)
Definition: region.c:257
NTSTATUS NTAPI MmCreateTeb(IN PEPROCESS Process, IN PCLIENT_ID ClientId, IN PINITIAL_TEB InitialTeb, OUT PTEB *BaseTeb)
Definition: procsup.c:741
PFILE_OBJECT NTAPI MmGetFileObjectForSection(IN PVOID Section)
Definition: section.c:1682
BOOLEAN WriteCopy
Definition: mm.h:170
PFN_NUMBER MmResidentAvailablePages
Definition: freelist.c:27
#define IN
Definition: typedefs.h:38
struct _MM_SECTION_SEGMENT::@1714 Image
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:4418
LARGE_INTEGER MaximumSize
Definition: mm.h:196
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:294
_In_ ULONG Mode
Definition: hubbusif.h:303
ULONG Characteristics
Definition: mm.h:177
Definition: ntbasedef.h:635
NTSTATUS NTAPI MmAccessFault(IN ULONG FaultCode, IN PVOID Address, IN KPROCESSOR_MODE Mode, IN PVOID TrapInformation)
Definition: mmfault.c:204
VOID FASTCALL KeAcquireGuardedMutex(IN PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:42
VOID NTAPI MmInit1(VOID)
NTSTATUS(* Trim)(ULONG Target, ULONG Priority, PULONG NrFreed)
Definition: mm.h:387
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T _In_ SECTION_INHERIT _In_ ULONG _In_ ULONG Protect
Definition: zwfuncs.h:214
NTSTATUS NTAPI MmGetFileNameForSection(IN PVOID Section, OUT POBJECT_NAME_INFORMATION *ModuleName)
Definition: section.c:1802
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)
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel)?(CompletionRoutine!=NULL):TRUE)
BOOLEAN NTAPI MmIsPageInUse(PFN_NUMBER Page)
Definition: freelist.c:530
USHORT ReadInProgress
Definition: mm.h:293
struct _MM_RMAP_ENTRY *NTAPI MmGetRmapListHeadPage(PFN_NUMBER Page)
Definition: freelist.c:427
VOID NTAPI MmDumpArmPfnDatabase(IN BOOLEAN StatusOnly)
Definition: mminit.c:1474
BOOLEAN NTAPI MiInitializeLoadedModuleList(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: sysldr.c:2200
ULONG_PTR AweAllocation
Definition: mm.h:353
ULONG Signature
Definition: mm.h:404
LIST_ENTRY ListOfSegments
Definition: mm.h:180
ULONG PagesTarget
Definition: mm.h:386
VOID NTAPI MmDeleteRmap(PFN_NUMBER Page, struct _EPROCESS *Process, PVOID Address)
_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:455
VOID MmShutdownSystem(IN ULONG Phase)
Definition: shutdown.c:41
MMLISTS ListName
Definition: mm.h:372
char CHAR
Definition: xmlstorage.h:175
FORCEINLINE VOID MmUnlockAddressSpace(PMMSUPPORT AddressSpace)
Definition: mm.h:1410
VOID NTAPI MmBuildMdlFromPages(PMDL Mdl, PPFN_NUMBER Pages)
Definition: pagefile.c:98
ULONG SessionId
Definition: dllmain.c:28
PMEMORY_AREA NTAPI MmLocateMemoryAreaByRegion(PMMSUPPORT AddressSpace, PVOID Address, SIZE_T Length)
Definition: marea.c:106
PMM_RMAP_ENTRY RmapListHead
Definition: mm.h:343
struct _MM_PAGED_POOL_INFO MM_PAGED_POOL_INFO
NTSTATUS NTAPI MmCreatePhysicalMemorySection(VOID)
Definition: section.c:2729
Definition: mm.h:390
struct _MM_RMAP_ENTRY MM_RMAP_ENTRY
PFN_NUMBER Size
Definition: mm.h:429
NTSTATUS NTAPI MiReadPageFile(_In_ PFN_NUMBER Page, _In_ ULONG PageFileIndex, _In_ ULONG_PTR PageFileOffset)
Definition: pagefile.c:201
PVOID NTAPI MmGetSessionById(_In_ ULONG SessionId)
Definition: session.c:1045
BOOLEAN NTAPI MmIsSessionAddress(IN PVOID Address)
Definition: session.c:49
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1062
PFN_NUMBER Flink
Definition: mm.h:309
struct _EPROCESS * PEPROCESS
Definition: nt_native.h:30
_In_ KPRIORITY Priority
Definition: kefuncs.h:516
LIST_ENTRY RegionListHead
Definition: mm.h:227
NTSTATUS NTAPI MmReleasePageMemoryConsumer(ULONG Consumer, PFN_NUMBER Page)
Definition: balance.c:97
SIZE_T MmSharedCommit
Definition: freelist.c:31
BOOLEAN NTAPI MmIsDirtyPageRmap(PFN_NUMBER Page)
Definition: rmap.c:239
NTSTATUS NTAPI MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN MyWait, PPFN_NUMBER AllocatedPage)
Definition: balance.c:229
FORCEINLINE KIRQL MiAcquirePfnLock(VOID)
Definition: mm.h:894
USHORT Modified
Definition: mm.h:292
PMM_SECTION_SEGMENT Segment
Definition: mm.h:226
NTSTATUS NTAPI MmCreatePageFileMapping(struct _EPROCESS *Process, PVOID Address, SWAPENTRY SwapEntry)
VOID NTAPI MiCheckAllProcessMemoryAreas(VOID)
struct _MMPFNENTRY MMPFNENTRY
VOID FASTCALL KeAcquireQueuedSpinLockAtDpcLevel(IN OUT PKSPIN_LOCK_QUEUE LockQueue)
PVOID MmTriageActionTaken
Definition: drvmgmt.c:27
USHORT RemovalRequested
Definition: mm.h:298
PVOID MmUnloadedDrivers
Definition: sysldr.c:43
DWORD LCID
Definition: nls.h:13
PFILE_OBJECT FileObject
Definition: mm.h:434
ULONG CacheCount
Definition: mm.h:167
_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:1832
VOID NTAPI MmDeletePageFileMapping(struct _EPROCESS *Process, PVOID Address, SWAPENTRY *SwapEntry)
NTSTATUS NTAPI MmReadFromSwapPage(SWAPENTRY SwapEntry, PFN_NUMBER Page)
Definition: pagefile.c:194
NTSTATUS NTAPI MmAdjustWorkingSetSize(IN SIZE_T WorkingSetMinimumInBytes, IN SIZE_T WorkingSetMaximumInBytes, IN ULONG SystemCache, IN BOOLEAN IncreaseOkay)
Definition: mmsup.c:44
PFN_NUMBER MmAvailablePages
Definition: freelist.c:26
PMEMORY_AREA NTAPI MmLocateMemoryAreaByAddress(PMMSUPPORT AddressSpace, PVOID Address)
Definition: marea.c:60
MMPFNLIST MmZeroedPageListHead
Definition: pfnlist.c:41
KMUTANT MmSystemLoadLock
Definition: sysldr.c:39
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:328
PVOID NTAPI MmAllocateSpecialPool(IN SIZE_T NumberOfBytes, IN ULONG Tag, IN POOL_TYPE PoolType, IN ULONG SpecialType)
MMPFNLIST MmStandbyPageListHead
Definition: pfnlist.c:43
FORCEINLINE VOID MiReleasePfnLock(_In_ KIRQL OldIrql)
Definition: mm.h:901
struct TraceInfo Info
USHORT PageLocation
Definition: mm.h:297
PMMPFN MmPfnDatabase
Definition: freelist.c:24
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER _Outptr_ PVOID * TargetAddress
Definition: iotypes.h:997
struct _MM_IMAGE_SECTION_OBJECT MM_IMAGE_SECTION_OBJECT
PFN_NUMBER Flink
Definition: mm.h:373
enum _MMLISTS MMLISTS
FORCEINLINE VOID MiReleasePfnLockFromDpcLevel(VOID)
Definition: mm.h:920
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
FORCEINLINE VOID MiAcquirePfnLockAtDpcLevel(VOID)
Definition: mm.h:909
MMWSLE Wsle
Definition: mm.h:364
USHORT PrototypePte
Definition: mm.h:295
PMM_IMAGE_SECTION_OBJECT ImageSection
Definition: mm.h:202
UCHAR KIRQL
Definition: env_spec_w32.h:591
MMPFNENTRY e1
Definition: mm.h:329
ULONG * PPFN_NUMBER
Definition: ke.h:8
ULONG Magic
Definition: mm.h:218
NTSTATUS NTAPI MmQuerySectionView(PMEMORY_AREA MemoryArea, PVOID Address, PMEMORY_BASIC_INFORMATION Info, PSIZE_T ResultLength)
Definition: section.c:2535
_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:259
USHORT CacheAttribute
Definition: mm.h:299
#define MC_MAXIMUM
Definition: mm.h:96
VOID NTAPI MmZeroPageThread(VOID)
Definition: zeropage.c:37
union _MEMORY_AREA::@1717 Data
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:1755
ULONG_PTR MustBeCached
Definition: mm.h:355
ULONG_PTR * PSIZE_T
Definition: typedefs.h:78
VOID NTAPI MmSetDirtyPage(struct _EPROCESS *Process, PVOID Address)
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
NTSTATUS NTAPI MmInitSectionImplementation(VOID)
Definition: section.c:2780
PMMPTE LastPteForPagedPool
Definition: mm.h:417
ULONG Type
Definition: mm.h:392
struct _MM_MEMORY_CONSUMER * PMM_MEMORY_CONSUMER
struct _MMPFNLIST * PMMPFNLIST
ULONG_PTR ShareCount
Definition: mm.h:322
SIZE_T MmTotalCommitLimit
Definition: mminit.c:359
NTSTATUS NTAPI MmCallDllInitialize(IN PLDR_DATA_TABLE_ENTRY LdrEntry, IN PLIST_ENTRY ListHead)
Definition: sysldr.c:309
ULONG Protection
Definition: mm.h:168
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
PMMSUPPORT MmKernelAddressSpace
Definition: mminit.c:29
UINTN * BufferSize
Definition: acefiex.h:370
struct _MM_RMAP_ENTRY * PMM_RMAP_ENTRY
LIST_ENTRY List
Definition: mm.h:402
struct _MMPAGING_FILE * PMMPAGING_FILE
PVOID NTAPI MiMapPageInHyperSpace(IN PEPROCESS Process, IN PFN_NUMBER Page, IN PKIRQL OldIrql)
Definition: hypermap.c:30
NTSTATUS NTAPI MmGetExecuteOptions(IN PULONG ExecuteOptions)
Definition: pagfault.c:2500
BOOLEAN Locked
Definition: mm.h:171
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:416
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:221
#define _Out_
Definition: no_sal2.h:323
NTSTATUS NTAPI MmPageOutPhysicalAddress(PFN_NUMBER Page)
Definition: rmap.c:57
Definition: bufpool.h:45
ROS_SECTION_OBJECT * Section
Definition: mm.h:224
SIZE_T MmTotalCommittedPages
Definition: freelist.c:30
VOID NTAPI MmGetPageFileMapping(struct _EPROCESS *Process, PVOID Address, SWAPENTRY *SwapEntry)
VOID NTAPI MmQuitNextSession(_Inout_ PVOID SessionEntry)
Definition: session.c:1025
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
NTSTATUS NTAPI MmGrowKernelStack(IN PVOID StackPointer)
Definition: procsup.c:460
SIZE_T PagedPoolCommit
Definition: mm.h:420
PFN_NUMBER MaximumSize
Definition: mm.h:430
PFN_NUMBER MinimumSize
Definition: mm.h:431
VOID NTAPI MmSetRmapListHeadPage(PFN_NUMBER Page, struct _MM_RMAP_ENTRY *ListHead)
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
PFILE_OBJECT FileObject
Definition: mm.h:163
UNICODE_STRING PageFileName
Definition: mm.h:435
struct _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:555
NTSTATUS NTAPI MmCheckSystemImage(IN HANDLE ImageHandle, IN BOOLEAN PurgeSection)
Definition: sysldr.c:2740
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:165
PMMPTE MmDebugPte
Definition: mmdbg.c:33
union _MMPFN::@1722 u3
ULONGLONG FileOffset
Definition: mm.h:175
FAST_MUTEX
Definition: extypes.h:17
BOOLEAN NTAPI MmIsSpecialPoolAddressFree(IN PVOID P)
PFN_COUNT Size
Definition: mm.h:403
VOID NTAPI MmCleanProcessAddressSpace(IN PEPROCESS Process)
Definition: procsup.c:1236
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
LONG NTSTATUS
Definition: precomp.h:26
PFILE_OBJECT FileObject
Definition: mm.h:199
PFN_NUMBER FreeSpace
Definition: mm.h:432
struct _MMPFNLIST MMPFNLIST
#define MAX_PAGING_FILES
Definition: mm.h:105
NTSTATUS NTAPI MmCreatePeb(IN PEPROCESS Process, IN PINITIAL_PEB InitialPeb, OUT PPEB *BasePeb)
Definition: procsup.c:501
Definition: mm.h:400
INT POOL_TYPE
Definition: typedefs.h:76
SWAPENTRY NTAPI MmAllocSwapPage(VOID)
Definition: pagefile.c:308
uint64_t ULONGLONG
Definition: typedefs.h:65
PVOID MiDebugMapping
Definition: mmdbg.c:32
BOOLEAN NTAPI MmInitSystem(IN ULONG Phase, IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: mminit.c:199
CSHORT Type
Definition: mm.h:194
NTSTATUS NTAPI MmInitializeProcessAddressSpace(IN PEPROCESS Process, IN PEPROCESS Clone OPTIONAL, IN PVOID Section OPTIONAL, IN OUT PULONG Flags, IN POBJECT_NAME_INFORMATION *AuditName OPTIONAL)
PMM_SECTION_SEGMENT Segments
Definition: mm.h:189
struct _MMPAGING_FILE MMPAGING_FILE
BOOLEAN DeleteInProgress
Definition: mm.h:217
BOOLEAN NTAPI MmIsDisabledPage(struct _EPROCESS *Process, PVOID Address)
LARGE_INTEGER RawLength
Definition: mm.h:164
NTSTATUS NTAPI MmFreeMemoryArea(PMMSUPPORT AddressSpace, PMEMORY_AREA MemoryArea, PMM_FREE_PAGE_FUNC FreePage, PVOID FreePageContext)
Definition: marea.c:278
struct _ROS_SECTION_OBJECT * PROS_SECTION_OBJECT
PVOID KernelVerifier
Definition: drvmgmt.c:28
VOID FASTCALL KeReleaseQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber, IN KIRQL OldIrql)
Definition: spinlock.c:154
PFN_NUMBER MmLowestPhysicalPage
Definition: meminit.c:30
VOID NTAPI ExReturnPoolQuota(IN PVOID P)
Definition: expool.c:1680
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)
struct _MEMORY_AREA::@1717::@1719 VirtualMemoryData
* PFILE_OBJECT
Definition: iotypes.h:1954
struct _MEMORY_AREA MEMORY_AREA
NTSTATUS NTAPI MmCreateMemoryArea(PMMSUPPORT AddressSpace, ULONG Type, PVOID *BaseAddress, SIZE_T Length, ULONG Protection, PMEMORY_AREA *Result, ULONG AllocationFlags, ULONG AllocationGranularity)
Definition: marea.c:410
ULONG NTAPI MmGetReferenceCountPage(PFN_NUMBER Page)
Definition: freelist.c:509
struct _MM_SECTION_SEGMENT * PMM_SECTION_SEGMENT
MMVAD VadNode
Definition: mm.h:212
ULONG Flags
Definition: mm.h:169
LIST_ENTRY MmLoadedUserImageList
Definition: sysldr.c:35
struct _MMFREE_POOL_ENTRY * Owner
Definition: mm.h:405
ULONG MmThrottleBottom
Definition: mminit.c:397
VOID NTAPI MmSetDirtyAllRmaps(PFN_NUMBER Page)
Definition: rmap.c:217
PVOID NTAPI MiAllocatePoolPages(IN POOL_TYPE PoolType, IN SIZE_T SizeInBytes)
Definition: pool.c:420
unsigned __int64 ULONG64
Definition: imports.h:198
PVOID NTAPI MiMapPagesInZeroSpace(IN PMMPFN Pfn1, IN PFN_NUMBER NumberOfPages)
Definition: hypermap.c:113
VOID NTAPI MiUnmapPageInHyperSpace(IN PEPROCESS Process, IN PVOID Address, IN KIRQL OldIrql)
Definition: hypermap.c:93
unsigned char UCHAR
Definition: xmlstorage.h:181
ULONG NTAPI MiFreePoolPages(IN PVOID StartingAddress)
Definition: pool.c:905
struct _MM_REGION MM_REGION
NTSTATUS NTAPI MmSetExecuteOptions(IN ULONG ExecuteOptions)
Definition: pagfault.c:2542
IN REFCLSID IN PUNKNOWN IN POOL_TYPE PoolType
Definition: unknown.h:68
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:3915
VOID NTAPI MmRemoveLRUUserPage(PFN_NUMBER Page)
Definition: freelist.c:116
#define NTSTATUS
Definition: precomp.h:20
#define VOID
Definition: acefi.h:82
Definition: mm.h:305
Definition: btrfs_drv.h:1762
VOID(* PMM_ALTER_REGION_FUNC)(PMMSUPPORT AddressSpace, PVOID BaseAddress, SIZE_T Length, ULONG OldType, ULONG OldProtect, ULONG NewType, ULONG NewProtect)
Definition: mm.h:444
KIRQL * PKIRQL
Definition: env_spec_w32.h:592
struct _MMFREE_POOL_ENTRY MMFREE_POOL_ENTRY
NTSTATUS NTAPI MmInitializeHandBuiltProcess2(IN PEPROCESS Process)
Definition: procsup.c:1059
VOID NTAPI MiInitBalancerThread(VOID)
Definition: balance.c:449
PMMPAGING_FILE MmPagingFile[MAX_PAGING_FILES]
Definition: pagefile.c:44
SIZE_T MmProcessCommit
Definition: freelist.c:33
Definition: typedefs.h:117
PFN_NUMBER NTAPI MmGetLRUFirstUserPage(VOID)
Definition: freelist.c:63
_In_ ULONG _In_ BOOLEAN _Must_inspect_result_ PVOID * VirtualAddress
Definition: ndis.h:3773
PEPROCESS HyperProcess
Definition: hypermap.c:23
ULONG ReferenceCount
Definition: mm.h:166
ACPI_EFI_HANDLE ACPI_EFI_DEVICE_PATH VOID UINTN ACPI_EFI_HANDLE * ImageHandle
Definition: acefiex.h:463
KIRQL FASTCALL KeAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber)
Definition: spinlock.c:108
struct _MMPFN MMPFN
ULONG_PTR Priority
Definition: mm.h:354
FORCEINLINE PMMPFN MiGetPfnEntry(IN PFN_NUMBER Pfn)
Definition: mm.h:933
NTSTATUS ReadStatus
Definition: mm.h:312
PFN_NUMBER NTAPI MmGetLRUNextUserPage(PFN_NUMBER PreviousPage)
Definition: freelist.c:97
BOOLEAN NTAPI MmCreateProcessAddressSpace(IN ULONG MinWs, IN PEPROCESS Dest, IN PULONG_PTR DirectoryTableBase)
ULONG MmThrottleTop
Definition: mminit.c:396
VOID NTAPI MmShowOutOfSpaceMessagePagingFile(VOID)
Definition: pagefile.c:126
HANDLE FileHandle
Definition: mm.h:437
union _MMPFN::@1721 u2
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
SIZE_T MmPagedPoolCommit
Definition: freelist.c:34
#define _In_
Definition: no_sal2.h:204
NTSTATUS NTAPI MmCreateVirtualMappingUnsafe(struct _EPROCESS *Process, PVOID Address, ULONG flProtect, PPFN_NUMBER Pages, ULONG PageCount)
ULONG_PTR SIZE_T
Definition: typedefs.h:78
Definition: compat.h:484
PFN_NUMBER CurrentUsage
Definition: mm.h:433
USHORT PageColor
Definition: mm.h:296
FORCEINLINE PMMSUPPORT MmGetKernelAddressSpace(VOID)
Definition: mm.h:1432
PFN_COUNT MmNumberOfPhysicalPages
Definition: init.c:48
DWORD *typedef HANDLE
Definition: winlogon.h:61
PRTL_BITMAP Bitmap
Definition: mm.h:436
NTSTATUS NTAPI MmDeleteProcessAddressSpace(IN PEPROCESS Process)
NTSTATUS NTAPI MmDbgCopyMemory(IN ULONG64 Address, IN PVOID Buffer, IN ULONG Size, IN ULONG Flags)
Definition: mmdbg.c:126
struct _MM_REGION * PMM_REGION
NTSTATUS MmTrimUserMemory(ULONG Target, ULONG Priority, PULONG NrFreedPages)
Definition: balance.c:178
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
struct _MEMORY_AREA::@1717::@1718 SectionData
ULONG_PTR PteFrame
Definition: mm.h:350
struct _MMFREE_POOL_ENTRY * PMMFREE_POOL_ENTRY
PFN_COUNT MiUsedSwapPages
Definition: pagefile.c:56
PRTL_BITMAP EndOfPagedPoolBitmap
Definition: mm.h:415
PFN_NUMBER Total
Definition: mm.h:371
USHORT ShortFlags
Definition: mm.h:334
struct _MMPFN * PMMPFN
ULONG_PTR SWAPENTRY
Definition: mm.h:47
NTSTATUS NTAPI MmSetMemoryPriorityProcess(IN PEPROCESS Process, IN UCHAR MemoryPriority)
Definition: procsup.c:470
_Out_ PKAPC_STATE ApcState
Definition: mm.h:1471
FORCEINLINE PEPROCESS MmGetAddressSpaceOwner(IN PMMSUPPORT AddressSpace)
Definition: mm.h:1417
FORCEINLINE PVOID MmCreateHyperspaceMapping(IN PFN_NUMBER Page)
Definition: mm.h:1021
_Must_inspect_result_ _In_ ULONG NewProtect
Definition: mmfuncs.h:683
ULONG SectionPageProtection
Definition: mm.h:197
USHORT Rom
Definition: mm.h:300
PMMPTE PteAddress
Definition: mm.h:318
unsigned int * PULONG
Definition: retypes.h:1
ULONG_PTR EntireFrame
Definition: mm.h:347
MMPTE OriginalPte
Definition: mm.h:339
struct _MM_SECTION_SEGMENT MM_SECTION_SEGMENT
VOID NTAPI MmDeleteAllRmaps(PFN_NUMBER Page, PVOID Context, VOID(*DeleteMapping)(PVOID Context, struct _EPROCESS *Process, PVOID Address))
union _MMPFN::@1725 u4
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:1685
MM_DRIVER_VERIFIER_DATA MmVerifierData
Definition: drvmgmt.c:20
ULONG MmNumberOfPagingFiles
Definition: pagefile.c:50
PFN_NUMBER MmHighestPhysicalPage
Definition: meminit.c:31
VOID NTAPI MmInitializeRegion(PLIST_ENTRY RegionListHead, SIZE_T Length, ULONG Type, ULONG Protect)
Definition: region.c:239
IN ULONG IN ULONG Tag
Definition: evtlib.h:159
ULONG WsIndex
Definition: mm.h:310
enum _MI_PFN_USAGES MI_PFN_USAGES
PFN_NUMBER Blink
Definition: mm.h:321
VOID NTAPI MmSetSavedSwapEntryPage(PFN_NUMBER Page, SWAPENTRY SavedSwapEntry)
Definition: freelist.c:454
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
NTSTATUS NTAPI MiCopyFromUserPage(PFN_NUMBER DestPage, const VOID *SrcAddress)
Definition: section.c:1043
NTSTATUS NTAPI MmProtectSectionView(PMMSUPPORT AddressSpace, PMEMORY_AREA MemoryArea, PVOID BaseAddress, SIZE_T Length, ULONG Protect, PULONG OldProtect)
Definition: section.c:2499
FAST_MUTEX Lock
Definition: mm.h:162
FORCEINLINE PFN_NUMBER MiGetPfnEntryIndex(IN PMMPFN Pfn1)
Definition: mm.h:953
SECTION_IMAGE_INFORMATION ImageInformation
Definition: mm.h:186
PVOID MmLastUnloadedDrivers
Definition: sysldr.c:44
#define OUT
Definition: typedefs.h:39
RTL_GENERIC_TABLE PageTable
Definition: mm.h:181
struct tagContext Context
Definition: acpixf.h:1014
PFN_COUNT MiFreeSwapPages
Definition: pagefile.c:53
unsigned int ULONG
Definition: retypes.h:1
LIST_ENTRY RegionListEntry
Definition: mm.h:395
BOOLEAN NTAPI MmIsFileObjectAPagingFile(PFILE_OBJECT FileObject)
Definition: pagefile.c:109
Definition: mm.h:236
VOID NTAPI MmFreeSpecialPool(IN PVOID P)
uint32_t * PULONG_PTR
Definition: typedefs.h:63
NTSTATUS NTAPI MmWriteToSwapPage(SWAPENTRY SwapEntry, PFN_NUMBER Page)
Definition: pagefile.c:137
CSHORT Size
Definition: mm.h:195
ULONG NTAPI MmGetSessionId(IN PEPROCESS Process)
Definition: session.c:180
BOOLEAN NTAPI MmUseSpecialPool(IN SIZE_T NumberOfBytes, IN ULONG Tag)
ULONG AllocationAttributes
Definition: mm.h:198
struct _MM_MEMORY_CONSUMER MM_MEMORY_CONSUMER
struct _MM_PAGED_POOL_INFO * PMM_PAGED_POOL_INFO
ULONG PagesUsed
Definition: mm.h:385
VOID NTAPI MiInitializeNonPagedPool(VOID)
Definition: pool.c:276
ULONG PagedPoolHint
Definition: mm.h:419
PVOID Address
Definition: mm.h:240
ULONG_PTR InPageError
Definition: mm.h:351
LARGE_INTEGER ViewOffset
Definition: mm.h:225
union _MMPFN::@1720 u1
BOOLEAN NTAPI MiRaisePoolQuota(IN POOL_TYPE PoolType, IN ULONG CurrentMaxQuota, OUT PULONG NewMaxQuota)
Definition: pool.c:1266
PVOID NTAPI MmCreateKernelStack(BOOLEAN GuiStack, UCHAR Node)
#define KeGetCurrentThread
Definition: hal.h:44
NTSTATUS NTAPI MmNotPresentFaultSectionView(PMMSUPPORT AddressSpace, MEMORY_AREA *MemoryArea, PVOID Address, BOOLEAN Locked)
Definition: section.c:1280
PMMPTE FirstPteForPagedPool
Definition: mm.h:416
KIRQL HyperIrql
Definition: hypermap.c:24
UCHAR MmDisablePagingExecutive
Definition: mminit.c:27
PMM_SECTION_SEGMENT Segment
Definition: mm.h:203
VOID NTAPI ExpCheckPoolAllocation(PVOID P, POOL_TYPE PoolType, ULONG Tag)
Definition: expool.c:286
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:127
_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:1034
#define APC_LEVEL
Definition: env_spec_w32.h:695
FORCEINLINE VOID MmLockAddressSpace(PMMSUPPORT AddressSpace)
Definition: mm.h:1403
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:1425
* PKAPC_STATE
Definition: ketypes.h:1273
LONG AweReferenceCount
Definition: mm.h:340
VOID NTAPI MmFreeSwapPage(SWAPENTRY Entry)
Definition: pagefile.c:278
CHAR MI_PFN_CURRENT_PROCESS_NAME[16]
Definition: pfnlist.c:64
VOID NTAPI MmDeletePageTable(struct _EPROCESS *Process, PVOID Address)
NTSTATUS NTAPI MmLoadSystemImage(IN PUNICODE_STRING FileName, IN PUNICODE_STRING NamePrefix OPTIONAL, IN PUNICODE_STRING LoadedName OPTIONAL, IN ULONG Flags, OUT PVOID *ModuleObject, OUT PVOID *ImageBaseAddress)
Definition: sysldr.c:2853
SWAPENTRY NTAPI MmGetSavedSwapEntryPage(PFN_NUMBER Page)
Definition: freelist.c:470
#define P(row, col)
Definition: m_matrix.c:147
PMMPDE NextPdeForPagedPoolExpansion
Definition: mm.h:418
SIZE_T MmDriverCommit
Definition: freelist.c:32
Definition: mm.h:369