ReactOS  0.4.10-dev-7-g0d308f4
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 // FIXME: use ALIGN_UP_BY
106 #define MM_ROUND_UP(x,s) \
107  ((PVOID)(((ULONG_PTR)(x)+(s)-1) & ~((ULONG_PTR)(s)-1)))
108 
109 #define MM_ROUND_DOWN(x,s) \
110  ((PVOID)(((ULONG_PTR)(x)) & ~((ULONG_PTR)(s)-1)))
111 
112 #define PAGE_FLAGS_VALID_FOR_SECTION \
113  (PAGE_READONLY | \
114  PAGE_READWRITE | \
115  PAGE_WRITECOPY | \
116  PAGE_EXECUTE | \
117  PAGE_EXECUTE_READ | \
118  PAGE_EXECUTE_READWRITE | \
119  PAGE_EXECUTE_WRITECOPY | \
120  PAGE_NOACCESS | \
121  PAGE_NOCACHE)
122 
123 #define PAGE_IS_READABLE \
124  (PAGE_READONLY | \
125  PAGE_READWRITE | \
126  PAGE_WRITECOPY | \
127  PAGE_EXECUTE_READ | \
128  PAGE_EXECUTE_READWRITE | \
129  PAGE_EXECUTE_WRITECOPY)
130 
131 #define PAGE_IS_WRITABLE \
132  (PAGE_READWRITE | \
133  PAGE_WRITECOPY | \
134  PAGE_EXECUTE_READWRITE | \
135  PAGE_EXECUTE_WRITECOPY)
136 
137 #define PAGE_IS_EXECUTABLE \
138  (PAGE_EXECUTE | \
139  PAGE_EXECUTE_READ | \
140  PAGE_EXECUTE_READWRITE | \
141  PAGE_EXECUTE_WRITECOPY)
142 
143 #define PAGE_IS_WRITECOPY \
144  (PAGE_WRITECOPY | \
145  PAGE_EXECUTE_WRITECOPY)
146 
147 //
148 // Wait entry for marking pages that are being serviced
149 //
150 #define MM_WAIT_ENTRY 0x7ffffc00
151 
152 #define InterlockedCompareExchangePte(PointerPte, Exchange, Comperand) \
153  InterlockedCompareExchange((PLONG)(PointerPte), Exchange, Comperand)
154 
155 #define InterlockedExchangePte(PointerPte, Value) \
156  InterlockedExchange((PLONG)(PointerPte), Value)
157 
158 typedef struct _MM_SECTION_SEGMENT
159 {
160  FAST_MUTEX Lock; /* lock which protects the page directory */
162  LARGE_INTEGER RawLength; /* length of the segment which is part of the mapped file */
163  LARGE_INTEGER Length; /* absolute length of the segment */
170 
171  struct
172  {
173  ULONGLONG FileOffset; /* start offset into the file for image sections */
174  ULONG_PTR VirtualAddress; /* start offset into the address range for image sections */
176  } Image;
177 
181 
183 {
187  PMM_SECTION_SEGMENT Segments;
189 
190 typedef struct _ROS_SECTION_OBJECT
191 {
198  union
199  {
200  PMM_IMAGE_SECTION_OBJECT ImageSection;
201  PMM_SECTION_SEGMENT Segment;
202  };
204 
205 #define MA_GetStartingAddress(_MemoryArea) ((_MemoryArea)->VadNode.StartingVpn << PAGE_SHIFT)
206 #define MA_GetEndingAddress(_MemoryArea) (((_MemoryArea)->VadNode.EndingVpn + 1) << PAGE_SHIFT)
207 
208 typedef struct _MEMORY_AREA
209 {
211 
218  union
219  {
220  struct
221  {
224  PMM_SECTION_SEGMENT Segment;
226  } SectionData;
227  struct
228  {
231  } Data;
233 
234 typedef struct _MM_RMAP_ENTRY
235 {
239 #if DBG
240  PVOID Caller;
241 #endif
242 }
244 
245 #if MI_TRACE_PFNS
248 #define MI_SET_USAGE(x) MI_PFN_CURRENT_USAGE = x
249 #define MI_SET_PROCESS2(x) memcpy(MI_PFN_CURRENT_PROCESS_NAME, x, 16)
250 #else
251 #define MI_SET_USAGE(x)
252 #define MI_SET_PROCESS2(x)
253 #endif
254 
255 typedef enum _MI_PFN_USAGES
256 {
280 } MI_PFN_USAGES;
281 
282 //
283 // These two mappings are actually used by Windows itself, based on the ASSERTS
284 //
285 #define StartOfAllocation ReadInProgress
286 #define EndOfAllocation WriteInProgress
287 
288 typedef struct _MMPFNENTRY
289 {
291  USHORT ReadInProgress:1; // StartOfAllocation
292  USHORT WriteInProgress:1; // EndOfAllocation
300 } MMPFNENTRY;
301 
302 // Mm internal
303 typedef struct _MMPFN
304 {
305  union
306  {
312 
313  // HACK for ROSPFN
315  } u1;
317  union
318  {
321  } u2;
322  union
323  {
324  struct
325  {
328  };
329  struct
330  {
333  } e2;
334  } u3;
335  union
336  {
339 
340  // HACK for ROSPFN
341  PMM_RMAP_ENTRY RmapListHead;
342  };
343  union
344  {
346  struct
347  {
354  };
355  } u4;
356 #if MI_TRACE_PFNS
357  MI_PFN_USAGES PfnUsage;
358  CHAR ProcessName[16];
359 #endif
360 
361  // HACK until WS lists are supported
363 } MMPFN, *PMMPFN;
364 
365 extern PMMPFN MmPfnDatabase;
366 
367 typedef struct _MMPFNLIST
368 {
374 
380 
381 typedef struct _MM_MEMORY_CONSUMER
382 {
387 
388 typedef struct _MM_REGION
389 {
395 
396 // Mm internal
397 /* Entry describing free pool memory */
398 typedef struct _MMFREE_POOL_ENTRY
399 {
405 
406 /* Signature of a freed block */
407 #define MM_FREE_POOL_SIGNATURE 'ARM3'
408 
409 /* Paged pool information */
410 typedef struct _MM_PAGED_POOL_INFO
411 {
421 
423 
424 typedef VOID
428  SIZE_T Length,
429  ULONG OldType,
430  ULONG OldProtect,
431  ULONG NewType,
433 );
434 
435 typedef VOID
437  PVOID Context,
438  PMEMORY_AREA MemoryArea,
439  PVOID Address,
440  PFN_NUMBER Page,
441  SWAPENTRY SwapEntry,
442  BOOLEAN Dirty
443 );
444 
445 //
446 // Mm copy support for Kd
447 //
448 NTSTATUS
449 NTAPI
451  IN ULONG64 Address,
452  IN PVOID Buffer,
453  IN ULONG Size,
454  IN ULONG Flags
455 );
456 
457 //
458 // Determines if a given address is a session address
459 //
460 BOOLEAN
461 NTAPI
463  IN PVOID Address
464 );
465 
466 ULONG
467 NTAPI
470 );
471 
472 ULONG
473 NTAPI
476 );
477 
478 /* marea.c *******************************************************************/
479 
480 NTSTATUS
481 NTAPI
483  PMMSUPPORT AddressSpace,
484  ULONG Type,
485  PVOID *BaseAddress,
486  SIZE_T Length,
487  ULONG Protection,
488  PMEMORY_AREA *Result,
489  ULONG AllocationFlags,
490  ULONG AllocationGranularity
491 );
492 
493 PMEMORY_AREA
494 NTAPI
496  PMMSUPPORT AddressSpace,
497  PVOID Address
498 );
499 
500 NTSTATUS
501 NTAPI
503  PMMSUPPORT AddressSpace,
504  PMEMORY_AREA MemoryArea,
506  PVOID FreePageContext
507 );
508 
509 VOID
510 NTAPI
513  PMMVAD Vad);
514 
515 PMEMORY_AREA
516 NTAPI
518  PMMSUPPORT AddressSpace,
519  PVOID Address,
520  SIZE_T Length
521 );
522 
523 PVOID
524 NTAPI
525 MmFindGap(
526  PMMSUPPORT AddressSpace,
527  SIZE_T Length,
528  ULONG_PTR Granularity,
529  BOOLEAN TopDown
530 );
531 
532 VOID
533 NTAPI
535  PMMSUPPORT AddressSpace);
536 
537 VOID
538 NTAPI
540 
541 /* npool.c *******************************************************************/
542 
543 VOID
544 NTAPI
546 
547 PVOID
548 NTAPI
551  IN SIZE_T SizeInBytes
552 );
553 
554 POOL_TYPE
555 NTAPI
558 );
559 
560 ULONG
561 NTAPI
563  IN PVOID StartingAddress
564 );
565 
566 /* pool.c *******************************************************************/
567 
568 BOOLEAN
569 NTAPI
572  IN ULONG CurrentMaxQuota,
573  OUT PULONG NewMaxQuota
574 );
575 
576 /* mdl.c *********************************************************************/
577 
578 VOID
579 NTAPI
581  PMDL Mdl,
582  PPFN_NUMBER Pages
583 );
584 
585 /* mminit.c ******************************************************************/
586 
587 VOID
588 NTAPI
589 MmInit1(
590  VOID
591 );
592 
593 BOOLEAN
594 NTAPI
595 MmInitSystem(IN ULONG Phase,
596  IN PLOADER_PARAMETER_BLOCK LoaderBlock);
597 
598 
599 /* pagefile.c ****************************************************************/
600 
601 SWAPENTRY
602 NTAPI
604 
605 VOID
606 NTAPI
608 
609 VOID
610 NTAPI
612 
613 BOOLEAN
614 NTAPI
616 
617 NTSTATUS
618 NTAPI
620  SWAPENTRY SwapEntry,
621  PFN_NUMBER Page
622 );
623 
624 NTSTATUS
625 NTAPI
627  SWAPENTRY SwapEntry,
628  PFN_NUMBER Page
629 );
630 
631 VOID
632 NTAPI
634 
635 NTSTATUS
636 NTAPI
638  _In_ PFN_NUMBER Page,
639  _In_ ULONG PageFileIndex,
640  _In_ ULONG_PTR PageFileOffset);
641 
642 /* process.c ****************************************************************/
643 
644 NTSTATUS
645 NTAPI
648  IN PEPROCESS Clone OPTIONAL,
649  IN PVOID Section OPTIONAL,
650  IN OUT PULONG Flags,
651  IN POBJECT_NAME_INFORMATION *AuditName OPTIONAL
652 );
653 
654 NTSTATUS
655 NTAPI
658  IN PINITIAL_PEB InitialPeb,
659  OUT PPEB *BasePeb
660 );
661 
662 NTSTATUS
663 NTAPI
667  IN PINITIAL_TEB InitialTeb,
668  OUT PTEB* BaseTeb
669 );
670 
671 VOID
672 NTAPI
674  struct _EPROCESS *Process,
675  PTEB Teb
676 );
677 
678 VOID
679 NTAPI
681 
682 NTSTATUS
683 NTAPI
685 
686 ULONG
687 NTAPI
689 
690 NTSTATUS
691 NTAPI
694  IN UCHAR MemoryPriority
695 );
696 
697 /* i386/pfault.c *************************************************************/
698 
699 NTSTATUS
700 NTAPI
702  ULONG Cs,
703  PULONG Eip,
704  PULONG Eax,
705  ULONG Cr2,
707 );
708 
709 /* special.c *****************************************************************/
710 
711 VOID
712 NTAPI
714 
715 BOOLEAN
716 NTAPI
719  IN ULONG Tag);
720 
721 BOOLEAN
722 NTAPI
724  IN PVOID P);
725 
726 BOOLEAN
727 NTAPI
729  IN PVOID P);
730 
731 PVOID
732 NTAPI
735  IN ULONG Tag,
737  IN ULONG SpecialType);
738 
739 VOID
740 NTAPI
742  IN PVOID P);
743 
744 /* mm.c **********************************************************************/
745 
746 NTSTATUS
747 NTAPI
749  IN ULONG FaultCode,
750  IN PVOID Address,
752  IN PVOID TrapInformation
753 );
754 
755 /* kmap.c ********************************************************************/
756 
757 NTSTATUS
758 NTAPI
760  PFN_NUMBER DestPage,
761  const VOID *SrcAddress
762 );
763 
764 /* process.c *****************************************************************/
765 
766 PVOID
767 NTAPI
769 
770 VOID
771 NTAPI
773  BOOLEAN GuiStack);
774 
775 /* balace.c ******************************************************************/
776 
777 VOID
778 NTAPI
780  ULONG Consumer,
781  NTSTATUS (*Trim)(ULONG Target, ULONG Priority, PULONG NrFreed)
782 );
783 
784 VOID
785 NTAPI
787  ULONG NrAvailablePages,
788  ULONG NrSystemPages
789 );
790 
791 NTSTATUS
792 NTAPI
794  ULONG Consumer,
795  PFN_NUMBER Page
796 );
797 
798 NTSTATUS
799 NTAPI
801  ULONG Consumer,
802  BOOLEAN MyWait,
803  PPFN_NUMBER AllocatedPage
804 );
805 
806 VOID
807 NTAPI
809 
810 VOID
811 NTAPI
813 
814 /* rmap.c **************************************************************/
815 
816 VOID
817 NTAPI
819  PFN_NUMBER Page,
820  struct _MM_RMAP_ENTRY* ListHead
821 );
822 
823 struct _MM_RMAP_ENTRY*
824 NTAPI
826 
827 VOID
828 NTAPI
830  PFN_NUMBER Page,
831  struct _EPROCESS *Process,
832  PVOID Address
833 );
834 
835 VOID
836 NTAPI
838  PFN_NUMBER Page,
839  PVOID Context,
840  VOID (*DeleteMapping)(PVOID Context, struct _EPROCESS *Process, PVOID Address)
841 );
842 
843 VOID
844 NTAPI
846  PFN_NUMBER Page,
847  struct _EPROCESS *Process,
848  PVOID Address
849 );
850 
851 VOID
852 NTAPI
854 
855 VOID
856 NTAPI
858 
859 VOID
860 NTAPI
862 
863 BOOLEAN
864 NTAPI
866 
867 NTSTATUS
868 NTAPI
870 
871 /* freelist.c **********************************************************/
872 
874 KIRQL
876 {
878 }
879 
881 VOID
884 {
886 }
887 
889 VOID
891 {
892  PKSPIN_LOCK_QUEUE LockQueue;
893 
895  LockQueue = &KeGetCurrentPrcb()->LockQueue[LockQueuePfnLock];
897 }
898 
900 VOID
902 {
903  PKSPIN_LOCK_QUEUE LockQueue;
904 
905  LockQueue = &KeGetCurrentPrcb()->LockQueue[LockQueuePfnLock];
908 }
909 
910 #define MI_ASSERT_PFN_LOCK_HELD() ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL)
911 
913 PMMPFN
915 {
916  PMMPFN Page;
917  extern RTL_BITMAP MiPfnBitMap;
918 
919  /* Make sure the PFN number is valid */
920  if (Pfn > MmHighestPhysicalPage) return NULL;
921 
922  /* Make sure this page actually has a PFN entry */
923  if ((MiPfnBitMap.Buffer) && !(RtlTestBit(&MiPfnBitMap, (ULONG)Pfn))) return NULL;
924 
925  /* Get the entry */
926  Page = &MmPfnDatabase[Pfn];
927 
928  /* Return it */
929  return Page;
930 };
931 
934 MiGetPfnEntryIndex(IN PMMPFN Pfn1)
935 {
936  //
937  // This will return the Page Frame Number (PFN) from the MMPFN
938  //
939  return Pfn1 - MmPfnDatabase;
940 }
941 
943 NTAPI
944 MmGetLRUNextUserPage(PFN_NUMBER PreviousPage);
945 
947 NTAPI
949 
950 VOID
951 NTAPI
953 
954 VOID
955 NTAPI
957 
958 VOID
959 NTAPI
961  IN BOOLEAN StatusOnly
962 );
963 
964 VOID
965 NTAPI
967  VOID
968 );
969 
970 /* hypermap.c *****************************************************************/
971 
972 extern PEPROCESS HyperProcess;
973 extern KIRQL HyperIrql;
974 
975 PVOID
976 NTAPI
978  IN PFN_NUMBER Page,
979  IN PKIRQL OldIrql);
980 
981 VOID
982 NTAPI
984  IN PVOID Address,
985  IN KIRQL OldIrql);
986 
987 PVOID
988 NTAPI
989 MiMapPagesInZeroSpace(IN PMMPFN Pfn1,
990  IN PFN_NUMBER NumberOfPages);
991 
992 VOID
993 NTAPI
995  IN PFN_NUMBER NumberOfPages);
996 
997 //
998 // ReactOS Compatibility Layer
999 //
1001 PVOID
1003 {
1004  HyperProcess = (PEPROCESS)KeGetCurrentThread()->ApcState.Process;
1005  return MiMapPageInHyperSpace(HyperProcess, Page, &HyperIrql);
1006 }
1007 
1008 #define MmDeleteHyperspaceMapping(x) MiUnmapPageInHyperSpace(HyperProcess, x, HyperIrql);
1009 
1010 /* i386/page.c *********************************************************/
1011 
1012 NTSTATUS
1013 NTAPI
1015  struct _EPROCESS* Process,
1016  PVOID Address,
1017  ULONG flProtect,
1018  PPFN_NUMBER Pages,
1019  ULONG PageCount
1020 );
1021 
1022 NTSTATUS
1023 NTAPI
1025  struct _EPROCESS* Process,
1026  PVOID Address,
1027  ULONG flProtect,
1028  PPFN_NUMBER Pages,
1029  ULONG PageCount
1030 );
1031 
1032 ULONG
1033 NTAPI
1035  struct _EPROCESS* Process,
1036  PVOID Address);
1037 
1038 VOID
1039 NTAPI
1041  struct _EPROCESS* Process,
1042  PVOID Address,
1043  ULONG flProtect
1044 );
1045 
1046 BOOLEAN
1047 NTAPI
1049  struct _EPROCESS* Process,
1050  PVOID Address
1051 );
1052 
1053 BOOLEAN
1054 NTAPI
1056  struct _EPROCESS* Process,
1057  PVOID Address
1058 );
1059 
1060 VOID
1061 NTAPI
1063 
1064 VOID
1065 NTAPI
1067  struct _EPROCESS *Process,
1068  PVOID Address,
1069  SWAPENTRY* SwapEntry);
1070 
1071 VOID
1072 NTAPI
1074  struct _EPROCESS *Process,
1075  PVOID Address,
1076  SWAPENTRY* SwapEntry
1077 );
1078 
1079 NTSTATUS
1080 NTAPI
1082  struct _EPROCESS *Process,
1083  PVOID Address,
1084  SWAPENTRY SwapEntry
1085 );
1086 
1087 BOOLEAN
1088 NTAPI
1090  struct _EPROCESS *Process,
1091  PVOID Address
1092 );
1093 
1094 VOID
1095 NTAPI
1097  struct _EPROCESS *Process,
1098  PVOID Address
1099 );
1100 
1101 PFN_NUMBER
1102 NTAPI
1103 MmAllocPage(
1104  ULONG Consumer
1105 );
1106 
1107 VOID
1108 NTAPI
1110 
1111 VOID
1112 NTAPI
1114 
1115 ULONG
1116 NTAPI
1118 
1119 BOOLEAN
1120 NTAPI
1122 
1123 VOID
1124 NTAPI
1126  PFN_NUMBER Page,
1127  SWAPENTRY SavedSwapEntry);
1128 
1129 SWAPENTRY
1130 NTAPI
1132 
1133 VOID
1134 NTAPI
1136  struct _EPROCESS *Process,
1137  PVOID Address
1138 );
1139 
1140 VOID
1141 NTAPI
1143  struct _EPROCESS *Process,
1144  PVOID Address
1145 );
1146 
1147 PFN_NUMBER
1148 NTAPI
1150  struct _EPROCESS *Process,
1151  PVOID Address
1152 );
1153 
1154 BOOLEAN
1155 NTAPI
1157  IN ULONG MinWs,
1158  IN PEPROCESS Dest,
1159  IN PULONG_PTR DirectoryTableBase
1160 );
1161 
1162 NTSTATUS
1163 NTAPI
1166  IN PULONG_PTR DirectoryTableBase
1167 );
1168 
1169 
1170 NTSTATUS
1171 NTAPI
1174 );
1175 
1176 NTSTATUS
1177 NTAPI
1178 MmSetExecuteOptions(IN ULONG ExecuteOptions);
1179 
1180 NTSTATUS
1181 NTAPI
1182 MmGetExecuteOptions(IN PULONG ExecuteOptions);
1183 
1184 VOID
1185 NTAPI
1187  struct _EPROCESS *Process,
1188  PVOID Address,
1189  BOOLEAN* WasDirty,
1190  PPFN_NUMBER Page
1191 );
1192 
1193 BOOLEAN
1194 NTAPI
1196  struct _EPROCESS *Process,
1197  PVOID Address
1198 );
1199 
1200 /* wset.c ********************************************************************/
1201 
1202 NTSTATUS
1204  ULONG Target,
1205  ULONG Priority,
1206  PULONG NrFreedPages
1207 );
1208 
1209 /* region.c ************************************************************/
1210 
1211 NTSTATUS
1212 NTAPI
1214  PMMSUPPORT AddressSpace,
1215  PVOID BaseAddress,
1216  PLIST_ENTRY RegionListHead,
1217  PVOID StartAddress,
1218  SIZE_T Length,
1219  ULONG NewType,
1220  ULONG NewProtect,
1221  PMM_ALTER_REGION_FUNC AlterFunc
1222 );
1223 
1224 VOID
1225 NTAPI
1227  PLIST_ENTRY RegionListHead,
1228  SIZE_T Length,
1229  ULONG Type,
1230  ULONG Protect
1231 );
1232 
1233 PMM_REGION
1234 NTAPI
1235 MmFindRegion(
1236  PVOID BaseAddress,
1237  PLIST_ENTRY RegionListHead,
1238  PVOID Address,
1239  PVOID* RegionBaseAddress
1240 );
1241 
1242 /* section.c *****************************************************************/
1243 
1244 VOID
1245 NTAPI
1247  OUT PSECTION_IMAGE_INFORMATION ImageInformation
1248 );
1249 
1251 NTAPI
1253  IN PVOID Section
1254 );
1255 NTSTATUS
1256 NTAPI
1258  IN PVOID Address,
1260 );
1261 
1262 NTSTATUS
1263 NTAPI
1265  IN PVOID Section,
1267 );
1268 
1269 NTSTATUS
1270 NTAPI
1272  PMEMORY_AREA MemoryArea,
1273  PVOID Address,
1276 );
1277 
1278 NTSTATUS
1279 NTAPI
1281  PMMSUPPORT AddressSpace,
1282  PMEMORY_AREA MemoryArea,
1283  PVOID BaseAddress,
1284  SIZE_T Length,
1285  ULONG Protect,
1286  PULONG OldProtect
1287 );
1288 
1289 NTSTATUS
1290 NTAPI
1292 
1293 NTSTATUS
1294 NTAPI
1296  PMMSUPPORT AddressSpace,
1297  MEMORY_AREA* MemoryArea,
1298  PVOID Address,
1299  BOOLEAN Locked
1300 );
1301 
1302 NTSTATUS
1303 NTAPI
1305  PMMSUPPORT AddressSpace,
1306  PMEMORY_AREA MemoryArea,
1307  PVOID Address,
1309 );
1310 
1311 NTSTATUS
1312 NTAPI
1314 
1315 NTSTATUS
1316 NTAPI
1318  PMMSUPPORT AddressSpace,
1319  MEMORY_AREA* MemoryArea,
1320  PVOID Address
1321 );
1322 
1323 VOID
1324 NTAPI
1326 
1327 /* sysldr.c ******************************************************************/
1328 
1329 VOID
1330 NTAPI
1332  IN PLOADER_PARAMETER_BLOCK LoaderBlock
1333 );
1334 
1335 BOOLEAN
1336 NTAPI
1338  IN PLOADER_PARAMETER_BLOCK LoaderBlock
1339 );
1340 
1341 NTSTATUS
1342 NTAPI
1345  IN PUNICODE_STRING NamePrefix OPTIONAL,
1346  IN PUNICODE_STRING LoadedName OPTIONAL,
1347  IN ULONG Flags,
1348  OUT PVOID *ModuleObject,
1349  OUT PVOID *ImageBaseAddress
1350 );
1351 
1352 NTSTATUS
1353 NTAPI
1356 );
1357 
1358 NTSTATUS
1359 NTAPI
1362  IN BOOLEAN PurgeSection
1363 );
1364 
1365 NTSTATUS
1366 NTAPI
1368  IN PLDR_DATA_TABLE_ENTRY LdrEntry,
1369  IN PLIST_ENTRY ListHead
1370 );
1371 
1372 
1373 /* procsup.c *****************************************************************/
1374 
1375 NTSTATUS
1376 NTAPI
1378  IN PVOID StackPointer
1379 );
1380 
1381 
1383 VOID
1385 {
1386  KeAcquireGuardedMutex(&CONTAINING_RECORD(AddressSpace, EPROCESS, Vm)->AddressCreationLock);
1387 }
1388 
1390 VOID
1392 {
1393  KeReleaseGuardedMutex(&CONTAINING_RECORD(AddressSpace, EPROCESS, Vm)->AddressCreationLock);
1394 }
1395 
1397 PEPROCESS
1399 {
1400  if (AddressSpace == MmKernelAddressSpace) return NULL;
1401  return CONTAINING_RECORD(AddressSpace, EPROCESS, Vm);
1402 }
1403 
1405 PMMSUPPORT
1407 {
1408  return &((PEPROCESS)KeGetCurrentThread()->ApcState.Process)->Vm;
1409 }
1410 
1412 PMMSUPPORT
1414 {
1415  return MmKernelAddressSpace;
1416 }
1417 
1418 
1419 /* expool.c ******************************************************************/
1420 
1421 VOID
1422 NTAPI
1424  PVOID P,
1426  ULONG Tag);
1427 
1428 VOID
1429 NTAPI
1431  IN PVOID P);
1432 
1433 
1434 /* mmsup.c *****************************************************************/
1435 
1436 NTSTATUS
1437 NTAPI
1439  IN SIZE_T WorkingSetMinimumInBytes,
1440  IN SIZE_T WorkingSetMaximumInBytes,
1441  IN ULONG SystemCache,
1442  IN BOOLEAN IncreaseOkay);
1443 
1444 
1445 /* session.c *****************************************************************/
1446 
1448 NTSTATUS
1449 NTAPI
1450 MmAttachSession(
1451  _Inout_ PVOID SessionEntry,
1453 
1455 VOID
1456 NTAPI
1457 MmDetachSession(
1458  _Inout_ PVOID SessionEntry,
1459  _Out_ PKAPC_STATE ApcState);
1460 
1461 VOID
1462 NTAPI
1464  _Inout_ PVOID SessionEntry);
1465 
1466 PVOID
1467 NTAPI
1469  _In_ ULONG SessionId);
1470 
1472 VOID
1473 NTAPI
1474 MmSetSessionLocaleId(
1475  _In_ LCID LocaleId);
1476 
1477 
1478 /* virtual.c *****************************************************************/
1479 
1480 NTSTATUS
1481 NTAPI
1482 MmCopyVirtualMemory(IN PEPROCESS SourceProcess,
1484  IN PEPROCESS TargetProcess,
1488  OUT PSIZE_T ReturnSize);
1489 
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
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
NTSTATUS NTAPI MmAccessFaultSectionView(PMMSUPPORT AddressSpace, MEMORY_AREA *MemoryArea, PVOID Address)
Definition: section.c:1690
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:412
PULONG Buffer
Definition: typedefs.h:89
ULONG_PTR VirtualAddress
Definition: mm.h:174
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:168
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:237
MM_MEMORY_CONSUMER MiMemoryConsumers[MC_MAXIMUM]
Definition: balance.c:36
VOID NTAPI MmInsertRmap(PFN_NUMBER Page, struct _EPROCESS *Process, PVOID Address)
union _MMPFN::@1665 u3
SIZE_T MmtotalCommitLimitMaximum
Definition: freelist.c:36
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4418
LARGE_INTEGER MaximumSize
Definition: mm.h:194
VOID NTAPI MmFreeSectionSegments(PFILE_OBJECT FileObject)
Definition: section.c:804
ULONG Type
Definition: mm.h:212
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:296
_In_ ULONG Mode
Definition: hubbusif.h:303
ULONG Characteristics
Definition: mm.h:175
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:385
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T _In_ SECTION_INHERIT _In_ ULONG _In_ ULONG Protect
Definition: zwfuncs.h:214
NTSTATUS NTAPI MmGetFileNameForSection(IN PVOID Section, OUT POBJECT_NAME_INFORMATION *ModuleName)
Definition: section.c:1801
NTSTATUS NTAPI MmCreateVirtualMapping(struct _EPROCESS *Process, PVOID Address, ULONG flProtect, PPFN_NUMBER Pages, ULONG PageCount)
ULONG PFN_COUNT
Definition: mmtypes.h:102
ULONG NTAPI MmGetPageProtect(struct _EPROCESS *Process, PVOID Address)
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel)?(CompletionRoutine!=NULL):TRUE)
BOOLEAN NTAPI MmIsPageInUse(PFN_NUMBER Page)
Definition: freelist.c:530
USHORT ReadInProgress
Definition: mm.h:291
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:2188
ULONG_PTR AweAllocation
Definition: mm.h:351
ULONG Signature
Definition: mm.h:402
LIST_ENTRY ListOfSegments
Definition: mm.h:178
ULONG PagesTarget
Definition: mm.h:384
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:436
MMLISTS ListName
Definition: mm.h:370
char CHAR
Definition: xmlstorage.h:175
FORCEINLINE VOID MmUnlockAddressSpace(PMMSUPPORT AddressSpace)
Definition: mm.h:1391
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:341
struct _MM_PAGED_POOL_INFO MM_PAGED_POOL_INFO
NTSTATUS NTAPI MmCreatePhysicalMemorySection(VOID)
Definition: section.c:2735
Definition: mm.h:388
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
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1054
PFN_NUMBER Flink
Definition: mm.h:307
struct _EPROCESS * PEPROCESS
Definition: nt_native.h:30
_In_ KPRIORITY Priority
Definition: kefuncs.h:516
LIST_ENTRY RegionListHead
Definition: mm.h:225
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:875
USHORT Modified
Definition: mm.h:290
PMM_SECTION_SEGMENT Segment
Definition: mm.h:224
union _MMPFN::@1663 u1
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:296
PVOID MmUnloadedDrivers
Definition: sysldr.c:43
DWORD LCID
Definition: nls.h:13
ULONG CacheCount
Definition: mm.h:165
_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
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:326
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:882
struct TraceInfo Info
USHORT PageLocation
Definition: mm.h:295
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:371
enum _MMLISTS MMLISTS
FORCEINLINE VOID MiReleasePfnLockFromDpcLevel(VOID)
Definition: mm.h:901
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:890
MMWSLE Wsle
Definition: mm.h:362
USHORT PrototypePte
Definition: mm.h:293
PMM_IMAGE_SECTION_OBJECT ImageSection
Definition: mm.h:200
UCHAR KIRQL
Definition: env_spec_w32.h:591
MMPFNENTRY e1
Definition: mm.h:327
ULONG * PPFN_NUMBER
Definition: ke.h:8
ULONG Magic
Definition: mm.h:216
NTSTATUS NTAPI MmQuerySectionView(PMEMORY_AREA MemoryArea, PVOID Address, PMEMORY_BASIC_INFORMATION Info, PSIZE_T ResultLength)
Definition: section.c:2541
_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:297
#define MC_MAXIMUM
Definition: mm.h:96
VOID NTAPI MmZeroPageThread(VOID)
Definition: zeropage.c:37
RTL_BITMAP MiPfnBitMap
Definition: init.c:44
ULONG PFN_NUMBER
Definition: ke.h:8
NTSTATUS NTAPI MmAlterRegion(PMMSUPPORT AddressSpace, PVOID BaseAddress, PLIST_ENTRY RegionListHead, PVOID StartAddress, SIZE_T Length, ULONG NewType, ULONG NewProtect, PMM_ALTER_REGION_FUNC AlterFunc)
Definition: region.c:108
VOID NTAPI MmGetImageInformation(OUT PSECTION_IMAGE_INFORMATION ImageInformation)
Definition: section.c:1754
ULONG_PTR MustBeCached
Definition: mm.h:353
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:2786
PMMPTE LastPteForPagedPool
Definition: mm.h:415
ULONG Type
Definition: mm.h:390
struct _MM_MEMORY_CONSUMER * PMM_MEMORY_CONSUMER
struct _MMPFNLIST * PMMPFNLIST
ULONG_PTR ShareCount
Definition: mm.h:320
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:166
VOID NTAPI MmRebalanceMemoryConsumers(VOID)
Definition: balance.c:218
long LONG
Definition: pedump.c:60
USHORT ParityError
Definition: mm.h:299
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:372
PKEVENT Event
Definition: mm.h:309
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:400
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:169
VOID NTAPI MmSetCleanPage(struct _EPROCESS *Process, PVOID Address)
SIZE_T AllocatedPagedPool
Definition: mm.h:419
SIZE_T MmPeakCommitment
Definition: freelist.c:35
smooth NULL
Definition: ftsmooth.c:416
ULONG Protect
Definition: mm.h:213
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:350
SIZE_T Length
Definition: mm.h:392
#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:222
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:461
SIZE_T PagedPoolCommit
Definition: mm.h:418
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:161
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:391
USHORT WriteInProgress
Definition: mm.h:292
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:163
PMMPTE MmDebugPte
Definition: mmdbg.c:33
ULONGLONG FileOffset
Definition: mm.h:173
FAST_MUTEX
Definition: extypes.h:17
BOOLEAN NTAPI MmIsSpecialPoolAddressFree(IN PVOID P)
PFN_COUNT Size
Definition: mm.h:401
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
union _MMPFN::@1668 u4
_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:255
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:197
struct _MMPFNLIST MMPFNLIST
NTSTATUS NTAPI MmCreatePeb(IN PEPROCESS Process, IN PINITIAL_PEB InitialPeb, OUT PPEB *BasePeb)
Definition: procsup.c:502
Definition: mm.h:398
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:199
CSHORT Type
Definition: mm.h:192
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:187
BOOLEAN DeleteInProgress
Definition: mm.h:215
BOOLEAN NTAPI MmIsDisabledPage(struct _EPROCESS *Process, PVOID Address)
LARGE_INTEGER RawLength
Definition: mm.h:162
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)
* 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:210
ULONG Flags
Definition: mm.h:167
LIST_ENTRY MmLoadedUserImageList
Definition: sysldr.c:35
struct _MMFREE_POOL_ENTRY * Owner
Definition: mm.h:403
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:901
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
struct _MEMORY_AREA::@1660::@1661 SectionData
struct _MMPFN::@1665::@1671 e2
#define VOID
Definition: acefi.h:82
Definition: mm.h:303
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:425
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:3773
PEPROCESS HyperProcess
Definition: hypermap.c:23
ULONG ReferenceCount
Definition: mm.h:164
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:352
FORCEINLINE PMMPFN MiGetPfnEntry(IN PFN_NUMBER Pfn)
Definition: mm.h:914
NTSTATUS ReadStatus
Definition: mm.h:310
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:154
#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
USHORT PageColor
Definition: mm.h:294
FORCEINLINE PMMSUPPORT MmGetKernelAddressSpace(VOID)
Definition: mm.h:1413
PFN_COUNT MmNumberOfPhysicalPages
Definition: init.c:48
DWORD *typedef HANDLE
Definition: winlogon.h:52
NTSTATUS NTAPI MmDeleteProcessAddressSpace(IN PEPROCESS Process)
NTSTATUS NTAPI MmDbgCopyMemory(IN ULONG64 Address, IN PVOID Buffer, IN ULONG Size, IN ULONG Flags)
Definition: mmdbg.c:126
struct _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:348
struct _MMFREE_POOL_ENTRY * PMMFREE_POOL_ENTRY
PFN_COUNT MiUsedSwapPages
Definition: pagefile.c:86
union _MMPFN::@1664 u2
PRTL_BITMAP EndOfPagedPoolBitmap
Definition: mm.h:413
PFN_NUMBER Total
Definition: mm.h:369
USHORT ShortFlags
Definition: mm.h:332
struct _MMPFN * PMMPFN
ULONG_PTR SWAPENTRY
Definition: mm.h:47
NTSTATUS NTAPI MmSetMemoryPriorityProcess(IN PEPROCESS Process, IN UCHAR MemoryPriority)
Definition: procsup.c:471
_Out_ PKAPC_STATE ApcState
Definition: mm.h:1452
FORCEINLINE PEPROCESS MmGetAddressSpaceOwner(IN PMMSUPPORT AddressSpace)
Definition: mm.h:1398
FORCEINLINE PVOID MmCreateHyperspaceMapping(IN PFN_NUMBER Page)
Definition: mm.h:1002
_Must_inspect_result_ _In_ ULONG NewProtect
Definition: mmfuncs.h:683
ULONG SectionPageProtection
Definition: mm.h:195
USHORT Rom
Definition: mm.h:298
PMMPTE PteAddress
Definition: mm.h:316
unsigned int * PULONG
Definition: retypes.h:1
ULONG_PTR EntireFrame
Definition: mm.h:345
MMPTE OriginalPte
Definition: mm.h:337
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:314
struct _MEMORY_AREA::@1660::@1662 VirtualMemoryData
struct _MM_RMAP_ENTRY * Next
Definition: mm.h:236
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
struct _MM_SECTION_SEGMENT::@1657 Image
ULONG MmNumberOfPagingFiles
Definition: pagefile.c:80
PFN_NUMBER MmHighestPhysicalPage
Definition: meminit.c:31
VOID NTAPI MmInitializeRegion(PLIST_ENTRY RegionListHead, SIZE_T Length, ULONG Type, ULONG Protect)
Definition: region.c:239
IN ULONG IN ULONG Tag
Definition: evtlib.h:159
ULONG WsIndex
Definition: mm.h:308
union _MEMORY_AREA::@1660 Data
enum _MI_PFN_USAGES MI_PFN_USAGES
PFN_NUMBER Blink
Definition: mm.h:319
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:2505
FAST_MUTEX Lock
Definition: mm.h:160
FORCEINLINE PFN_NUMBER MiGetPfnEntryIndex(IN PMMPFN Pfn1)
Definition: mm.h:934
SECTION_IMAGE_INFORMATION ImageInformation
Definition: mm.h:184
PVOID MmLastUnloadedDrivers
Definition: sysldr.c:44
#define OUT
Definition: typedefs.h:39
RTL_GENERIC_TABLE PageTable
Definition: mm.h:179
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:393
BOOLEAN NTAPI MmIsFileObjectAPagingFile(PFILE_OBJECT FileObject)
Definition: pagefile.c:137
Definition: mm.h:234
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:193
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:196
struct _MM_MEMORY_CONSUMER MM_MEMORY_CONSUMER
struct _MM_PAGED_POOL_INFO * PMM_PAGED_POOL_INFO
ULONG PagesUsed
Definition: mm.h:383
VOID NTAPI MiInitializeNonPagedPool(VOID)
Definition: pool.c:276
ULONG PagedPoolHint
Definition: mm.h:417
PVOID Address
Definition: mm.h:238
ULONG_PTR InPageError
Definition: mm.h:349
LARGE_INTEGER ViewOffset
Definition: mm.h:223
BOOLEAN NTAPI MiRaisePoolQuota(IN POOL_TYPE PoolType, IN ULONG CurrentMaxQuota, OUT PULONG NewMaxQuota)
Definition: pool.c:1262
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:414
KIRQL HyperIrql
Definition: hypermap.c:24
UCHAR MmDisablePagingExecutive
Definition: mminit.c:27
PMM_SECTION_SEGMENT Segment
Definition: mm.h:201
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:115
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS SourceAddress
Definition: iotypes.h:1089
SINGLE_LIST_ENTRY NextStackPfn
Definition: mm.h:311
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:217
NTSTATUS NTAPI MmInitializeHandBuiltProcess(IN PEPROCESS Process, IN PULONG_PTR DirectoryTableBase)
Definition: procsup.c:1035
#define APC_LEVEL
Definition: env_spec_w32.h:695
FORCEINLINE VOID MmLockAddressSpace(PMMSUPPORT AddressSpace)
Definition: mm.h:1384
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:214
base of all file and directory entries
Definition: entries.h:82
FORCEINLINE PMMSUPPORT MmGetCurrentAddressSpace(VOID)
Definition: mm.h:1406
* PKAPC_STATE
Definition: ketypes.h:1273
LONG AweReferenceCount
Definition: mm.h:338
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:416
SIZE_T MmDriverCommit
Definition: freelist.c:32
Definition: mm.h:367