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];
396 extern PMMPFN MmPfnDatabase
;
398 typedef struct _MMPFNLIST
404 } MMPFNLIST
, *PMMPFNLIST
;
406 extern MMPFNLIST MmZeroedPageListHead
;
407 extern MMPFNLIST MmFreePageListHead
;
408 extern MMPFNLIST MmStandbyPageListHead
;
409 extern MMPFNLIST MmModifiedPageListHead
;
410 extern MMPFNLIST MmModifiedNoWritePageListHead
;
412 typedef struct _MM_MEMORY_CONSUMER
416 NTSTATUS (*Trim
)(ULONG Target
, ULONG Priority
, PULONG NrFreed
);
417 } MM_MEMORY_CONSUMER
, *PMM_MEMORY_CONSUMER
;
419 typedef struct _MM_REGION
424 LIST_ENTRY RegionListEntry
;
425 } MM_REGION
, *PMM_REGION
;
427 /* Entry describing free pool memory */
428 typedef struct _MMFREE_POOL_ENTRY
433 struct _MMFREE_POOL_ENTRY
*Owner
;
434 } MMFREE_POOL_ENTRY
, *PMMFREE_POOL_ENTRY
;
436 /* Signature of a freed block */
437 #define MM_FREE_POOL_SIGNATURE 'ARM3'
439 /* Paged pool information */
440 typedef struct _MM_PAGED_POOL_INFO
442 PRTL_BITMAP PagedPoolAllocationMap
;
443 PRTL_BITMAP EndOfPagedPoolBitmap
;
444 PMMPTE FirstPteForPagedPool
;
445 PMMPTE LastPteForPagedPool
;
446 PMMPDE NextPdeForPagedPoolExpansion
;
448 SIZE_T PagedPoolCommit
;
449 SIZE_T AllocatedPagedPool
;
450 } MM_PAGED_POOL_INFO
, *PMM_PAGED_POOL_INFO
;
452 extern MM_MEMORY_CONSUMER MiMemoryConsumers
[MC_MAXIMUM
];
455 (*PMM_ALTER_REGION_FUNC
)(
456 PMMSUPPORT AddressSpace
,
466 (*PMM_FREE_PAGE_FUNC
)(
468 PMEMORY_AREA MemoryArea
,
476 // Mm copy support for Kd
488 // Determines if a given address is a session address
508 /* marea.c *******************************************************************/
513 PMMSUPPORT AddressSpace
,
518 PMEMORY_AREA
*Result
,
519 BOOLEAN FixedAddress
,
520 ULONG AllocationFlags
,
521 ULONG AllocationGranularity
526 MmLocateMemoryAreaByAddress(
527 PMMSUPPORT AddressSpace
,
534 PMMSUPPORT AddressSpace
,
541 PMMSUPPORT AddressSpace
,
542 PMEMORY_AREA MemoryArea
,
543 PMM_FREE_PAGE_FUNC FreePage
,
544 PVOID FreePageContext
549 MmFreeMemoryAreaByPtr(
550 PMMSUPPORT AddressSpace
,
552 PMM_FREE_PAGE_FUNC FreePage
,
553 PVOID FreePageContext
558 MmDumpMemoryAreas(PMMSUPPORT AddressSpace
);
562 MmLocateMemoryAreaByRegion(
563 PMMSUPPORT AddressSpace
,
571 PMMSUPPORT AddressSpace
,
573 ULONG_PTR Granularity
,
579 MmReleaseMemoryAreaIfDecommitted(
580 struct _EPROCESS
*Process
,
581 PMMSUPPORT AddressSpace
,
587 MmMapMemoryArea(PVOID BaseAddress
,
594 MiRosCheckMemoryAreas(
595 PMMSUPPORT AddressSpace
);
599 MiCheckAllProcessMemoryAreas(VOID
);
601 /* npool.c *******************************************************************/
605 MiDebugDumpNonPagedPool(BOOLEAN NewOnly
);
609 MiDebugDumpNonPagedPoolStats(BOOLEAN NewOnly
);
613 MiInitializeNonPagedPool(VOID
);
618 IN POOL_TYPE PoolType
,
619 IN SIZE_T SizeInBytes
625 IN PVOID VirtualAddress
631 IN PVOID StartingAddress
641 /* pool.c *******************************************************************/
645 ExAllocateNonPagedPoolWithTag(
654 ExAllocatePagedPoolWithTag(
662 ExFreeNonPagedPool(PVOID block
);
666 ExFreePagedPool(IN PVOID Block
);
670 ExpIsPoolTagDebuggable(ULONG Tag
);
674 ExpAllocateDebugPool(
684 ExpFreeDebugPool(PVOID Block
, BOOLEAN PagedPool
);
688 MmInitializePagedPool(VOID
);
692 MiAllocateSpecialPool(
693 IN POOL_TYPE PoolType
,
694 IN SIZE_T NumberOfBytes
,
702 IN POOL_TYPE PoolType
,
703 IN ULONG CurrentMaxQuota
,
704 OUT PULONG NewMaxQuota
707 /* mdl.c *********************************************************************/
716 /* mminit.c ******************************************************************/
720 MiShutdownMemoryManager(VOID
);
730 MmInitSystem(IN ULONG Phase
,
731 IN PLOADER_PARAMETER_BLOCK LoaderBlock
);
735 MiFreeInitMemory(VOID
);
739 MmInitializeMdlImplementation(VOID
);
741 /* pagefile.c ****************************************************************/
745 MmAllocSwapPage(VOID
);
749 MmDereserveSwapPages(ULONG Nr
);
753 MmFreeSwapPage(SWAPENTRY Entry
);
757 MmInitPagingFile(VOID
);
761 MmIsFileObjectAPagingFile(PFILE_OBJECT FileObject
);
772 MmReserveSwapPages(ULONG Nr
);
785 ULONG BugCodeParameter1
,
786 ULONG BugCodeParameter2
,
787 ULONG BugCodeParameter3
,
788 ULONG BugCodeParameter4
,
789 struct _KTRAP_FRAME
* TrapFrame
794 MmIsAvailableSwapPage(VOID
);
798 MmShowOutOfSpaceMessagePagingFile(VOID
);
800 /* process.c ****************************************************************/
804 MmInitializeProcessAddressSpace(
805 IN PEPROCESS Process
,
806 IN PEPROCESS Clone OPTIONAL
,
807 IN PVOID Section OPTIONAL
,
809 IN POBJECT_NAME_INFORMATION
*AuditName OPTIONAL
815 IN PEPROCESS Process
,
816 IN PINITIAL_PEB InitialPeb
,
823 IN PEPROCESS Process
,
824 IN PCLIENT_ID ClientId
,
825 IN PINITIAL_TEB InitialTeb
,
832 struct _EPROCESS
*Process
,
838 MmCleanProcessAddressSpace(IN PEPROCESS Process
);
842 MmDeleteProcessAddressSpace(IN PEPROCESS Process
);
846 MmGetSessionLocaleId(VOID
);
850 MmSetMemoryPriorityProcess(
851 IN PEPROCESS Process
,
852 IN UCHAR MemoryPriority
855 /* i386/pfault.c *************************************************************/
867 /* special.c *****************************************************************/
871 MiInitializeSpecialPool();
876 IN SIZE_T NumberOfBytes
,
881 MmIsSpecialPoolAddress(
886 MmAllocateSpecialPool(
887 IN SIZE_T NumberOfBytes
,
889 IN POOL_TYPE PoolType
,
890 IN ULONG SpecialType
);
897 /* mm.c **********************************************************************/
902 IN BOOLEAN StoreInstruction
,
904 IN KPROCESSOR_MODE Mode
,
905 IN PVOID TrapInformation
908 /* anonmem.c *****************************************************************/
912 MmNotPresentFaultVirtualMemory(
913 PMMSUPPORT AddressSpace
,
914 MEMORY_AREA
* MemoryArea
,
920 MmPageOutVirtualMemory(
921 PMMSUPPORT AddressSpace
,
922 PMEMORY_AREA MemoryArea
,
930 PMEMORY_AREA MemoryArea
,
932 PMEMORY_BASIC_INFORMATION Info
,
939 struct _EPROCESS
* Process
,
940 PMEMORY_AREA MemoryArea
946 PMMSUPPORT AddressSpace
,
947 PMEMORY_AREA MemoryArea
,
956 MmWritePageVirtualMemory(
957 PMMSUPPORT AddressSpace
,
963 /* kmap.c ********************************************************************/
967 ExAllocatePage(VOID
);
971 ExUnmapPage(PVOID Addr
);
975 ExAllocatePageWithPhysPage(PFN_NUMBER Page
);
986 MiZeroPage(PFN_NUMBER Page
);
988 /* memsafe.s *****************************************************************/
992 MmSafeReadPtr(PVOID Source
);
994 /* process.c *****************************************************************/
998 MmCreateKernelStack(BOOLEAN GuiStack
, UCHAR Node
);
1002 MmDeleteKernelStack(PVOID Stack
,
1005 /* balace.c ******************************************************************/
1009 MmInitializeMemoryConsumer(
1011 NTSTATUS (*Trim
)(ULONG Target
, ULONG Priority
, PULONG NrFreed
)
1016 MmInitializeBalancer(
1017 ULONG NrAvailablePages
,
1023 MmReleasePageMemoryConsumer(
1030 MmRequestPageMemoryConsumer(
1033 PPFN_NUMBER AllocatedPage
1038 MiInitBalancerThread(VOID
);
1042 MmRebalanceMemoryConsumers(VOID
);
1044 /* rmap.c **************************************************************/
1048 MmSetRmapListHeadPage(
1050 struct _MM_RMAP_ENTRY
* ListHead
1053 struct _MM_RMAP_ENTRY
*
1055 MmGetRmapListHeadPage(PFN_NUMBER Page
);
1061 struct _EPROCESS
*Process
,
1070 VOID (*DeleteMapping
)(PVOID Context
, struct _EPROCESS
*Process
, PVOID Address
)
1077 struct _EPROCESS
*Process
,
1083 MmInitializeRmapList(VOID
);
1087 MmSetCleanAllRmaps(PFN_NUMBER Page
);
1091 MmSetDirtyAllRmaps(PFN_NUMBER Page
);
1095 MmIsDirtyPageRmap(PFN_NUMBER Page
);
1099 MmPageOutPhysicalAddress(PFN_NUMBER Page
);
1101 /* freelist.c **********************************************************/
1105 MiGetPfnEntry(IN PFN_NUMBER Pfn
)
1108 extern RTL_BITMAP MiPfnBitMap
;
1110 /* Make sure the PFN number is valid */
1111 if (Pfn
> MmHighestPhysicalPage
) return NULL
;
1113 /* Make sure this page actually has a PFN entry */
1114 if ((MiPfnBitMap
.Buffer
) && !(RtlTestBit(&MiPfnBitMap
, (ULONG
)Pfn
))) return NULL
;
1117 Page
= &MmPfnDatabase
[Pfn
];
1125 MiGetPfnEntryIndex(IN PMMPFN Pfn1
)
1128 // This will return the Page Frame Number (PFN) from the MMPFN
1130 return Pfn1
- MmPfnDatabase
;
1135 MmGetLRUNextUserPage(PFN_NUMBER PreviousPage
);
1139 MmGetLRUFirstUserPage(VOID
);
1143 MmInsertLRULastUserPage(PFN_NUMBER Page
);
1147 MmRemoveLRUUserPage(PFN_NUMBER Page
);
1151 MmLockPage(PFN_NUMBER Page
);
1155 MmUnlockPage(PFN_NUMBER Page
);
1159 MmGetLockCountPage(PFN_NUMBER Page
);
1163 MmInitializePageList(
1169 MmDumpArmPfnDatabase(
1170 IN BOOLEAN StatusOnly
1175 MmGetContinuousPages(
1176 ULONG NumberOfBytes
,
1177 PHYSICAL_ADDRESS LowestAcceptableAddress
,
1178 PHYSICAL_ADDRESS HighestAcceptableAddress
,
1179 PHYSICAL_ADDRESS BoundaryAddressMultiple
,
1189 /* hypermap.c *****************************************************************/
1191 extern PEPROCESS HyperProcess
;
1192 extern KIRQL HyperIrql
;
1196 MiMapPageInHyperSpace(IN PEPROCESS Process
,
1202 MiUnmapPageInHyperSpace(IN PEPROCESS Process
,
1208 MiMapPagesInZeroSpace(IN PMMPFN Pfn1
,
1209 IN PFN_NUMBER NumberOfPages
);
1213 MiUnmapPagesInZeroSpace(IN PVOID VirtualAddress
,
1214 IN PFN_NUMBER NumberOfPages
);
1217 // ReactOS Compatibility Layer
1221 MmCreateHyperspaceMapping(IN PFN_NUMBER Page
)
1223 HyperProcess
= (PEPROCESS
)KeGetCurrentThread()->ApcState
.Process
;
1224 return MiMapPageInHyperSpace(HyperProcess
, Page
, &HyperIrql
);
1227 #define MmDeleteHyperspaceMapping(x) MiUnmapPageInHyperSpace(HyperProcess, x, HyperIrql);
1229 /* i386/page.c *********************************************************/
1233 MmCreateVirtualMappingForKernel(
1242 MmCommitPagedPoolAddress(
1249 MmCreateVirtualMapping(
1250 struct _EPROCESS
* Process
,
1259 MmCreateVirtualMappingUnsafe(
1260 struct _EPROCESS
* Process
,
1270 struct _EPROCESS
* Process
,
1276 struct _EPROCESS
* Process
,
1284 struct _EPROCESS
* Process
,
1291 struct _EPROCESS
* Process
,
1297 MmInitGlobalKernelPageDirectory(VOID
);
1301 MmEnableVirtualMapping(
1302 struct _EPROCESS
*Process
,
1308 MmGetPageFileMapping(
1309 struct _EPROCESS
*Process
,
1311 SWAPENTRY
* SwapEntry
);
1315 MmDeletePageFileMapping(
1316 struct _EPROCESS
*Process
,
1318 SWAPENTRY
* SwapEntry
1323 MmCreatePageFileMapping(
1324 struct _EPROCESS
*Process
,
1332 struct _EPROCESS
*Process
,
1338 MmTransferOwnershipPage(
1346 struct _EPROCESS
*Process
,
1358 MmAllocPagesSpecifyRange(
1360 PHYSICAL_ADDRESS LowestAddress
,
1361 PHYSICAL_ADDRESS HighestAddress
,
1362 ULONG NumberOfPages
,
1368 MmDereferencePage(PFN_NUMBER Page
);
1372 MmReferencePage(PFN_NUMBER Page
);
1376 MmGetReferenceCountPage(PFN_NUMBER Page
);
1380 MmIsPageInUse(PFN_NUMBER Page
);
1384 MmSetSavedSwapEntryPage(
1386 SWAPENTRY SavedSwapEntry
);
1390 MmGetSavedSwapEntryPage(PFN_NUMBER Page
);
1395 struct _EPROCESS
*Process
,
1401 MmCreatePageTable(PVOID PAddress
);
1406 struct _EPROCESS
*Process
,
1413 struct _EPROCESS
*Process
,
1419 MmCreateProcessAddressSpace(
1422 IN PULONG_PTR DirectoryTableBase
1427 MmInitializeHandBuiltProcess(
1428 IN PEPROCESS Process
,
1429 IN PULONG_PTR DirectoryTableBase
1435 MmInitializeHandBuiltProcess2(
1436 IN PEPROCESS Process
1441 MmReleaseMmInfo(struct _EPROCESS
*Process
);
1445 MmSetExecuteOptions(IN ULONG ExecuteOptions
);
1449 MmGetExecuteOptions(IN PULONG ExecuteOptions
);
1453 MmDeleteProcessPageDirectory(struct _EPROCESS
*Process
);
1457 MmDeleteVirtualMapping(
1458 struct _EPROCESS
*Process
,
1468 struct _EPROCESS
*Process
,
1474 MmMarkPageMapped(PFN_NUMBER Page
);
1478 MmMarkPageUnmapped(PFN_NUMBER Page
);
1483 struct _EPROCESS
*Process
,
1490 MiInitPageDirectoryMap(VOID
);
1494 MiGetUserPageDirectoryCount(VOID
);
1496 /* wset.c ********************************************************************/
1505 /* region.c ************************************************************/
1510 PMMSUPPORT AddressSpace
,
1512 PLIST_ENTRY RegionListHead
,
1517 PMM_ALTER_REGION_FUNC AlterFunc
1523 PLIST_ENTRY RegionListHead
,
1533 PLIST_ENTRY RegionListHead
,
1535 PVOID
* RegionBaseAddress
1538 /* section.c *****************************************************************/
1542 MmGetImageInformation(
1543 OUT PSECTION_IMAGE_INFORMATION ImageInformation
1548 MmGetFileObjectForSection(
1553 MmGetFileNameForAddress(
1555 OUT PUNICODE_STRING ModuleName
1560 MmGetFileNameForSection(
1562 OUT POBJECT_NAME_INFORMATION
*ModuleName
1575 PMEMORY_AREA MemoryArea
,
1577 PMEMORY_BASIC_INFORMATION Info
,
1578 PSIZE_T ResultLength
1583 MmProtectSectionView(
1584 PMMSUPPORT AddressSpace
,
1585 PMEMORY_AREA MemoryArea
,
1594 MmInitSectionImplementation(VOID
);
1598 MmNotPresentFaultSectionView(
1599 PMMSUPPORT AddressSpace
,
1600 MEMORY_AREA
* MemoryArea
,
1607 MmPageOutSectionView(
1608 PMMSUPPORT AddressSpace
,
1609 PMEMORY_AREA MemoryArea
,
1616 MmCreatePhysicalMemorySection(VOID
);
1620 MmAccessFaultSectionView(
1621 PMMSUPPORT AddressSpace
,
1622 MEMORY_AREA
* MemoryArea
,
1628 MmFreeSectionSegments(PFILE_OBJECT FileObject
);
1630 /* mpw.c *********************************************************************/
1634 MmInitMpwThread(VOID
);
1638 MmInitBsmThread(VOID
);
1640 /* pager.c *******************************************************************/
1644 MiIsPagerThread(VOID
);
1648 MiStartPagerThread(VOID
);
1652 MiStopPagerThread(VOID
);
1656 MiQueryVirtualMemory(
1657 IN HANDLE ProcessHandle
,
1659 IN MEMORY_INFORMATION_CLASS VirtualMemoryInformationClass
,
1660 OUT PVOID VirtualMemoryInformation
,
1662 OUT PSIZE_T ResultLength
1665 /* sysldr.c ******************************************************************/
1669 MiReloadBootLoadedDrivers(
1670 IN PLOADER_PARAMETER_BLOCK LoaderBlock
1675 MiInitializeLoadedModuleList(
1676 IN PLOADER_PARAMETER_BLOCK LoaderBlock
1682 IN PUNICODE_STRING FileName
,
1683 IN PUNICODE_STRING NamePrefix OPTIONAL
,
1684 IN PUNICODE_STRING LoadedName OPTIONAL
,
1686 OUT PVOID
*ModuleObject
,
1687 OUT PVOID
*ImageBaseAddress
1692 MmUnloadSystemImage(
1693 IN PVOID ImageHandle
1699 IN HANDLE ImageHandle
,
1700 IN BOOLEAN PurgeSection
1705 MmCallDllInitialize(
1706 IN PLDR_DATA_TABLE_ENTRY LdrEntry
,
1707 IN PLIST_ENTRY ListHead
1711 /* procsup.c *****************************************************************/
1716 IN PVOID StackPointer
1722 MmLockAddressSpace(PMMSUPPORT AddressSpace
)
1724 KeAcquireGuardedMutex(&CONTAINING_RECORD(AddressSpace
, EPROCESS
, Vm
)->AddressCreationLock
);
1729 MmUnlockAddressSpace(PMMSUPPORT AddressSpace
)
1731 KeReleaseGuardedMutex(&CONTAINING_RECORD(AddressSpace
, EPROCESS
, Vm
)->AddressCreationLock
);
1736 MmGetAddressSpaceOwner(IN PMMSUPPORT AddressSpace
)
1738 if (AddressSpace
== MmKernelAddressSpace
) return NULL
;
1739 return CONTAINING_RECORD(AddressSpace
, EPROCESS
, Vm
);
1744 MmGetCurrentAddressSpace(VOID
)
1746 return &((PEPROCESS
)KeGetCurrentThread()->ApcState
.Process
)->Vm
;
1751 MmGetKernelAddressSpace(VOID
)
1753 return MmKernelAddressSpace
;
1757 /* expool.c ******************************************************************/
1761 ExpCheckPoolAllocation(
1767 /* session.c *****************************************************************/
1769 _IRQL_requires_max_(APC_LEVEL
)
1773 _Inout_ PVOID SessionEntry
,
1774 _Out_ PKAPC_STATE ApcState
);
1776 _IRQL_requires_max_(APC_LEVEL
)
1780 _Inout_ PVOID SessionEntry
,
1781 _Out_ PKAPC_STATE ApcState
);
1786 _Inout_ PVOID SessionEntry
);
1791 _In_ ULONG SessionId
);
1793 _IRQL_requires_max_(APC_LEVEL
)
1796 MmSetSessionLocaleId(
1797 _In_ LCID LocaleId
);