1 #ifndef __INCLUDE_INTERNAL_MM_H
2 #define __INCLUDE_INTERNAL_MM_H
4 #include <internal/arch/mm.h>
6 /* TYPES *********************************************************************/
10 extern ULONG MiFreeSwapPages
;
11 extern ULONG MiUsedSwapPages
;
12 extern ULONG MmPagedPoolSize
;
13 extern ULONG MmTotalPagedPoolQuota
;
14 extern ULONG MmTotalNonPagedPoolQuota
;
15 extern PHYSICAL_ADDRESS MmSharedDataPagePhysicalAddress
;
16 extern ULONG MmNumberOfPhysicalPages
;
17 extern ULONG MmLowestPhysicalPage
;
18 extern ULONG MmHighestPhysicalPage
;
20 extern PVOID MmPagedPoolBase
;
21 extern ULONG MmPagedPoolSize
;
23 extern PMEMORY_ALLOCATION_DESCRIPTOR MiFreeDescriptor
;
24 extern MEMORY_ALLOCATION_DESCRIPTOR MiFreeDescriptorOrg
;
28 struct _MM_RMAP_ENTRY
;
30 typedef ULONG SWAPENTRY
;
31 typedef ULONG PFN_TYPE
, *PPFN_TYPE
;
33 #define MI_STATIC_MEMORY_AREAS (8)
35 #define MEMORY_AREA_INVALID (0)
36 #define MEMORY_AREA_SECTION_VIEW (1)
37 #define MEMORY_AREA_CONTINUOUS_MEMORY (2)
38 #define MEMORY_AREA_NO_CACHE (3)
39 #define MEMORY_AREA_IO_MAPPING (4)
40 #define MEMORY_AREA_SYSTEM (5)
41 #define MEMORY_AREA_MDL_MAPPING (7)
42 #define MEMORY_AREA_VIRTUAL_MEMORY (8)
43 #define MEMORY_AREA_CACHE_SEGMENT (9)
44 #define MEMORY_AREA_SHARED_DATA (10)
45 #define MEMORY_AREA_KERNEL_STACK (11)
46 #define MEMORY_AREA_PAGED_POOL (12)
47 #define MEMORY_AREA_NO_ACCESS (13)
48 #define MEMORY_AREA_PEB_OR_TEB (14)
49 #define MEMORY_AREA_STATIC (0x80000000)
51 #define MM_PHYSICAL_PAGE_MPW_PENDING (0x8)
53 #define MM_CORE_DUMP_TYPE_NONE (0x0)
54 #define MM_CORE_DUMP_TYPE_MINIMAL (0x1)
55 #define MM_CORE_DUMP_TYPE_FULL (0x2)
57 #define MM_PAGEOP_PAGEIN (1)
58 #define MM_PAGEOP_PAGEOUT (2)
59 #define MM_PAGEOP_PAGESYNCH (3)
60 #define MM_PAGEOP_ACCESSFAULT (4)
62 /* Number of list heads to use */
63 #define MI_FREE_POOL_LISTS 4
65 #define MI_HYPERSPACE_PTES (256 - 1)
66 #define MI_ZERO_PTES (32)
67 #define MI_MAPPING_RANGE_START (ULONG)HYPER_SPACE
68 #define MI_MAPPING_RANGE_END (MI_MAPPING_RANGE_START + \
69 MI_HYPERSPACE_PTES * PAGE_SIZE)
70 #define MI_ZERO_PTE (PMMPTE)(MI_MAPPING_RANGE_END + \
73 /* Signature of free pool blocks */
74 #define MM_FREE_POOL_TAG 'lprF'
76 #define PAGE_TO_SECTION_PAGE_DIRECTORY_OFFSET(x) \
79 #define PAGE_TO_SECTION_PAGE_TABLE_OFFSET(x) \
80 ((((x)) % (4*1024*1024)) / (4*1024))
82 #define NR_SECTION_PAGE_TABLES 1024
83 #define NR_SECTION_PAGE_ENTRIES 1024
85 #define TEB_BASE 0x7FFDE000
87 /* Although Microsoft says this isn't hardcoded anymore,
88 they won't be able to change it. Stuff depends on it */
89 #define MM_VIRTMEM_GRANULARITY (64 * 1024)
91 #define STATUS_MM_RESTART_OPERATION ((NTSTATUS)0xD0000001)
94 * Additional flags for protection attributes
96 #define PAGE_WRITETHROUGH (1024)
97 #define PAGE_SYSTEM (2048)
99 #define SEC_PHYSICALMEMORY (0x80000000)
101 #define MM_PAGEFILE_SEGMENT (0x1)
102 #define MM_DATAFILE_SEGMENT (0x2)
107 #define MC_NPPOOL (3)
108 #define MC_SYSTEM (4)
109 #define MC_MAXIMUM (5)
111 #define PAGED_POOL_MASK 1
112 #define MUST_SUCCEED_POOL_MASK 2
113 #define CACHE_ALIGNED_POOL_MASK 4
114 #define QUOTA_POOL_MASK 8
115 #define SESSION_POOL_MASK 32
116 #define VERIFIER_POOL_MASK 64
118 #define MM_PAGED_POOL_SIZE (100*1024*1024)
119 #define MM_NONPAGED_POOL_SIZE (100*1024*1024)
122 * Paged and non-paged pools are 8-byte aligned
124 #define MM_POOL_ALIGNMENT 8
127 * Maximum size of the kmalloc area (this is totally arbitary)
129 #define MM_KERNEL_MAP_SIZE (16*1024*1024)
130 #define MM_KERNEL_MAP_BASE (0xf0c00000)
133 * FIXME - different architectures have different cache line sizes...
135 #define MM_CACHE_LINE_SIZE 32
137 #define MM_ROUND_UP(x,s) \
138 ((PVOID)(((ULONG_PTR)(x)+(s)-1) & ~((ULONG_PTR)(s)-1)))
140 #define MM_ROUND_DOWN(x,s) \
141 ((PVOID)(((ULONG_PTR)(x)) & ~((ULONG_PTR)(s)-1)))
143 #define PAGE_FLAGS_VALID_FROM_USER_MODE \
148 PAGE_EXECUTE_READ | \
149 PAGE_EXECUTE_READWRITE | \
150 PAGE_EXECUTE_WRITECOPY | \
155 #define PAGE_FLAGS_VALID_FOR_SECTION \
160 PAGE_EXECUTE_READ | \
161 PAGE_EXECUTE_READWRITE | \
162 PAGE_EXECUTE_WRITECOPY | \
165 #define PAGE_IS_READABLE \
169 PAGE_EXECUTE_READ | \
170 PAGE_EXECUTE_READWRITE | \
171 PAGE_EXECUTE_WRITECOPY)
173 #define PAGE_IS_WRITABLE \
176 PAGE_EXECUTE_READWRITE | \
177 PAGE_EXECUTE_WRITECOPY)
179 #define PAGE_IS_EXECUTABLE \
181 PAGE_EXECUTE_READ | \
182 PAGE_EXECUTE_READWRITE | \
183 PAGE_EXECUTE_WRITECOPY)
185 #define PAGE_IS_WRITECOPY \
187 PAGE_EXECUTE_WRITECOPY)
190 #define InterlockedCompareExchangePte(PointerPte, Exchange, Comperand) \
191 InterlockedCompareExchange((PLONG)(PointerPte), Exchange, Comperand)
193 #define InterlockedExchangePte(PointerPte, Value) \
194 InterlockedExchange((PLONG)(PointerPte), Value)
198 ULONG Entry
[NR_SECTION_PAGE_ENTRIES
];
199 } SECTION_PAGE_TABLE
, *PSECTION_PAGE_TABLE
;
203 PSECTION_PAGE_TABLE PageTables
[NR_SECTION_PAGE_TABLES
];
204 } SECTION_PAGE_DIRECTORY
, *PSECTION_PAGE_DIRECTORY
;
206 typedef struct _MM_SECTION_SEGMENT
208 LONG FileOffset
; /* start offset into the file for image sections */
209 ULONG_PTR VirtualAddress
; /* dtart offset into the address range for image sections */
210 ULONG RawLength
; /* length of the segment which is part of the mapped file */
211 ULONG Length
; /* absolute length of the segment */
213 FAST_MUTEX Lock
; /* lock which protects the page directory */
214 ULONG ReferenceCount
;
215 SECTION_PAGE_DIRECTORY PageDirectory
;
217 ULONG Characteristics
;
219 } MM_SECTION_SEGMENT
, *PMM_SECTION_SEGMENT
;
221 typedef struct _MM_IMAGE_SECTION_OBJECT
224 ULONG_PTR StackReserve
;
225 ULONG_PTR StackCommit
;
226 ULONG_PTR EntryPoint
;
228 USHORT ImageCharacteristics
;
229 USHORT MinorSubsystemVersion
;
230 USHORT MajorSubsystemVersion
;
235 PMM_SECTION_SEGMENT Segments
;
236 } MM_IMAGE_SECTION_OBJECT
, *PMM_IMAGE_SECTION_OBJECT
;
238 typedef struct _ROS_SECTION_OBJECT
242 LARGE_INTEGER MaximumSize
;
243 ULONG SectionPageProtection
;
244 ULONG AllocationAttributes
;
245 PFILE_OBJECT FileObject
;
248 PMM_IMAGE_SECTION_OBJECT ImageSection
;
249 PMM_SECTION_SEGMENT Segment
;
251 } ROS_SECTION_OBJECT
, *PROS_SECTION_OBJECT
;
253 typedef struct _MEMORY_AREA
255 PVOID StartingAddress
;
257 struct _MEMORY_AREA
*Parent
;
258 struct _MEMORY_AREA
*LeftChild
;
259 struct _MEMORY_AREA
*RightChild
;
263 BOOLEAN DeleteInProgress
;
269 ROS_SECTION_OBJECT
* Section
;
271 PMM_SECTION_SEGMENT Segment
;
272 BOOLEAN WriteCopyView
;
273 LIST_ENTRY RegionListHead
;
277 LIST_ENTRY RegionListHead
;
280 } MEMORY_AREA
, *PMEMORY_AREA
;
290 ULONG PagingRequestsInLastMinute
;
291 ULONG PagingRequestsInLastFiveMinutes
;
292 ULONG PagingRequestsInLastFifteenMinutes
;
296 // These two mappings are actually used by Windows itself, based on the ASSERTS
298 #define StartOfAllocation ReadInProgress
299 #define EndOfAllocation WriteInProgress
301 typedef struct _MMPFNENTRY
304 USHORT ReadInProgress
:1; // StartOfAllocation
305 USHORT WriteInProgress
:1; // EndOfAllocation
306 USHORT PrototypePte
:1; // Zero
307 USHORT PageColor
:4; // LockCount
308 USHORT PageLocation
:3; // Consumer
309 USHORT RemovalRequested
:1;
310 USHORT CacheAttribute
:2; // Type
312 USHORT ParityError
:1;
315 typedef struct _MMPFN
319 PFN_NUMBER Flink
; // ListEntry.Flink
323 SINGLE_LIST_ENTRY NextStackPfn
;
325 PMMPTE PteAddress
; // ListEntry.Blink
329 ULONG_PTR ShareCount
; // MapCount
335 USHORT ReferenceCount
; // ReferenceCount
340 USHORT ReferenceCount
;
347 LONG AweReferenceCount
; // RmapListHead
351 ULONG_PTR EntireFrame
; // SavedSwapEntry
354 ULONG_PTR PteFrame
:25;
355 ULONG_PTR InPageError
:1;
356 ULONG_PTR VerifierAllocation
:1;
357 ULONG_PTR AweAllocation
:1;
358 ULONG_PTR Priority
:3;
359 ULONG_PTR MustBeCached
:1;
364 extern PMMPFN MmPfnDatabase
;
365 extern MM_STATS MmStats
;
367 typedef struct _MM_PAGEOP
369 /* Type of operation. */
371 /* Number of threads interested in this operation. */
372 ULONG ReferenceCount
;
373 /* Event that will be set when the operation is completed. */
374 KEVENT CompletionEvent
;
375 /* Status of the operation once it is completed. */
377 /* TRUE if the operation was abandoned. */
379 /* The memory area to be affected by the operation. */
382 struct _MM_PAGEOP
* Next
;
383 struct _ETHREAD
* Thread
;
385 * These fields are used to identify the operation if it is against a
386 * virtual memory area.
391 * These fields are used to identify the operation if it is against a
394 PMM_SECTION_SEGMENT Segment
;
396 } MM_PAGEOP
, *PMM_PAGEOP
;
398 typedef struct _MM_MEMORY_CONSUMER
402 NTSTATUS (*Trim
)(ULONG Target
, ULONG Priority
, PULONG NrFreed
);
403 } MM_MEMORY_CONSUMER
, *PMM_MEMORY_CONSUMER
;
405 typedef struct _MM_REGION
410 LIST_ENTRY RegionListEntry
;
411 } MM_REGION
, *PMM_REGION
;
413 /* Entry describing free pool memory */
414 typedef struct _MMFREE_POOL_ENTRY
419 struct _MMFREE_POOL_ENTRY
*Owner
;
420 } MMFREE_POOL_ENTRY
, *PMMFREE_POOL_ENTRY
;
422 /* Paged pool information */
423 typedef struct _MM_PAGED_POOL_INFO
425 PRTL_BITMAP PagedPoolAllocationMap
;
426 PRTL_BITMAP EndOfPagedPoolBitmap
;
427 PMMPTE FirstPteForPagedPool
;
428 PMMPTE LastPteForPagedPool
;
429 PMMPTE NextPdeForPagedPoolExpansion
;
431 SIZE_T PagedPoolCommit
;
432 SIZE_T AllocatedPagedPool
;
433 } MM_PAGED_POOL_INFO
, *PMM_PAGED_POOL_INFO
;
435 extern MM_MEMORY_CONSUMER MiMemoryConsumers
[MC_MAXIMUM
];
438 (*PMM_ALTER_REGION_FUNC
)(
439 PMMSUPPORT AddressSpace
,
449 (*PMM_FREE_PAGE_FUNC
)(
451 PMEMORY_AREA MemoryArea
,
458 /* marea.c *******************************************************************/
463 PMMSUPPORT AddressSpace
,
468 PMEMORY_AREA
*Result
,
469 BOOLEAN FixedAddress
,
470 ULONG AllocationFlags
,
471 PHYSICAL_ADDRESS BoundaryAddressMultiple OPTIONAL
476 MmLocateMemoryAreaByAddress(
477 PMMSUPPORT AddressSpace
,
484 PMMSUPPORT AddressSpace
,
491 PMMSUPPORT AddressSpace
,
492 PMEMORY_AREA MemoryArea
,
493 PMM_FREE_PAGE_FUNC FreePage
,
494 PVOID FreePageContext
499 MmFreeMemoryAreaByPtr(
500 PMMSUPPORT AddressSpace
,
502 PMM_FREE_PAGE_FUNC FreePage
,
503 PVOID FreePageContext
508 MmDumpMemoryAreas(PMMSUPPORT AddressSpace
);
512 MmLocateMemoryAreaByRegion(
513 PMMSUPPORT AddressSpace
,
521 PMMSUPPORT AddressSpace
,
523 ULONG_PTR Granularity
,
529 MmReleaseMemoryAreaIfDecommitted(
530 struct _EPROCESS
*Process
,
531 PMMSUPPORT AddressSpace
,
537 MmMapMemoryArea(PVOID BaseAddress
,
542 /* npool.c *******************************************************************/
546 MiDebugDumpNonPagedPool(BOOLEAN NewOnly
);
550 MiDebugDumpNonPagedPoolStats(BOOLEAN NewOnly
);
554 MiInitializeNonPagedPool(VOID
);
559 IN POOL_TYPE PoolType
,
560 IN SIZE_T SizeInBytes
566 IN PVOID VirtualAddress
572 IN PVOID StartingAddress
582 /* pool.c *******************************************************************/
586 ExAllocateNonPagedPoolWithTag(
595 ExAllocatePagedPoolWithTag(
603 ExFreeNonPagedPool(PVOID block
);
607 ExFreePagedPool(IN PVOID Block
);
611 ExpIsPoolTagDebuggable(ULONG Tag
);
615 ExpAllocateDebugPool(
625 ExpFreeDebugPool(PVOID Block
, BOOLEAN PagedPool
);
629 MmInitializePagedPool(VOID
);
633 MiAllocateSpecialPool(
634 IN POOL_TYPE PoolType
,
635 IN SIZE_T NumberOfBytes
,
643 IN POOL_TYPE PoolType
,
644 IN ULONG CurrentMaxQuota
,
645 OUT PULONG NewMaxQuota
648 /* mdl.c *********************************************************************/
657 /* mminit.c ******************************************************************/
661 MiShutdownMemoryManager(VOID
);
671 MmInitSystem(IN ULONG Phase
,
672 IN PLOADER_PARAMETER_BLOCK LoaderBlock
);
676 MiFreeInitMemory(VOID
);
680 MmInitializeMdlImplementation(VOID
);
682 /* pagefile.c ****************************************************************/
686 MmAllocSwapPage(VOID
);
690 MmDereserveSwapPages(ULONG Nr
);
694 MmFreeSwapPage(SWAPENTRY Entry
);
698 MmInitPagingFile(VOID
);
709 MmReserveSwapPages(ULONG Nr
);
722 ULONG BugCodeParameter1
,
723 ULONG BugCodeParameter2
,
724 ULONG BugCodeParameter3
,
725 ULONG BugCodeParameter4
,
726 struct _KTRAP_FRAME
* TrapFrame
731 MmIsAvailableSwapPage(VOID
);
735 MmShowOutOfSpaceMessagePagingFile(VOID
);
737 /* process.c ****************************************************************/
741 MmInitializeProcessAddressSpace(
742 IN PEPROCESS Process
,
743 IN PEPROCESS Clone OPTIONAL
,
744 IN PVOID Section OPTIONAL
,
746 IN POBJECT_NAME_INFORMATION
*AuditName OPTIONAL
751 MmCreatePeb(struct _EPROCESS
*Process
);
756 struct _EPROCESS
*Process
,
758 PINITIAL_TEB InitialTeb
764 struct _EPROCESS
*Process
,
770 MmCleanProcessAddressSpace(IN PEPROCESS Process
);
774 MmDeleteProcessAddressSpace(IN PEPROCESS Process
);
778 MmGetSessionLocaleId(VOID
);
782 MmSetMemoryPriorityProcess(
783 IN PEPROCESS Process
,
784 IN UCHAR MemoryPriority
787 /* i386/pfault.c *************************************************************/
799 /* mm.c **********************************************************************/
804 IN BOOLEAN StoreInstruction
,
806 IN KPROCESSOR_MODE Mode
,
807 IN PVOID TrapInformation
810 /* anonmem.c *****************************************************************/
814 MmNotPresentFaultVirtualMemory(
815 PMMSUPPORT AddressSpace
,
816 MEMORY_AREA
* MemoryArea
,
823 MmPageOutVirtualMemory(
824 PMMSUPPORT AddressSpace
,
825 PMEMORY_AREA MemoryArea
,
827 struct _MM_PAGEOP
* PageOp
833 PMEMORY_AREA MemoryArea
,
835 PMEMORY_BASIC_INFORMATION Info
,
842 struct _EPROCESS
* Process
,
843 PMEMORY_AREA MemoryArea
849 PMMSUPPORT AddressSpace
,
850 PMEMORY_AREA MemoryArea
,
859 MmWritePageVirtualMemory(
860 PMMSUPPORT AddressSpace
,
866 /* kmap.c ********************************************************************/
870 ExAllocatePage(VOID
);
874 ExUnmapPage(PVOID Addr
);
878 ExAllocatePageWithPhysPage(PFN_TYPE Page
);
889 MiZeroPage(PFN_TYPE Page
);
891 /* memsafe.s *****************************************************************/
895 MmSafeReadPtr(PVOID Source
);
897 /* pageop.c ******************************************************************/
901 MmReleasePageOp(PMM_PAGEOP PageOp
);
909 PMM_SECTION_SEGMENT Segment
,
921 PMM_SECTION_SEGMENT Segment
,
927 MmInitializePageOp(VOID
);
929 /* process.c *****************************************************************/
933 MmCreateKernelStack(BOOLEAN GuiStack
, UCHAR Node
);
937 MmDeleteKernelStack(PVOID Stack
,
940 /* balace.c ******************************************************************/
944 MmInitializeMemoryConsumer(
946 NTSTATUS (*Trim
)(ULONG Target
, ULONG Priority
, PULONG NrFreed
)
951 MmInitializeBalancer(
952 ULONG NrAvailablePages
,
958 MmReleasePageMemoryConsumer(
965 MmRequestPageMemoryConsumer(
968 PPFN_TYPE AllocatedPage
973 MiInitBalancerThread(VOID
);
977 MmRebalanceMemoryConsumers(VOID
);
979 /* rmap.c **************************************************************/
983 MmSetRmapListHeadPage(
985 struct _MM_RMAP_ENTRY
* ListHead
988 struct _MM_RMAP_ENTRY
*
990 MmGetRmapListHeadPage(PFN_TYPE Page
);
996 struct _EPROCESS
*Process
,
1005 VOID (*DeleteMapping
)(PVOID Context
, struct _EPROCESS
*Process
, PVOID Address
)
1012 struct _EPROCESS
*Process
,
1018 MmInitializeRmapList(VOID
);
1022 MmSetCleanAllRmaps(PFN_TYPE Page
);
1026 MmSetDirtyAllRmaps(PFN_TYPE Page
);
1030 MmIsDirtyPageRmap(PFN_TYPE Page
);
1034 MmWritePagePhysicalAddress(PFN_TYPE Page
);
1038 MmPageOutPhysicalAddress(PFN_TYPE Page
);
1040 /* freelist.c **********************************************************/
1042 #define ASSERT_PFN(x) ASSERT((x)->u3.e1.CacheAttribute != 0)
1046 MiGetPfnEntry(IN PFN_TYPE Pfn
)
1049 extern RTL_BITMAP MiPfnBitMap
;
1051 /* Make sure the PFN number is valid */
1052 if (Pfn
> MmHighestPhysicalPage
) return NULL
;
1054 /* Make sure this page actually has a PFN entry */
1055 if ((MiPfnBitMap
.Buffer
) && !(RtlTestBit(&MiPfnBitMap
, Pfn
))) return NULL
;
1058 Page
= &MmPfnDatabase
[Pfn
];
1060 /* Make sure it's valid */
1069 MiGetPfnEntryIndex(IN PMMPFN Pfn1
)
1072 // This will return the Page Frame Number (PFN) from the MMPFN
1074 return Pfn1
- MmPfnDatabase
;
1079 MmGetLRUNextUserPage(PFN_TYPE PreviousPage
);
1083 MmGetLRUFirstUserPage(VOID
);
1087 MmInsertLRULastUserPage(PFN_TYPE Page
);
1091 MmRemoveLRUUserPage(PFN_TYPE Page
);
1095 MmLockPage(PFN_TYPE Page
);
1099 MmUnlockPage(PFN_TYPE Page
);
1103 MmGetLockCountPage(PFN_TYPE Page
);
1107 MmInitializePageList(
1119 MmGetContinuousPages(
1120 ULONG NumberOfBytes
,
1121 PHYSICAL_ADDRESS LowestAcceptableAddress
,
1122 PHYSICAL_ADDRESS HighestAcceptableAddress
,
1123 PHYSICAL_ADDRESS BoundaryAddressMultiple
,
1129 MmZeroPageThreadMain(
1133 /* hypermap.c *****************************************************************/
1135 extern PEPROCESS HyperProcess
;
1136 extern KIRQL HyperIrql
;
1140 MiMapPageInHyperSpace(IN PEPROCESS Process
,
1146 MiUnmapPageInHyperSpace(IN PEPROCESS Process
,
1152 MiMapPagesToZeroInHyperSpace(IN PMMPFN
*Pages
,
1153 IN PFN_NUMBER NumberOfPages
);
1157 MiUnmapPagesInZeroSpace(IN PVOID VirtualAddress
,
1158 IN PFN_NUMBER NumberOfPages
);
1161 // ReactOS Compatibility Layer
1165 MmCreateHyperspaceMapping(IN PFN_NUMBER Page
)
1167 HyperProcess
= (PEPROCESS
)KeGetCurrentThread()->ApcState
.Process
;
1168 return MiMapPageInHyperSpace(HyperProcess
, Page
, &HyperIrql
);
1173 MiMapPageToZeroInHyperSpace(IN PFN_NUMBER Page
)
1175 PMMPFN Pfn1
= MiGetPfnEntry(Page
);
1176 return MiMapPagesToZeroInHyperSpace(&Pfn1
, 1);
1179 #define MmDeleteHyperspaceMapping(x) MiUnmapPageInHyperSpace(HyperProcess, x, HyperIrql);
1181 /* i386/page.c *********************************************************/
1185 MmCreateVirtualMappingForKernel(
1194 MmCommitPagedPoolAddress(
1201 MmCreateVirtualMapping(
1202 struct _EPROCESS
* Process
,
1211 MmCreateVirtualMappingUnsafe(
1212 struct _EPROCESS
* Process
,
1222 struct _EPROCESS
* Process
,
1228 struct _EPROCESS
* Process
,
1236 struct _EPROCESS
* Process
,
1242 MmInitGlobalKernelPageDirectory(VOID
);
1246 MmDisableVirtualMapping(
1247 struct _EPROCESS
*Process
,
1255 MmEnableVirtualMapping(
1256 struct _EPROCESS
*Process
,
1262 MmRawDeleteVirtualMapping(PVOID Address
);
1266 MmDeletePageFileMapping(
1267 struct _EPROCESS
*Process
,
1269 SWAPENTRY
* SwapEntry
1274 MmCreatePageFileMapping(
1275 struct _EPROCESS
*Process
,
1283 struct _EPROCESS
*Process
,
1289 MmTransferOwnershipPage(
1297 struct _EPROCESS
*Process
,
1305 SWAPENTRY SavedSwapEntry
1310 MmAllocPagesSpecifyRange(
1312 PHYSICAL_ADDRESS LowestAddress
,
1313 PHYSICAL_ADDRESS HighestAddress
,
1314 ULONG NumberOfPages
,
1320 MmDereferencePage(PFN_TYPE Page
);
1324 MmReferencePage(PFN_TYPE Page
);
1328 MmGetReferenceCountPage(PFN_TYPE Page
);
1332 MmIsPageInUse(PFN_TYPE Page
);
1336 MmSetSavedSwapEntryPage(
1338 SWAPENTRY SavedSwapEntry
);
1342 MmGetSavedSwapEntryPage(PFN_TYPE Page
);
1347 struct _EPROCESS
*Process
,
1353 MmCreatePageTable(PVOID PAddress
);
1358 struct _EPROCESS
*Process
,
1365 struct _EPROCESS
*Process
,
1371 MmCreateProcessAddressSpace(
1374 IN PULONG_PTR DirectoryTableBase
1379 MmInitializeHandBuiltProcess(
1380 IN PEPROCESS Process
,
1381 IN PULONG_PTR DirectoryTableBase
1387 MmInitializeHandBuiltProcess2(
1388 IN PEPROCESS Process
1393 MmReleaseMmInfo(struct _EPROCESS
*Process
);
1397 Mmi386ReleaseMmInfo(struct _EPROCESS
*Process
);
1401 MmDeleteVirtualMapping(
1402 struct _EPROCESS
*Process
,
1412 struct _EPROCESS
*Process
,
1418 MmMarkPageMapped(PFN_TYPE Page
);
1422 MmMarkPageUnmapped(PFN_TYPE Page
);
1427 struct _EPROCESS
*Process
,
1434 MiInitPageDirectoryMap(VOID
);
1438 MiGetUserPageDirectoryCount(VOID
);
1440 /* wset.c ********************************************************************/
1449 /* region.c ************************************************************/
1454 PMMSUPPORT AddressSpace
,
1456 PLIST_ENTRY RegionListHead
,
1461 PMM_ALTER_REGION_FUNC AlterFunc
1467 PLIST_ENTRY RegionListHead
,
1477 PLIST_ENTRY RegionListHead
,
1479 PVOID
* RegionBaseAddress
1482 /* section.c *****************************************************************/
1486 MmGetFileObjectForSection(
1487 IN PROS_SECTION_OBJECT Section
1491 MmGetFileNameForAddress(
1493 OUT PUNICODE_STRING ModuleName
1498 MmGetFileNameForSection(
1499 IN PROS_SECTION_OBJECT Section
,
1500 OUT POBJECT_NAME_INFORMATION
*ModuleName
1513 PMEMORY_AREA MemoryArea
,
1515 PMEMORY_BASIC_INFORMATION Info
,
1516 PSIZE_T ResultLength
1521 MmProtectSectionView(
1522 PMMSUPPORT AddressSpace
,
1523 PMEMORY_AREA MemoryArea
,
1532 MmWritePageSectionView(
1533 PMMSUPPORT AddressSpace
,
1541 MmInitSectionImplementation(VOID
);
1545 MmNotPresentFaultSectionView(
1546 PMMSUPPORT AddressSpace
,
1547 MEMORY_AREA
* MemoryArea
,
1554 MmPageOutSectionView(
1555 PMMSUPPORT AddressSpace
,
1556 PMEMORY_AREA MemoryArea
,
1558 struct _MM_PAGEOP
*PageOp
1563 MmCreatePhysicalMemorySection(VOID
);
1567 MmAccessFaultSectionView(
1568 PMMSUPPORT AddressSpace
,
1569 MEMORY_AREA
* MemoryArea
,
1576 MmFreeSectionSegments(PFILE_OBJECT FileObject
);
1578 /* mpw.c *********************************************************************/
1582 MmInitMpwThread(VOID
);
1586 MmInitBsmThread(VOID
);
1588 /* pager.c *******************************************************************/
1592 MiIsPagerThread(VOID
);
1596 MiStartPagerThread(VOID
);
1600 MiStopPagerThread(VOID
);
1604 MiQueryVirtualMemory(
1605 IN HANDLE ProcessHandle
,
1607 IN MEMORY_INFORMATION_CLASS VirtualMemoryInformationClass
,
1608 OUT PVOID VirtualMemoryInformation
,
1610 OUT PSIZE_T ResultLength
1613 /* sysldr.c ******************************************************************/
1617 MiReloadBootLoadedDrivers(
1618 IN PLOADER_PARAMETER_BLOCK LoaderBlock
1623 MiInitializeLoadedModuleList(
1624 IN PLOADER_PARAMETER_BLOCK LoaderBlock
1630 IN PUNICODE_STRING FileName
,
1631 IN PUNICODE_STRING NamePrefix OPTIONAL
,
1632 IN PUNICODE_STRING LoadedName OPTIONAL
,
1634 OUT PVOID
*ModuleObject
,
1635 OUT PVOID
*ImageBaseAddress
1640 MmUnloadSystemImage(
1641 IN PVOID ImageHandle
1647 IN HANDLE ImageHandle
,
1648 IN BOOLEAN PurgeSection
1653 MmCallDllInitialize(
1654 IN PLDR_DATA_TABLE_ENTRY LdrEntry
,
1655 IN PLIST_ENTRY ListHead
1658 /* ReactOS Mm Hacks */
1661 MiSyncForProcessAttach(
1662 IN PKTHREAD NextThread
,
1663 IN PEPROCESS Process
1668 MiSyncForContextSwitch(
1672 extern PMMSUPPORT MmKernelAddressSpace
;
1676 MmLockAddressSpace(PMMSUPPORT AddressSpace
)
1678 KeAcquireGuardedMutex(&CONTAINING_RECORD(AddressSpace
, EPROCESS
, Vm
)->AddressCreationLock
);
1683 MmUnlockAddressSpace(PMMSUPPORT AddressSpace
)
1685 KeReleaseGuardedMutex(&CONTAINING_RECORD(AddressSpace
, EPROCESS
, Vm
)->AddressCreationLock
);
1690 MmGetAddressSpaceOwner(IN PMMSUPPORT AddressSpace
)
1692 if (AddressSpace
== MmKernelAddressSpace
) return NULL
;
1693 return CONTAINING_RECORD(AddressSpace
, EPROCESS
, Vm
);
1698 MmGetCurrentAddressSpace(VOID
)
1700 return &((PEPROCESS
)KeGetCurrentThread()->ApcState
.Process
)->Vm
;
1705 MmGetKernelAddressSpace(VOID
)
1707 return MmKernelAddressSpace
;