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
342 ULONG WsIndex
; // SavedSwapEntry
345 SINGLE_LIST_ENTRY NextStackPfn
;
351 ULONG_PTR ShareCount
;
357 USHORT ReferenceCount
; // ReferenceCount
362 USHORT ReferenceCount
;
369 LONG AweReferenceCount
; // RmapListHead
373 ULONG_PTR EntireFrame
;
376 ULONG_PTR PteFrame
:25;
377 ULONG_PTR InPageError
:1;
378 ULONG_PTR VerifierAllocation
:1;
379 ULONG_PTR AweAllocation
:1;
380 ULONG_PTR Priority
:3;
381 ULONG_PTR MustBeCached
:1;
385 MI_PFN_USAGES PfnUsage
;
386 CHAR ProcessName
[16];
390 extern PMMPFN MmPfnDatabase
;
392 typedef struct _MMPFNLIST
398 } MMPFNLIST
, *PMMPFNLIST
;
400 extern MMPFNLIST MmZeroedPageListHead
;
401 extern MMPFNLIST MmFreePageListHead
;
402 extern MMPFNLIST MmStandbyPageListHead
;
403 extern MMPFNLIST MmModifiedPageListHead
;
404 extern MMPFNLIST MmModifiedNoWritePageListHead
;
406 typedef struct _MM_MEMORY_CONSUMER
410 NTSTATUS (*Trim
)(ULONG Target
, ULONG Priority
, PULONG NrFreed
);
411 } MM_MEMORY_CONSUMER
, *PMM_MEMORY_CONSUMER
;
413 typedef struct _MM_REGION
418 LIST_ENTRY RegionListEntry
;
419 } MM_REGION
, *PMM_REGION
;
421 /* Entry describing free pool memory */
422 typedef struct _MMFREE_POOL_ENTRY
427 struct _MMFREE_POOL_ENTRY
*Owner
;
428 } MMFREE_POOL_ENTRY
, *PMMFREE_POOL_ENTRY
;
430 /* Signature of a freed block */
431 #define MM_FREE_POOL_SIGNATURE 'ARM3'
433 /* Paged pool information */
434 typedef struct _MM_PAGED_POOL_INFO
436 PRTL_BITMAP PagedPoolAllocationMap
;
437 PRTL_BITMAP EndOfPagedPoolBitmap
;
438 PMMPTE FirstPteForPagedPool
;
439 PMMPTE LastPteForPagedPool
;
440 PMMPDE NextPdeForPagedPoolExpansion
;
442 SIZE_T PagedPoolCommit
;
443 SIZE_T AllocatedPagedPool
;
444 } MM_PAGED_POOL_INFO
, *PMM_PAGED_POOL_INFO
;
446 extern MM_MEMORY_CONSUMER MiMemoryConsumers
[MC_MAXIMUM
];
449 (*PMM_ALTER_REGION_FUNC
)(
450 PMMSUPPORT AddressSpace
,
460 (*PMM_FREE_PAGE_FUNC
)(
462 PMEMORY_AREA MemoryArea
,
470 // Mm copy support for Kd
482 // Determines if a given address is a session address
502 /* marea.c *******************************************************************/
507 PMMSUPPORT AddressSpace
,
512 PMEMORY_AREA
*Result
,
513 BOOLEAN FixedAddress
,
514 ULONG AllocationFlags
,
515 PHYSICAL_ADDRESS BoundaryAddressMultiple OPTIONAL
520 MmLocateMemoryAreaByAddress(
521 PMMSUPPORT AddressSpace
,
528 PMMSUPPORT AddressSpace
,
535 PMMSUPPORT AddressSpace
,
536 PMEMORY_AREA MemoryArea
,
537 PMM_FREE_PAGE_FUNC FreePage
,
538 PVOID FreePageContext
543 MmFreeMemoryAreaByPtr(
544 PMMSUPPORT AddressSpace
,
546 PMM_FREE_PAGE_FUNC FreePage
,
547 PVOID FreePageContext
552 MmDumpMemoryAreas(PMMSUPPORT AddressSpace
);
556 MmLocateMemoryAreaByRegion(
557 PMMSUPPORT AddressSpace
,
565 PMMSUPPORT AddressSpace
,
567 ULONG_PTR Granularity
,
573 MmReleaseMemoryAreaIfDecommitted(
574 struct _EPROCESS
*Process
,
575 PMMSUPPORT AddressSpace
,
581 MmMapMemoryArea(PVOID BaseAddress
,
588 MiRosCheckMemoryAreas(
589 PMMSUPPORT AddressSpace
);
593 MiCheckAllProcessMemoryAreas(VOID
);
595 /* npool.c *******************************************************************/
599 MiDebugDumpNonPagedPool(BOOLEAN NewOnly
);
603 MiDebugDumpNonPagedPoolStats(BOOLEAN NewOnly
);
607 MiInitializeNonPagedPool(VOID
);
612 IN POOL_TYPE PoolType
,
613 IN SIZE_T SizeInBytes
619 IN PVOID VirtualAddress
625 IN PVOID StartingAddress
635 /* pool.c *******************************************************************/
639 ExAllocateNonPagedPoolWithTag(
648 ExAllocatePagedPoolWithTag(
656 ExFreeNonPagedPool(PVOID block
);
660 ExFreePagedPool(IN PVOID Block
);
664 ExpIsPoolTagDebuggable(ULONG Tag
);
668 ExpAllocateDebugPool(
678 ExpFreeDebugPool(PVOID Block
, BOOLEAN PagedPool
);
682 MmInitializePagedPool(VOID
);
686 MiAllocateSpecialPool(
687 IN POOL_TYPE PoolType
,
688 IN SIZE_T NumberOfBytes
,
696 IN POOL_TYPE PoolType
,
697 IN ULONG CurrentMaxQuota
,
698 OUT PULONG NewMaxQuota
701 /* mdl.c *********************************************************************/
710 /* mminit.c ******************************************************************/
714 MiShutdownMemoryManager(VOID
);
724 MmInitSystem(IN ULONG Phase
,
725 IN PLOADER_PARAMETER_BLOCK LoaderBlock
);
729 MiFreeInitMemory(VOID
);
733 MmInitializeMdlImplementation(VOID
);
735 /* pagefile.c ****************************************************************/
739 MmAllocSwapPage(VOID
);
743 MmDereserveSwapPages(ULONG Nr
);
747 MmFreeSwapPage(SWAPENTRY Entry
);
751 MmInitPagingFile(VOID
);
755 MmIsFileObjectAPagingFile(PFILE_OBJECT FileObject
);
766 MmReserveSwapPages(ULONG Nr
);
779 ULONG BugCodeParameter1
,
780 ULONG BugCodeParameter2
,
781 ULONG BugCodeParameter3
,
782 ULONG BugCodeParameter4
,
783 struct _KTRAP_FRAME
* TrapFrame
788 MmIsAvailableSwapPage(VOID
);
792 MmShowOutOfSpaceMessagePagingFile(VOID
);
794 /* process.c ****************************************************************/
798 MmInitializeProcessAddressSpace(
799 IN PEPROCESS Process
,
800 IN PEPROCESS Clone OPTIONAL
,
801 IN PVOID Section OPTIONAL
,
803 IN POBJECT_NAME_INFORMATION
*AuditName OPTIONAL
809 IN PEPROCESS Process
,
810 IN PINITIAL_PEB InitialPeb
,
817 IN PEPROCESS Process
,
818 IN PCLIENT_ID ClientId
,
819 IN PINITIAL_TEB InitialTeb
,
826 struct _EPROCESS
*Process
,
832 MmCleanProcessAddressSpace(IN PEPROCESS Process
);
836 MmDeleteProcessAddressSpace(IN PEPROCESS Process
);
840 MmGetSessionLocaleId(VOID
);
844 MmSetMemoryPriorityProcess(
845 IN PEPROCESS Process
,
846 IN UCHAR MemoryPriority
849 /* i386/pfault.c *************************************************************/
861 /* special.c *****************************************************************/
865 MiInitializeSpecialPool();
870 IN SIZE_T NumberOfBytes
,
875 MmIsSpecialPoolAddress(
880 MmAllocateSpecialPool(
881 IN SIZE_T NumberOfBytes
,
883 IN POOL_TYPE PoolType
,
884 IN ULONG SpecialType
);
891 /* mm.c **********************************************************************/
896 IN BOOLEAN StoreInstruction
,
898 IN KPROCESSOR_MODE Mode
,
899 IN PVOID TrapInformation
902 /* anonmem.c *****************************************************************/
906 MmNotPresentFaultVirtualMemory(
907 PMMSUPPORT AddressSpace
,
908 MEMORY_AREA
* MemoryArea
,
914 MmPageOutVirtualMemory(
915 PMMSUPPORT AddressSpace
,
916 PMEMORY_AREA MemoryArea
,
924 PMEMORY_AREA MemoryArea
,
926 PMEMORY_BASIC_INFORMATION Info
,
933 struct _EPROCESS
* Process
,
934 PMEMORY_AREA MemoryArea
940 PMMSUPPORT AddressSpace
,
941 PMEMORY_AREA MemoryArea
,
950 MmWritePageVirtualMemory(
951 PMMSUPPORT AddressSpace
,
957 /* kmap.c ********************************************************************/
961 ExAllocatePage(VOID
);
965 ExUnmapPage(PVOID Addr
);
969 ExAllocatePageWithPhysPage(PFN_NUMBER Page
);
980 MiZeroPage(PFN_NUMBER Page
);
982 /* memsafe.s *****************************************************************/
986 MmSafeReadPtr(PVOID Source
);
988 /* process.c *****************************************************************/
992 MmCreateKernelStack(BOOLEAN GuiStack
, UCHAR Node
);
996 MmDeleteKernelStack(PVOID Stack
,
999 /* balace.c ******************************************************************/
1003 MmInitializeMemoryConsumer(
1005 NTSTATUS (*Trim
)(ULONG Target
, ULONG Priority
, PULONG NrFreed
)
1010 MmInitializeBalancer(
1011 ULONG NrAvailablePages
,
1017 MmReleasePageMemoryConsumer(
1024 MmRequestPageMemoryConsumer(
1027 PPFN_NUMBER AllocatedPage
1032 MiInitBalancerThread(VOID
);
1036 MmRebalanceMemoryConsumers(VOID
);
1038 /* rmap.c **************************************************************/
1042 MmSetRmapListHeadPage(
1044 struct _MM_RMAP_ENTRY
* ListHead
1047 struct _MM_RMAP_ENTRY
*
1049 MmGetRmapListHeadPage(PFN_NUMBER Page
);
1055 struct _EPROCESS
*Process
,
1064 VOID (*DeleteMapping
)(PVOID Context
, struct _EPROCESS
*Process
, PVOID Address
)
1071 struct _EPROCESS
*Process
,
1077 MmInitializeRmapList(VOID
);
1081 MmSetCleanAllRmaps(PFN_NUMBER Page
);
1085 MmSetDirtyAllRmaps(PFN_NUMBER Page
);
1089 MmIsDirtyPageRmap(PFN_NUMBER Page
);
1093 MmPageOutPhysicalAddress(PFN_NUMBER Page
);
1095 /* freelist.c **********************************************************/
1099 MiGetPfnEntry(IN PFN_NUMBER Pfn
)
1102 extern RTL_BITMAP MiPfnBitMap
;
1104 /* Make sure the PFN number is valid */
1105 if (Pfn
> MmHighestPhysicalPage
) return NULL
;
1107 /* Make sure this page actually has a PFN entry */
1108 if ((MiPfnBitMap
.Buffer
) && !(RtlTestBit(&MiPfnBitMap
, (ULONG
)Pfn
))) return NULL
;
1111 Page
= &MmPfnDatabase
[Pfn
];
1119 MiGetPfnEntryIndex(IN PMMPFN Pfn1
)
1122 // This will return the Page Frame Number (PFN) from the MMPFN
1124 return Pfn1
- MmPfnDatabase
;
1129 MmGetLRUNextUserPage(PFN_NUMBER PreviousPage
);
1133 MmGetLRUFirstUserPage(VOID
);
1137 MmInsertLRULastUserPage(PFN_NUMBER Page
);
1141 MmRemoveLRUUserPage(PFN_NUMBER Page
);
1145 MmLockPage(PFN_NUMBER Page
);
1149 MmUnlockPage(PFN_NUMBER Page
);
1153 MmGetLockCountPage(PFN_NUMBER Page
);
1157 MmInitializePageList(
1163 MmDumpArmPfnDatabase(
1164 IN BOOLEAN StatusOnly
1169 MmGetContinuousPages(
1170 ULONG NumberOfBytes
,
1171 PHYSICAL_ADDRESS LowestAcceptableAddress
,
1172 PHYSICAL_ADDRESS HighestAcceptableAddress
,
1173 PHYSICAL_ADDRESS BoundaryAddressMultiple
,
1183 /* hypermap.c *****************************************************************/
1185 extern PEPROCESS HyperProcess
;
1186 extern KIRQL HyperIrql
;
1190 MiMapPageInHyperSpace(IN PEPROCESS Process
,
1196 MiUnmapPageInHyperSpace(IN PEPROCESS Process
,
1202 MiMapPagesInZeroSpace(IN PMMPFN Pfn1
,
1203 IN PFN_NUMBER NumberOfPages
);
1207 MiUnmapPagesInZeroSpace(IN PVOID VirtualAddress
,
1208 IN PFN_NUMBER NumberOfPages
);
1211 // ReactOS Compatibility Layer
1215 MmCreateHyperspaceMapping(IN PFN_NUMBER Page
)
1217 HyperProcess
= (PEPROCESS
)KeGetCurrentThread()->ApcState
.Process
;
1218 return MiMapPageInHyperSpace(HyperProcess
, Page
, &HyperIrql
);
1221 #define MmDeleteHyperspaceMapping(x) MiUnmapPageInHyperSpace(HyperProcess, x, HyperIrql);
1223 /* i386/page.c *********************************************************/
1227 MmCreateVirtualMappingForKernel(
1236 MmCommitPagedPoolAddress(
1243 MmCreateVirtualMapping(
1244 struct _EPROCESS
* Process
,
1253 MmCreateVirtualMappingUnsafe(
1254 struct _EPROCESS
* Process
,
1264 struct _EPROCESS
* Process
,
1270 struct _EPROCESS
* Process
,
1278 struct _EPROCESS
* Process
,
1285 struct _EPROCESS
* Process
,
1291 MmInitGlobalKernelPageDirectory(VOID
);
1295 MmDisableVirtualMapping(
1296 struct _EPROCESS
*Process
,
1304 MmEnableVirtualMapping(
1305 struct _EPROCESS
*Process
,
1311 MmRawDeleteVirtualMapping(PVOID Address
);
1316 MmGetPageFileMapping(
1317 struct _EPROCESS
*Process
,
1319 SWAPENTRY
* SwapEntry
);
1323 MmDeletePageFileMapping(
1324 struct _EPROCESS
*Process
,
1326 SWAPENTRY
* SwapEntry
1331 MmCreatePageFileMapping(
1332 struct _EPROCESS
*Process
,
1340 struct _EPROCESS
*Process
,
1346 MmTransferOwnershipPage(
1354 struct _EPROCESS
*Process
,
1366 MmAllocPagesSpecifyRange(
1368 PHYSICAL_ADDRESS LowestAddress
,
1369 PHYSICAL_ADDRESS HighestAddress
,
1370 ULONG NumberOfPages
,
1376 MmDereferencePage(PFN_NUMBER Page
);
1380 MmReferencePage(PFN_NUMBER Page
);
1384 MmGetReferenceCountPage(PFN_NUMBER Page
);
1388 MmIsPageInUse(PFN_NUMBER Page
);
1392 MmSetSavedSwapEntryPage(
1394 SWAPENTRY SavedSwapEntry
);
1398 MmGetSavedSwapEntryPage(PFN_NUMBER Page
);
1403 struct _EPROCESS
*Process
,
1409 MmCreatePageTable(PVOID PAddress
);
1414 struct _EPROCESS
*Process
,
1421 struct _EPROCESS
*Process
,
1427 MmCreateProcessAddressSpace(
1430 IN PULONG_PTR DirectoryTableBase
1435 MmInitializeHandBuiltProcess(
1436 IN PEPROCESS Process
,
1437 IN PULONG_PTR DirectoryTableBase
1443 MmInitializeHandBuiltProcess2(
1444 IN PEPROCESS Process
1449 MmReleaseMmInfo(struct _EPROCESS
*Process
);
1453 MmSetExecuteOptions(IN ULONG ExecuteOptions
);
1457 MmGetExecuteOptions(IN PULONG ExecuteOptions
);
1461 MmDeleteProcessPageDirectory(struct _EPROCESS
*Process
);
1465 MmDeleteVirtualMapping(
1466 struct _EPROCESS
*Process
,
1476 struct _EPROCESS
*Process
,
1482 MmMarkPageMapped(PFN_NUMBER Page
);
1486 MmMarkPageUnmapped(PFN_NUMBER Page
);
1491 struct _EPROCESS
*Process
,
1498 MiInitPageDirectoryMap(VOID
);
1502 MiGetUserPageDirectoryCount(VOID
);
1504 /* wset.c ********************************************************************/
1513 /* region.c ************************************************************/
1518 PMMSUPPORT AddressSpace
,
1520 PLIST_ENTRY RegionListHead
,
1525 PMM_ALTER_REGION_FUNC AlterFunc
1531 PLIST_ENTRY RegionListHead
,
1541 PLIST_ENTRY RegionListHead
,
1543 PVOID
* RegionBaseAddress
1546 /* section.c *****************************************************************/
1550 MmGetImageInformation(
1551 OUT PSECTION_IMAGE_INFORMATION ImageInformation
1556 MmGetFileObjectForSection(
1561 MmGetFileNameForAddress(
1563 OUT PUNICODE_STRING ModuleName
1568 MmGetFileNameForSection(
1570 OUT POBJECT_NAME_INFORMATION
*ModuleName
1583 PMEMORY_AREA MemoryArea
,
1585 PMEMORY_BASIC_INFORMATION Info
,
1586 PSIZE_T ResultLength
1591 MmProtectSectionView(
1592 PMMSUPPORT AddressSpace
,
1593 PMEMORY_AREA MemoryArea
,
1602 MmInitSectionImplementation(VOID
);
1606 MmNotPresentFaultSectionView(
1607 PMMSUPPORT AddressSpace
,
1608 MEMORY_AREA
* MemoryArea
,
1615 MmPageOutSectionView(
1616 PMMSUPPORT AddressSpace
,
1617 PMEMORY_AREA MemoryArea
,
1624 MmCreatePhysicalMemorySection(VOID
);
1628 MmAccessFaultSectionView(
1629 PMMSUPPORT AddressSpace
,
1630 MEMORY_AREA
* MemoryArea
,
1636 MmFreeSectionSegments(PFILE_OBJECT FileObject
);
1638 /* mpw.c *********************************************************************/
1642 MmInitMpwThread(VOID
);
1646 MmInitBsmThread(VOID
);
1648 /* pager.c *******************************************************************/
1652 MiIsPagerThread(VOID
);
1656 MiStartPagerThread(VOID
);
1660 MiStopPagerThread(VOID
);
1664 MiQueryVirtualMemory(
1665 IN HANDLE ProcessHandle
,
1667 IN MEMORY_INFORMATION_CLASS VirtualMemoryInformationClass
,
1668 OUT PVOID VirtualMemoryInformation
,
1670 OUT PSIZE_T ResultLength
1673 /* sysldr.c ******************************************************************/
1677 MiReloadBootLoadedDrivers(
1678 IN PLOADER_PARAMETER_BLOCK LoaderBlock
1683 MiInitializeLoadedModuleList(
1684 IN PLOADER_PARAMETER_BLOCK LoaderBlock
1690 IN PUNICODE_STRING FileName
,
1691 IN PUNICODE_STRING NamePrefix OPTIONAL
,
1692 IN PUNICODE_STRING LoadedName OPTIONAL
,
1694 OUT PVOID
*ModuleObject
,
1695 OUT PVOID
*ImageBaseAddress
1700 MmUnloadSystemImage(
1701 IN PVOID ImageHandle
1707 IN HANDLE ImageHandle
,
1708 IN BOOLEAN PurgeSection
1713 MmCallDllInitialize(
1714 IN PLDR_DATA_TABLE_ENTRY LdrEntry
,
1715 IN PLIST_ENTRY ListHead
1719 /* procsup.c *****************************************************************/
1724 IN PVOID StackPointer
1730 MmLockAddressSpace(PMMSUPPORT AddressSpace
)
1732 KeAcquireGuardedMutex(&CONTAINING_RECORD(AddressSpace
, EPROCESS
, Vm
)->AddressCreationLock
);
1737 MmUnlockAddressSpace(PMMSUPPORT AddressSpace
)
1739 KeReleaseGuardedMutex(&CONTAINING_RECORD(AddressSpace
, EPROCESS
, Vm
)->AddressCreationLock
);
1744 MmGetAddressSpaceOwner(IN PMMSUPPORT AddressSpace
)
1746 if (AddressSpace
== MmKernelAddressSpace
) return NULL
;
1747 return CONTAINING_RECORD(AddressSpace
, EPROCESS
, Vm
);
1752 MmGetCurrentAddressSpace(VOID
)
1754 return &((PEPROCESS
)KeGetCurrentThread()->ApcState
.Process
)->Vm
;
1759 MmGetKernelAddressSpace(VOID
)
1761 return MmKernelAddressSpace
;
1765 /* expool.c ******************************************************************/
1769 ExpCheckPoolAllocation(
1775 /* session.c *****************************************************************/
1777 _IRQL_requires_max_(APC_LEVEL
)
1781 _Inout_ PVOID SessionEntry
,
1782 _Out_ PKAPC_STATE ApcState
);
1784 _IRQL_requires_max_(APC_LEVEL
)
1788 _Inout_ PVOID SessionEntry
,
1789 _Out_ PKAPC_STATE ApcState
);
1794 _Inout_ PVOID SessionEntry
);
1799 _In_ ULONG SessionId
);