3 #include <internal/arch/mm.h>
5 /* TYPES *********************************************************************/
9 extern PMMSUPPORT MmKernelAddressSpace
;
10 extern PFN_COUNT MiFreeSwapPages
;
11 extern PFN_COUNT MiUsedSwapPages
;
12 extern SIZE_T MmTotalPagedPoolQuota
;
13 extern SIZE_T MmTotalNonPagedPoolQuota
;
14 extern PHYSICAL_ADDRESS MmSharedDataPagePhysicalAddress
;
15 extern PFN_COUNT MmNumberOfPhysicalPages
;
16 extern UCHAR MmDisablePagingExecutive
;
17 extern PFN_NUMBER MmLowestPhysicalPage
;
18 extern PFN_NUMBER MmHighestPhysicalPage
;
19 extern PFN_NUMBER MmAvailablePages
;
20 extern PFN_NUMBER MmResidentAvailablePages
;
22 extern PMEMORY_ALLOCATION_DESCRIPTOR MiFreeDescriptor
;
23 extern MEMORY_ALLOCATION_DESCRIPTOR MiFreeDescriptorOrg
;
25 extern LIST_ENTRY MmLoadedUserImageList
;
27 extern KMUTANT MmSystemLoadLock
;
29 extern ULONG MmNumberOfPagingFiles
;
31 extern PVOID MmUnloadedDrivers
;
32 extern PVOID MmLastUnloadedDrivers
;
33 extern PVOID MmTriageActionTaken
;
34 extern PVOID KernelVerifier
;
35 extern MM_DRIVER_VERIFIER_DATA MmVerifierData
;
37 extern SIZE_T MmTotalCommitLimit
;
38 extern SIZE_T MmTotalCommittedPages
;
39 extern SIZE_T MmSharedCommit
;
40 extern SIZE_T MmDriverCommit
;
41 extern SIZE_T MmProcessCommit
;
42 extern SIZE_T MmPagedPoolCommit
;
43 extern SIZE_T MmPeakCommitment
;
44 extern SIZE_T MmtotalCommitLimitMaximum
;
46 extern PVOID MiDebugMapping
;
47 extern PMMPTE MmDebugPte
;
51 struct _MM_RMAP_ENTRY
;
52 typedef ULONG_PTR SWAPENTRY
;
55 // MmDbgCopyMemory Flags
57 #define MMDBG_COPY_WRITE 0x00000001
58 #define MMDBG_COPY_PHYSICAL 0x00000002
59 #define MMDBG_COPY_UNSAFE 0x00000004
60 #define MMDBG_COPY_CACHED 0x00000008
61 #define MMDBG_COPY_UNCACHED 0x00000010
62 #define MMDBG_COPY_WRITE_COMBINED 0x00000020
65 // Maximum chunk size per copy
67 #define MMDBG_COPY_MAX_SIZE 0x8
70 #define MI_STATIC_MEMORY_AREAS (14)
72 #define MI_STATIC_MEMORY_AREAS (13)
75 #define MEMORY_AREA_SECTION_VIEW (1)
76 #define MEMORY_AREA_CACHE (2)
77 #define MEMORY_AREA_OWNED_BY_ARM3 (15)
78 #define MEMORY_AREA_STATIC (0x80000000)
80 #define MM_PHYSICAL_PAGE_MPW_PENDING (0x8)
82 #define MM_CORE_DUMP_TYPE_NONE (0x0)
83 #define MM_CORE_DUMP_TYPE_MINIMAL (0x1)
84 #define MM_CORE_DUMP_TYPE_FULL (0x2)
86 /* Number of list heads to use */
87 #define MI_FREE_POOL_LISTS 4
90 /* Signature of free pool blocks */
91 #define MM_FREE_POOL_TAG 'lprF'
93 /* Although Microsoft says this isn't hardcoded anymore,
94 they won't be able to change it. Stuff depends on it */
95 #define MM_VIRTMEM_GRANULARITY (64 * 1024)
97 #define STATUS_MM_RESTART_OPERATION ((NTSTATUS)0xD0000001)
100 * Additional flags for protection attributes
102 #define PAGE_WRITETHROUGH (1024)
103 #define PAGE_SYSTEM (2048)
105 #define SEC_PHYSICALMEMORY (0x80000000)
107 #define MM_PAGEFILE_SEGMENT (0x1)
108 #define MM_DATAFILE_SEGMENT (0x2)
112 #define MC_SYSTEM (2)
113 #define MC_MAXIMUM (3)
115 #define PAGED_POOL_MASK 1
116 #define MUST_SUCCEED_POOL_MASK 2
117 #define CACHE_ALIGNED_POOL_MASK 4
118 #define QUOTA_POOL_MASK 8
119 #define SESSION_POOL_MASK 32
120 #define VERIFIER_POOL_MASK 64
122 #define MM_PAGED_POOL_SIZE (100*1024*1024)
123 #define MM_NONPAGED_POOL_SIZE (100*1024*1024)
126 * Paged and non-paged pools are 8-byte aligned
128 #define MM_POOL_ALIGNMENT 8
130 #define MM_ROUND_UP(x,s) \
131 ((PVOID)(((ULONG_PTR)(x)+(s)-1) & ~((ULONG_PTR)(s)-1)))
133 #define MM_ROUND_DOWN(x,s) \
134 ((PVOID)(((ULONG_PTR)(x)) & ~((ULONG_PTR)(s)-1)))
136 #define PAGE_FLAGS_VALID_FROM_USER_MODE \
141 PAGE_EXECUTE_READ | \
142 PAGE_EXECUTE_READWRITE | \
143 PAGE_EXECUTE_WRITECOPY | \
148 #define PAGE_FLAGS_VALID_FOR_SECTION \
153 PAGE_EXECUTE_READ | \
154 PAGE_EXECUTE_READWRITE | \
155 PAGE_EXECUTE_WRITECOPY | \
158 #define PAGE_IS_READABLE \
162 PAGE_EXECUTE_READ | \
163 PAGE_EXECUTE_READWRITE | \
164 PAGE_EXECUTE_WRITECOPY)
166 #define PAGE_IS_WRITABLE \
169 PAGE_EXECUTE_READWRITE | \
170 PAGE_EXECUTE_WRITECOPY)
172 #define PAGE_IS_EXECUTABLE \
174 PAGE_EXECUTE_READ | \
175 PAGE_EXECUTE_READWRITE | \
176 PAGE_EXECUTE_WRITECOPY)
178 #define PAGE_IS_WRITECOPY \
180 PAGE_EXECUTE_WRITECOPY)
183 // Wait entry for marking pages that are being serviced
185 #define MM_WAIT_ENTRY 0x7ffffc00
187 #define InterlockedCompareExchangePte(PointerPte, Exchange, Comperand) \
188 InterlockedCompareExchange((PLONG)(PointerPte), Exchange, Comperand)
190 #define InterlockedExchangePte(PointerPte, Value) \
191 InterlockedExchange((PLONG)(PointerPte), Value)
193 typedef struct _MM_SECTION_SEGMENT
195 FAST_MUTEX Lock
; /* lock which protects the page directory */
196 PFILE_OBJECT FileObject
;
197 LARGE_INTEGER RawLength
; /* length of the segment which is part of the mapped file */
198 LARGE_INTEGER Length
; /* absolute length of the segment */
199 ULONG ReferenceCount
;
208 ULONGLONG FileOffset
; /* start offset into the file for image sections */
209 ULONG_PTR VirtualAddress
; /* start offset into the address range for image sections */
210 ULONG Characteristics
;
213 LIST_ENTRY ListOfSegments
;
214 RTL_GENERIC_TABLE PageTable
;
215 } MM_SECTION_SEGMENT
, *PMM_SECTION_SEGMENT
;
217 typedef struct _MM_IMAGE_SECTION_OBJECT
219 SECTION_IMAGE_INFORMATION ImageInformation
;
222 PMM_SECTION_SEGMENT Segments
;
223 } MM_IMAGE_SECTION_OBJECT
, *PMM_IMAGE_SECTION_OBJECT
;
225 typedef struct _ROS_SECTION_OBJECT
229 LARGE_INTEGER MaximumSize
;
230 ULONG SectionPageProtection
;
231 ULONG AllocationAttributes
;
232 PFILE_OBJECT FileObject
;
235 PMM_IMAGE_SECTION_OBJECT ImageSection
;
236 PMM_SECTION_SEGMENT Segment
;
238 } ROS_SECTION_OBJECT
, *PROS_SECTION_OBJECT
;
240 typedef struct _MEMORY_AREA
242 PVOID StartingAddress
;
244 struct _MEMORY_AREA
*Parent
;
245 struct _MEMORY_AREA
*LeftChild
;
246 struct _MEMORY_AREA
*RightChild
;
250 BOOLEAN DeleteInProgress
;
257 ROS_SECTION_OBJECT
* Section
;
258 LARGE_INTEGER ViewOffset
;
259 PMM_SECTION_SEGMENT Segment
;
260 LIST_ENTRY RegionListHead
;
264 LIST_ENTRY RegionListHead
;
267 } MEMORY_AREA
, *PMEMORY_AREA
;
269 typedef struct _MM_RMAP_ENTRY
271 struct _MM_RMAP_ENTRY
* Next
;
278 MM_RMAP_ENTRY
, *PMM_RMAP_ENTRY
;
281 extern ULONG MI_PFN_CURRENT_USAGE
;
282 extern CHAR MI_PFN_CURRENT_PROCESS_NAME
[16];
283 #define MI_SET_USAGE(x) MI_PFN_CURRENT_USAGE = x
284 #define MI_SET_PROCESS2(x) memcpy(MI_PFN_CURRENT_PROCESS_NAME, x, 16)
286 #define MI_SET_USAGE(x)
287 #define MI_SET_PROCESS2(x)
290 typedef enum _MI_PFN_USAGES
292 MI_USAGE_NOT_SET
= 0,
294 MI_USAGE_NONPAGED_POOL
,
295 MI_USAGE_NONPAGED_POOL_EXPANSION
,
296 MI_USAGE_KERNEL_STACK
,
297 MI_USAGE_KERNEL_STACK_EXPANSION
,
303 MI_USAGE_PAGE_DIRECTORY
,
304 MI_USAGE_LEGACY_PAGE_DIRECTORY
,
305 MI_USAGE_DRIVER_PAGE
,
306 MI_USAGE_CONTINOUS_ALLOCATION
,
308 MI_USAGE_DEMAND_ZERO
,
311 MI_USAGE_PFN_DATABASE
,
312 MI_USAGE_BOOT_DRIVER
,
313 MI_USAGE_INIT_MEMORY
,
318 // These two mappings are actually used by Windows itself, based on the ASSERTS
320 #define StartOfAllocation ReadInProgress
321 #define EndOfAllocation WriteInProgress
323 typedef struct _MMPFNENTRY
326 USHORT ReadInProgress
:1; // StartOfAllocation
327 USHORT WriteInProgress
:1; // EndOfAllocation
328 USHORT PrototypePte
:1;
330 USHORT PageLocation
:3;
331 USHORT RemovalRequested
:1;
332 USHORT CacheAttribute
:2;
334 USHORT ParityError
:1; // HasRmap
337 typedef struct _MMPFN
345 SINGLE_LIST_ENTRY NextStackPfn
;
354 ULONG_PTR ShareCount
;
360 USHORT ReferenceCount
;
365 USHORT ReferenceCount
;
372 LONG AweReferenceCount
;
375 PMM_RMAP_ENTRY RmapListHead
;
379 ULONG_PTR EntireFrame
;
382 ULONG_PTR PteFrame
:25;
383 ULONG_PTR InPageError
:1;
384 ULONG_PTR VerifierAllocation
:1;
385 ULONG_PTR AweAllocation
:1;
386 ULONG_PTR Priority
:3;
387 ULONG_PTR MustBeCached
:1;
391 MI_PFN_USAGES PfnUsage
;
392 CHAR ProcessName
[16];
395 // HACK until WS lists are supported
399 extern PMMPFN MmPfnDatabase
;
401 typedef struct _MMPFNLIST
407 } MMPFNLIST
, *PMMPFNLIST
;
409 extern MMPFNLIST MmZeroedPageListHead
;
410 extern MMPFNLIST MmFreePageListHead
;
411 extern MMPFNLIST MmStandbyPageListHead
;
412 extern MMPFNLIST MmModifiedPageListHead
;
413 extern MMPFNLIST MmModifiedNoWritePageListHead
;
415 typedef struct _MM_MEMORY_CONSUMER
419 NTSTATUS (*Trim
)(ULONG Target
, ULONG Priority
, PULONG NrFreed
);
420 } MM_MEMORY_CONSUMER
, *PMM_MEMORY_CONSUMER
;
422 typedef struct _MM_REGION
427 LIST_ENTRY RegionListEntry
;
428 } MM_REGION
, *PMM_REGION
;
430 /* Entry describing free pool memory */
431 typedef struct _MMFREE_POOL_ENTRY
436 struct _MMFREE_POOL_ENTRY
*Owner
;
437 } MMFREE_POOL_ENTRY
, *PMMFREE_POOL_ENTRY
;
439 /* Signature of a freed block */
440 #define MM_FREE_POOL_SIGNATURE 'ARM3'
442 /* Paged pool information */
443 typedef struct _MM_PAGED_POOL_INFO
445 PRTL_BITMAP PagedPoolAllocationMap
;
446 PRTL_BITMAP EndOfPagedPoolBitmap
;
447 PMMPTE FirstPteForPagedPool
;
448 PMMPTE LastPteForPagedPool
;
449 PMMPDE NextPdeForPagedPoolExpansion
;
451 SIZE_T PagedPoolCommit
;
452 SIZE_T AllocatedPagedPool
;
453 } MM_PAGED_POOL_INFO
, *PMM_PAGED_POOL_INFO
;
455 extern MM_MEMORY_CONSUMER MiMemoryConsumers
[MC_MAXIMUM
];
458 (*PMM_ALTER_REGION_FUNC
)(
459 PMMSUPPORT AddressSpace
,
469 (*PMM_FREE_PAGE_FUNC
)(
471 PMEMORY_AREA MemoryArea
,
479 // Mm copy support for Kd
491 // Determines if a given address is a session address
511 /* marea.c *******************************************************************/
516 PMMSUPPORT AddressSpace
,
521 PMEMORY_AREA
*Result
,
522 BOOLEAN FixedAddress
,
523 ULONG AllocationFlags
,
524 ULONG AllocationGranularity
529 MmLocateMemoryAreaByAddress(
530 PMMSUPPORT AddressSpace
,
537 PMMSUPPORT AddressSpace
,
544 PMMSUPPORT AddressSpace
,
545 PMEMORY_AREA MemoryArea
,
546 PMM_FREE_PAGE_FUNC FreePage
,
547 PVOID FreePageContext
552 MmFreeMemoryAreaByPtr(
553 PMMSUPPORT AddressSpace
,
555 PMM_FREE_PAGE_FUNC FreePage
,
556 PVOID FreePageContext
561 MmDumpMemoryAreas(PMMSUPPORT AddressSpace
);
565 MmLocateMemoryAreaByRegion(
566 PMMSUPPORT AddressSpace
,
574 PMMSUPPORT AddressSpace
,
576 ULONG_PTR Granularity
,
582 MmReleaseMemoryAreaIfDecommitted(
583 struct _EPROCESS
*Process
,
584 PMMSUPPORT AddressSpace
,
590 MmMapMemoryArea(PVOID BaseAddress
,
597 MiRosCheckMemoryAreas(
598 PMMSUPPORT AddressSpace
);
602 MiCheckAllProcessMemoryAreas(VOID
);
604 /* npool.c *******************************************************************/
608 MiDebugDumpNonPagedPool(BOOLEAN NewOnly
);
612 MiDebugDumpNonPagedPoolStats(BOOLEAN NewOnly
);
616 MiInitializeNonPagedPool(VOID
);
621 IN POOL_TYPE PoolType
,
622 IN SIZE_T SizeInBytes
628 IN PVOID VirtualAddress
634 IN PVOID StartingAddress
644 /* pool.c *******************************************************************/
648 ExAllocateNonPagedPoolWithTag(
657 ExAllocatePagedPoolWithTag(
665 ExFreeNonPagedPool(PVOID block
);
669 ExFreePagedPool(IN PVOID Block
);
673 ExpIsPoolTagDebuggable(ULONG Tag
);
677 ExpAllocateDebugPool(
687 ExpFreeDebugPool(PVOID Block
, BOOLEAN PagedPool
);
691 MmInitializePagedPool(VOID
);
695 MiAllocateSpecialPool(
696 IN POOL_TYPE PoolType
,
697 IN SIZE_T NumberOfBytes
,
705 IN POOL_TYPE PoolType
,
706 IN ULONG CurrentMaxQuota
,
707 OUT PULONG NewMaxQuota
710 /* mdl.c *********************************************************************/
719 /* mminit.c ******************************************************************/
723 MiShutdownMemoryManager(VOID
);
733 MmInitSystem(IN ULONG Phase
,
734 IN PLOADER_PARAMETER_BLOCK LoaderBlock
);
738 MiFreeInitMemory(VOID
);
742 MmInitializeMdlImplementation(VOID
);
744 /* pagefile.c ****************************************************************/
748 MmAllocSwapPage(VOID
);
752 MmDereserveSwapPages(ULONG Nr
);
756 MmFreeSwapPage(SWAPENTRY Entry
);
760 MmInitPagingFile(VOID
);
764 MmIsFileObjectAPagingFile(PFILE_OBJECT FileObject
);
775 MmReserveSwapPages(ULONG Nr
);
788 ULONG BugCodeParameter1
,
789 ULONG BugCodeParameter2
,
790 ULONG BugCodeParameter3
,
791 ULONG BugCodeParameter4
,
792 struct _KTRAP_FRAME
* TrapFrame
797 MmIsAvailableSwapPage(VOID
);
801 MmShowOutOfSpaceMessagePagingFile(VOID
);
803 /* process.c ****************************************************************/
807 MmInitializeProcessAddressSpace(
808 IN PEPROCESS Process
,
809 IN PEPROCESS Clone OPTIONAL
,
810 IN PVOID Section OPTIONAL
,
812 IN POBJECT_NAME_INFORMATION
*AuditName OPTIONAL
818 IN PEPROCESS Process
,
819 IN PINITIAL_PEB InitialPeb
,
826 IN PEPROCESS Process
,
827 IN PCLIENT_ID ClientId
,
828 IN PINITIAL_TEB InitialTeb
,
835 struct _EPROCESS
*Process
,
841 MmCleanProcessAddressSpace(IN PEPROCESS Process
);
845 MmDeleteProcessAddressSpace(IN PEPROCESS Process
);
849 MmGetSessionLocaleId(VOID
);
853 MmSetMemoryPriorityProcess(
854 IN PEPROCESS Process
,
855 IN UCHAR MemoryPriority
858 /* i386/pfault.c *************************************************************/
870 /* special.c *****************************************************************/
874 MiInitializeSpecialPool();
879 IN SIZE_T NumberOfBytes
,
884 MmIsSpecialPoolAddress(
889 MmAllocateSpecialPool(
890 IN SIZE_T NumberOfBytes
,
892 IN POOL_TYPE PoolType
,
893 IN ULONG SpecialType
);
900 /* mm.c **********************************************************************/
905 IN BOOLEAN StoreInstruction
,
907 IN KPROCESSOR_MODE Mode
,
908 IN PVOID TrapInformation
911 /* anonmem.c *****************************************************************/
915 MmNotPresentFaultVirtualMemory(
916 PMMSUPPORT AddressSpace
,
917 MEMORY_AREA
* MemoryArea
,
923 MmPageOutVirtualMemory(
924 PMMSUPPORT AddressSpace
,
925 PMEMORY_AREA MemoryArea
,
933 PMEMORY_AREA MemoryArea
,
935 PMEMORY_BASIC_INFORMATION Info
,
942 struct _EPROCESS
* Process
,
943 PMEMORY_AREA MemoryArea
949 PMMSUPPORT AddressSpace
,
950 PMEMORY_AREA MemoryArea
,
959 MmWritePageVirtualMemory(
960 PMMSUPPORT AddressSpace
,
966 /* kmap.c ********************************************************************/
970 ExAllocatePage(VOID
);
974 ExUnmapPage(PVOID Addr
);
978 ExAllocatePageWithPhysPage(PFN_NUMBER Page
);
989 MiZeroPage(PFN_NUMBER Page
);
991 /* memsafe.s *****************************************************************/
995 MmSafeReadPtr(PVOID Source
);
997 /* process.c *****************************************************************/
1001 MmCreateKernelStack(BOOLEAN GuiStack
, UCHAR Node
);
1005 MmDeleteKernelStack(PVOID Stack
,
1008 /* balace.c ******************************************************************/
1012 MmInitializeMemoryConsumer(
1014 NTSTATUS (*Trim
)(ULONG Target
, ULONG Priority
, PULONG NrFreed
)
1019 MmInitializeBalancer(
1020 ULONG NrAvailablePages
,
1026 MmReleasePageMemoryConsumer(
1033 MmRequestPageMemoryConsumer(
1036 PPFN_NUMBER AllocatedPage
1041 MiInitBalancerThread(VOID
);
1045 MmRebalanceMemoryConsumers(VOID
);
1047 /* rmap.c **************************************************************/
1051 MmSetRmapListHeadPage(
1053 struct _MM_RMAP_ENTRY
* ListHead
1056 struct _MM_RMAP_ENTRY
*
1058 MmGetRmapListHeadPage(PFN_NUMBER Page
);
1064 struct _EPROCESS
*Process
,
1073 VOID (*DeleteMapping
)(PVOID Context
, struct _EPROCESS
*Process
, PVOID Address
)
1080 struct _EPROCESS
*Process
,
1086 MmInitializeRmapList(VOID
);
1090 MmSetCleanAllRmaps(PFN_NUMBER Page
);
1094 MmSetDirtyAllRmaps(PFN_NUMBER Page
);
1098 MmIsDirtyPageRmap(PFN_NUMBER Page
);
1102 MmPageOutPhysicalAddress(PFN_NUMBER Page
);
1104 /* freelist.c **********************************************************/
1108 MiGetPfnEntry(IN PFN_NUMBER Pfn
)
1111 extern RTL_BITMAP MiPfnBitMap
;
1113 /* Make sure the PFN number is valid */
1114 if (Pfn
> MmHighestPhysicalPage
) return NULL
;
1116 /* Make sure this page actually has a PFN entry */
1117 if ((MiPfnBitMap
.Buffer
) && !(RtlTestBit(&MiPfnBitMap
, (ULONG
)Pfn
))) return NULL
;
1120 Page
= &MmPfnDatabase
[Pfn
];
1128 MiGetPfnEntryIndex(IN PMMPFN Pfn1
)
1131 // This will return the Page Frame Number (PFN) from the MMPFN
1133 return Pfn1
- MmPfnDatabase
;
1138 MmGetLRUNextUserPage(PFN_NUMBER PreviousPage
);
1142 MmGetLRUFirstUserPage(VOID
);
1146 MmInsertLRULastUserPage(PFN_NUMBER Page
);
1150 MmRemoveLRUUserPage(PFN_NUMBER Page
);
1154 MmLockPage(PFN_NUMBER Page
);
1158 MmUnlockPage(PFN_NUMBER Page
);
1162 MmGetLockCountPage(PFN_NUMBER Page
);
1166 MmInitializePageList(
1172 MmDumpArmPfnDatabase(
1173 IN BOOLEAN StatusOnly
1178 MmGetContinuousPages(
1179 ULONG NumberOfBytes
,
1180 PHYSICAL_ADDRESS LowestAcceptableAddress
,
1181 PHYSICAL_ADDRESS HighestAcceptableAddress
,
1182 PHYSICAL_ADDRESS BoundaryAddressMultiple
,
1192 /* hypermap.c *****************************************************************/
1194 extern PEPROCESS HyperProcess
;
1195 extern KIRQL HyperIrql
;
1199 MiMapPageInHyperSpace(IN PEPROCESS Process
,
1205 MiUnmapPageInHyperSpace(IN PEPROCESS Process
,
1211 MiMapPagesInZeroSpace(IN PMMPFN Pfn1
,
1212 IN PFN_NUMBER NumberOfPages
);
1216 MiUnmapPagesInZeroSpace(IN PVOID VirtualAddress
,
1217 IN PFN_NUMBER NumberOfPages
);
1220 // ReactOS Compatibility Layer
1224 MmCreateHyperspaceMapping(IN PFN_NUMBER Page
)
1226 HyperProcess
= (PEPROCESS
)KeGetCurrentThread()->ApcState
.Process
;
1227 return MiMapPageInHyperSpace(HyperProcess
, Page
, &HyperIrql
);
1230 #define MmDeleteHyperspaceMapping(x) MiUnmapPageInHyperSpace(HyperProcess, x, HyperIrql);
1232 /* i386/page.c *********************************************************/
1236 MmCreateVirtualMappingForKernel(
1245 MmCommitPagedPoolAddress(
1252 MmCreateVirtualMapping(
1253 struct _EPROCESS
* Process
,
1262 MmCreateVirtualMappingUnsafe(
1263 struct _EPROCESS
* Process
,
1273 struct _EPROCESS
* Process
,
1279 struct _EPROCESS
* Process
,
1287 struct _EPROCESS
* Process
,
1294 struct _EPROCESS
* Process
,
1300 MmInitGlobalKernelPageDirectory(VOID
);
1304 MmEnableVirtualMapping(
1305 struct _EPROCESS
*Process
,
1311 MmGetPageFileMapping(
1312 struct _EPROCESS
*Process
,
1314 SWAPENTRY
* SwapEntry
);
1318 MmDeletePageFileMapping(
1319 struct _EPROCESS
*Process
,
1321 SWAPENTRY
* SwapEntry
1326 MmCreatePageFileMapping(
1327 struct _EPROCESS
*Process
,
1335 struct _EPROCESS
*Process
,
1341 MmTransferOwnershipPage(
1349 struct _EPROCESS
*Process
,
1361 MmAllocPagesSpecifyRange(
1363 PHYSICAL_ADDRESS LowestAddress
,
1364 PHYSICAL_ADDRESS HighestAddress
,
1365 ULONG NumberOfPages
,
1371 MmDereferencePage(PFN_NUMBER Page
);
1375 MmReferencePage(PFN_NUMBER Page
);
1379 MmGetReferenceCountPage(PFN_NUMBER Page
);
1383 MmIsPageInUse(PFN_NUMBER Page
);
1387 MmSetSavedSwapEntryPage(
1389 SWAPENTRY SavedSwapEntry
);
1393 MmGetSavedSwapEntryPage(PFN_NUMBER Page
);
1398 struct _EPROCESS
*Process
,
1404 MmCreatePageTable(PVOID PAddress
);
1409 struct _EPROCESS
*Process
,
1416 struct _EPROCESS
*Process
,
1422 MmCreateProcessAddressSpace(
1425 IN PULONG_PTR DirectoryTableBase
1430 MmInitializeHandBuiltProcess(
1431 IN PEPROCESS Process
,
1432 IN PULONG_PTR DirectoryTableBase
1438 MmInitializeHandBuiltProcess2(
1439 IN PEPROCESS Process
1444 MmReleaseMmInfo(struct _EPROCESS
*Process
);
1448 MmSetExecuteOptions(IN ULONG ExecuteOptions
);
1452 MmGetExecuteOptions(IN PULONG ExecuteOptions
);
1456 MmDeleteProcessPageDirectory(struct _EPROCESS
*Process
);
1460 MmDeleteVirtualMapping(
1461 struct _EPROCESS
*Process
,
1471 struct _EPROCESS
*Process
,
1477 MmMarkPageMapped(PFN_NUMBER Page
);
1481 MmMarkPageUnmapped(PFN_NUMBER Page
);
1486 struct _EPROCESS
*Process
,
1493 MiInitPageDirectoryMap(VOID
);
1497 MiGetUserPageDirectoryCount(VOID
);
1499 /* wset.c ********************************************************************/
1508 /* region.c ************************************************************/
1513 PMMSUPPORT AddressSpace
,
1515 PLIST_ENTRY RegionListHead
,
1520 PMM_ALTER_REGION_FUNC AlterFunc
1526 PLIST_ENTRY RegionListHead
,
1536 PLIST_ENTRY RegionListHead
,
1538 PVOID
* RegionBaseAddress
1541 /* section.c *****************************************************************/
1545 MmGetImageInformation(
1546 OUT PSECTION_IMAGE_INFORMATION ImageInformation
1551 MmGetFileObjectForSection(
1556 MmGetFileNameForAddress(
1558 OUT PUNICODE_STRING ModuleName
1563 MmGetFileNameForSection(
1565 OUT POBJECT_NAME_INFORMATION
*ModuleName
1578 PMEMORY_AREA MemoryArea
,
1580 PMEMORY_BASIC_INFORMATION Info
,
1581 PSIZE_T ResultLength
1586 MmProtectSectionView(
1587 PMMSUPPORT AddressSpace
,
1588 PMEMORY_AREA MemoryArea
,
1597 MmInitSectionImplementation(VOID
);
1601 MmNotPresentFaultSectionView(
1602 PMMSUPPORT AddressSpace
,
1603 MEMORY_AREA
* MemoryArea
,
1610 MmPageOutSectionView(
1611 PMMSUPPORT AddressSpace
,
1612 PMEMORY_AREA MemoryArea
,
1619 MmCreatePhysicalMemorySection(VOID
);
1623 MmAccessFaultSectionView(
1624 PMMSUPPORT AddressSpace
,
1625 MEMORY_AREA
* MemoryArea
,
1631 MmFreeSectionSegments(PFILE_OBJECT FileObject
);
1633 /* mpw.c *********************************************************************/
1637 MmInitMpwThread(VOID
);
1641 MmInitBsmThread(VOID
);
1643 /* pager.c *******************************************************************/
1647 MiIsPagerThread(VOID
);
1651 MiStartPagerThread(VOID
);
1655 MiStopPagerThread(VOID
);
1659 MiQueryVirtualMemory(
1660 IN HANDLE ProcessHandle
,
1662 IN MEMORY_INFORMATION_CLASS VirtualMemoryInformationClass
,
1663 OUT PVOID VirtualMemoryInformation
,
1665 OUT PSIZE_T ResultLength
1668 /* sysldr.c ******************************************************************/
1672 MiReloadBootLoadedDrivers(
1673 IN PLOADER_PARAMETER_BLOCK LoaderBlock
1678 MiInitializeLoadedModuleList(
1679 IN PLOADER_PARAMETER_BLOCK LoaderBlock
1685 IN PUNICODE_STRING FileName
,
1686 IN PUNICODE_STRING NamePrefix OPTIONAL
,
1687 IN PUNICODE_STRING LoadedName OPTIONAL
,
1689 OUT PVOID
*ModuleObject
,
1690 OUT PVOID
*ImageBaseAddress
1695 MmUnloadSystemImage(
1696 IN PVOID ImageHandle
1702 IN HANDLE ImageHandle
,
1703 IN BOOLEAN PurgeSection
1708 MmCallDllInitialize(
1709 IN PLDR_DATA_TABLE_ENTRY LdrEntry
,
1710 IN PLIST_ENTRY ListHead
1714 /* procsup.c *****************************************************************/
1719 IN PVOID StackPointer
1725 MmLockAddressSpace(PMMSUPPORT AddressSpace
)
1727 KeAcquireGuardedMutex(&CONTAINING_RECORD(AddressSpace
, EPROCESS
, Vm
)->AddressCreationLock
);
1732 MmUnlockAddressSpace(PMMSUPPORT AddressSpace
)
1734 KeReleaseGuardedMutex(&CONTAINING_RECORD(AddressSpace
, EPROCESS
, Vm
)->AddressCreationLock
);
1739 MmGetAddressSpaceOwner(IN PMMSUPPORT AddressSpace
)
1741 if (AddressSpace
== MmKernelAddressSpace
) return NULL
;
1742 return CONTAINING_RECORD(AddressSpace
, EPROCESS
, Vm
);
1747 MmGetCurrentAddressSpace(VOID
)
1749 return &((PEPROCESS
)KeGetCurrentThread()->ApcState
.Process
)->Vm
;
1754 MmGetKernelAddressSpace(VOID
)
1756 return MmKernelAddressSpace
;
1760 /* expool.c ******************************************************************/
1764 ExpCheckPoolAllocation(
1770 /* session.c *****************************************************************/
1772 _IRQL_requires_max_(APC_LEVEL
)
1776 _Inout_ PVOID SessionEntry
,
1777 _Out_ PKAPC_STATE ApcState
);
1779 _IRQL_requires_max_(APC_LEVEL
)
1783 _Inout_ PVOID SessionEntry
,
1784 _Out_ PKAPC_STATE ApcState
);
1789 _Inout_ PVOID SessionEntry
);
1794 _In_ ULONG SessionId
);
1796 _IRQL_requires_max_(APC_LEVEL
)
1799 MmSetSessionLocaleId(
1800 _In_ LCID LocaleId
);
1803 /* virtual.c *****************************************************************/
1807 MmCopyVirtualMemory(IN PEPROCESS SourceProcess
,
1808 IN PVOID SourceAddress
,
1809 IN PEPROCESS TargetProcess
,
1810 OUT PVOID TargetAddress
,
1811 IN SIZE_T BufferSize
,
1812 IN KPROCESSOR_MODE PreviousMode
,
1813 OUT PSIZE_T ReturnSize
);