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
;
18 extern PVOID MmPagedPoolBase
;
19 extern ULONG MmPagedPoolSize
;
21 extern PMEMORY_ALLOCATION_DESCRIPTOR MiFreeDescriptor
;
22 extern MEMORY_ALLOCATION_DESCRIPTOR MiFreeDescriptorOrg
;
23 extern ULONG MmHighestPhysicalPage
;
24 extern PVOID MmPfnDatabase
;
28 struct _MM_RMAP_ENTRY
;
30 typedef ULONG SWAPENTRY
;
31 typedef ULONG PFN_TYPE
, *PPFN_TYPE
;
33 #define MEMORY_AREA_INVALID (0)
34 #define MEMORY_AREA_SECTION_VIEW (1)
35 #define MEMORY_AREA_CONTINUOUS_MEMORY (2)
36 #define MEMORY_AREA_NO_CACHE (3)
37 #define MEMORY_AREA_IO_MAPPING (4)
38 #define MEMORY_AREA_SYSTEM (5)
39 #define MEMORY_AREA_MDL_MAPPING (7)
40 #define MEMORY_AREA_VIRTUAL_MEMORY (8)
41 #define MEMORY_AREA_CACHE_SEGMENT (9)
42 #define MEMORY_AREA_SHARED_DATA (10)
43 #define MEMORY_AREA_KERNEL_STACK (11)
44 #define MEMORY_AREA_PAGED_POOL (12)
45 #define MEMORY_AREA_NO_ACCESS (13)
46 #define MEMORY_AREA_PEB_OR_TEB (14)
48 #define MM_PHYSICAL_PAGE_MPW_PENDING (0x8)
50 #define MM_CORE_DUMP_TYPE_NONE (0x0)
51 #define MM_CORE_DUMP_TYPE_MINIMAL (0x1)
52 #define MM_CORE_DUMP_TYPE_FULL (0x2)
54 #define MM_PAGEOP_PAGEIN (1)
55 #define MM_PAGEOP_PAGEOUT (2)
56 #define MM_PAGEOP_PAGESYNCH (3)
57 #define MM_PAGEOP_ACCESSFAULT (4)
59 /* Number of list heads to use */
60 #define MI_FREE_POOL_LISTS 4
62 /* Signature of free pool blocks */
63 #define MM_FREE_POOL_TAG TAG('F', 'r', 'p', 'l')
65 #define PAGE_TO_SECTION_PAGE_DIRECTORY_OFFSET(x) \
68 #define PAGE_TO_SECTION_PAGE_TABLE_OFFSET(x) \
69 ((((x)) % (4*1024*1024)) / (4*1024))
71 #define NR_SECTION_PAGE_TABLES 1024
72 #define NR_SECTION_PAGE_ENTRIES 1024
74 #define TEB_BASE 0x7FFDE000
76 /* Although Microsoft says this isn't hardcoded anymore,
77 they won't be able to change it. Stuff depends on it */
78 #define MM_VIRTMEM_GRANULARITY (64 * 1024)
80 #define STATUS_MM_RESTART_OPERATION ((NTSTATUS)0xD0000001)
83 * Additional flags for protection attributes
85 #define PAGE_WRITETHROUGH (1024)
86 #define PAGE_SYSTEM (2048)
88 #define SEC_PHYSICALMEMORY (0x80000000)
90 #define MM_PAGEFILE_SEGMENT (0x1)
91 #define MM_DATAFILE_SEGMENT (0x2)
97 #define MC_MAXIMUM (4)
99 #define PAGED_POOL_MASK 1
100 #define MUST_SUCCEED_POOL_MASK 2
101 #define CACHE_ALIGNED_POOL_MASK 4
102 #define QUOTA_POOL_MASK 8
103 #define SESSION_POOL_MASK 32
104 #define VERIFIER_POOL_MASK 64
106 #define MM_PAGED_POOL_SIZE (100*1024*1024)
107 #define MM_NONPAGED_POOL_SIZE (100*1024*1024)
110 * Paged and non-paged pools are 8-byte aligned
112 #define MM_POOL_ALIGNMENT 8
115 * Maximum size of the kmalloc area (this is totally arbitary)
117 #define MM_KERNEL_MAP_SIZE (16*1024*1024)
118 #define MM_KERNEL_MAP_BASE (0xf0c00000)
121 * FIXME - different architectures have different cache line sizes...
123 #define MM_CACHE_LINE_SIZE 32
125 #define MM_ROUND_UP(x,s) \
126 ((PVOID)(((ULONG_PTR)(x)+(s)-1) & ~((ULONG_PTR)(s)-1)))
128 #define MM_ROUND_DOWN(x,s) \
129 ((PVOID)(((ULONG_PTR)(x)) & ~((ULONG_PTR)(s)-1)))
131 #define PAGE_FLAGS_VALID_FROM_USER_MODE \
136 PAGE_EXECUTE_READ | \
137 PAGE_EXECUTE_READWRITE | \
138 PAGE_EXECUTE_WRITECOPY | \
143 #define PAGE_IS_READABLE \
147 PAGE_EXECUTE_READ | \
148 PAGE_EXECUTE_READWRITE | \
149 PAGE_EXECUTE_WRITECOPY)
151 #define PAGE_IS_WRITABLE \
154 PAGE_EXECUTE_READWRITE | \
155 PAGE_EXECUTE_WRITECOPY)
157 #define PAGE_IS_EXECUTABLE \
159 PAGE_EXECUTE_READ | \
160 PAGE_EXECUTE_READWRITE | \
161 PAGE_EXECUTE_WRITECOPY)
163 #define PAGE_IS_WRITECOPY \
165 PAGE_EXECUTE_WRITECOPY)
169 ULONG Entry
[NR_SECTION_PAGE_ENTRIES
];
170 } SECTION_PAGE_TABLE
, *PSECTION_PAGE_TABLE
;
174 PSECTION_PAGE_TABLE PageTables
[NR_SECTION_PAGE_TABLES
];
175 } SECTION_PAGE_DIRECTORY
, *PSECTION_PAGE_DIRECTORY
;
177 typedef struct _MM_SECTION_SEGMENT
179 LONG FileOffset
; /* start offset into the file for image sections */
180 ULONG_PTR VirtualAddress
; /* dtart offset into the address range for image sections */
181 ULONG RawLength
; /* length of the segment which is part of the mapped file */
182 ULONG Length
; /* absolute length of the segment */
184 FAST_MUTEX Lock
; /* lock which protects the page directory */
185 ULONG ReferenceCount
;
186 SECTION_PAGE_DIRECTORY PageDirectory
;
188 ULONG Characteristics
;
190 } MM_SECTION_SEGMENT
, *PMM_SECTION_SEGMENT
;
192 typedef struct _MM_IMAGE_SECTION_OBJECT
195 ULONG_PTR StackReserve
;
196 ULONG_PTR StackCommit
;
197 ULONG_PTR EntryPoint
;
199 USHORT ImageCharacteristics
;
200 USHORT MinorSubsystemVersion
;
201 USHORT MajorSubsystemVersion
;
206 PMM_SECTION_SEGMENT Segments
;
207 } MM_IMAGE_SECTION_OBJECT
, *PMM_IMAGE_SECTION_OBJECT
;
209 typedef struct _ROS_SECTION_OBJECT
213 LARGE_INTEGER MaximumSize
;
214 ULONG SectionPageProtection
;
215 ULONG AllocationAttributes
;
216 PFILE_OBJECT FileObject
;
219 PMM_IMAGE_SECTION_OBJECT ImageSection
;
220 PMM_SECTION_SEGMENT Segment
;
222 } ROS_SECTION_OBJECT
, *PROS_SECTION_OBJECT
;
224 typedef struct _MEMORY_AREA
226 PVOID StartingAddress
;
228 struct _MEMORY_AREA
*Parent
;
229 struct _MEMORY_AREA
*LeftChild
;
230 struct _MEMORY_AREA
*RightChild
;
234 BOOLEAN DeleteInProgress
;
240 ROS_SECTION_OBJECT
* Section
;
242 PMM_SECTION_SEGMENT Segment
;
243 BOOLEAN WriteCopyView
;
244 LIST_ENTRY RegionListHead
;
248 LIST_ENTRY RegionListHead
;
251 } MEMORY_AREA
, *PMEMORY_AREA
;
261 ULONG PagingRequestsInLastMinute
;
262 ULONG PagingRequestsInLastFiveMinutes
;
263 ULONG PagingRequestsInLastFifteenMinutes
;
266 typedef struct _PHYSICAL_PAGE
275 ULONG StartOfAllocation
: 1;
276 ULONG EndOfAllocation
: 1;
282 LIST_ENTRY ListEntry
;
283 ULONG ReferenceCount
;
284 SWAPENTRY SavedSwapEntry
;
287 struct _MM_RMAP_ENTRY
* RmapListHead
;
289 PHYSICAL_PAGE
, *PPHYSICAL_PAGE
;
291 extern MM_STATS MmStats
;
293 typedef struct _MM_PAGEOP
295 /* Type of operation. */
297 /* Number of threads interested in this operation. */
298 ULONG ReferenceCount
;
299 /* Event that will be set when the operation is completed. */
300 KEVENT CompletionEvent
;
301 /* Status of the operation once it is completed. */
303 /* TRUE if the operation was abandoned. */
305 /* The memory area to be affected by the operation. */
308 struct _MM_PAGEOP
* Next
;
309 struct _ETHREAD
* Thread
;
311 * These fields are used to identify the operation if it is against a
312 * virtual memory area.
317 * These fields are used to identify the operation if it is against a
320 PMM_SECTION_SEGMENT Segment
;
322 } MM_PAGEOP
, *PMM_PAGEOP
;
324 typedef struct _MM_MEMORY_CONSUMER
328 NTSTATUS (*Trim
)(ULONG Target
, ULONG Priority
, PULONG NrFreed
);
329 } MM_MEMORY_CONSUMER
, *PMM_MEMORY_CONSUMER
;
331 typedef struct _MM_REGION
336 LIST_ENTRY RegionListEntry
;
337 } MM_REGION
, *PMM_REGION
;
339 /* Entry describing free pool memory */
340 typedef struct _MMFREE_POOL_ENTRY
345 struct _MMFREE_POOL_ENTRY
*Owner
;
346 } MMFREE_POOL_ENTRY
, *PMMFREE_POOL_ENTRY
;
348 /* Paged pool information */
349 typedef struct _MM_PAGED_POOL_INFO
351 PRTL_BITMAP PagedPoolAllocationMap
;
352 PRTL_BITMAP EndOfPagedPoolBitmap
;
353 PMMPTE FirstPteForPagedPool
;
354 PMMPTE LastPteForPagedPool
;
355 PMMPTE NextPdeForPagedPoolExpansion
;
357 SIZE_T PagedPoolCommit
;
358 SIZE_T AllocatedPagedPool
;
359 } MM_PAGED_POOL_INFO
, *PMM_PAGED_POOL_INFO
;
361 extern MM_MEMORY_CONSUMER MiMemoryConsumers
[MC_MAXIMUM
];
364 (*PMM_ALTER_REGION_FUNC
)(
365 PMM_AVL_TABLE AddressSpace
,
375 (*PMM_FREE_PAGE_FUNC
)(
377 PMEMORY_AREA MemoryArea
,
384 /* marea.c *******************************************************************/
388 MmInitMemoryAreas(VOID
);
393 PMM_AVL_TABLE AddressSpace
,
398 PMEMORY_AREA
*Result
,
399 BOOLEAN FixedAddress
,
400 ULONG AllocationFlags
,
401 PHYSICAL_ADDRESS BoundaryAddressMultiple OPTIONAL
406 MmLocateMemoryAreaByAddress(
407 PMM_AVL_TABLE AddressSpace
,
414 PMM_AVL_TABLE AddressSpace
,
421 PMM_AVL_TABLE AddressSpace
,
422 PMEMORY_AREA MemoryArea
,
423 PMM_FREE_PAGE_FUNC FreePage
,
424 PVOID FreePageContext
429 MmFreeMemoryAreaByPtr(
430 PMM_AVL_TABLE AddressSpace
,
432 PMM_FREE_PAGE_FUNC FreePage
,
433 PVOID FreePageContext
438 MmDumpMemoryAreas(PMM_AVL_TABLE AddressSpace
);
442 MmLocateMemoryAreaByRegion(
443 PMM_AVL_TABLE AddressSpace
,
451 PMM_AVL_TABLE AddressSpace
,
453 ULONG_PTR Granularity
,
459 MmReleaseMemoryAreaIfDecommitted(
460 struct _EPROCESS
*Process
,
461 PMM_AVL_TABLE AddressSpace
,
467 MmMapMemoryArea(PVOID BaseAddress
,
472 /* npool.c *******************************************************************/
476 MiDebugDumpNonPagedPool(BOOLEAN NewOnly
);
480 MiDebugDumpNonPagedPoolStats(BOOLEAN NewOnly
);
484 MiInitializeNonPagedPool(VOID
);
489 IN POOL_TYPE PoolType
,
490 IN SIZE_T SizeInBytes
496 IN PVOID VirtualAddress
502 IN PVOID StartingAddress
512 /* pool.c *******************************************************************/
516 ExAllocateNonPagedPoolWithTag(
525 ExAllocatePagedPoolWithTag(
533 ExFreeNonPagedPool(PVOID block
);
537 ExFreePagedPool(IN PVOID Block
);
541 MmInitializePagedPool(VOID
);
545 MiAllocateSpecialPool(
546 IN POOL_TYPE PoolType
,
547 IN SIZE_T NumberOfBytes
,
555 IN POOL_TYPE PoolType
,
556 IN ULONG CurrentMaxQuota
,
557 OUT PULONG NewMaxQuota
560 /* mdl.c *********************************************************************/
569 /* mminit.c ******************************************************************/
573 MiShutdownMemoryManager(VOID
);
583 MmInitSystem(IN ULONG Phase
,
584 IN PLOADER_PARAMETER_BLOCK LoaderBlock
);
588 MiFreeInitMemory(VOID
);
592 MmInitializeMdlImplementation(VOID
);
594 /* pagefile.c ****************************************************************/
598 MmAllocSwapPage(VOID
);
602 MmDereserveSwapPages(ULONG Nr
);
606 MmFreeSwapPage(SWAPENTRY Entry
);
610 MmInitPagingFile(VOID
);
621 MmReserveSwapPages(ULONG Nr
);
634 ULONG BugCodeParameter1
,
635 ULONG BugCodeParameter2
,
636 ULONG BugCodeParameter3
,
637 ULONG BugCodeParameter4
,
638 struct _KTRAP_FRAME
* TrapFrame
643 MmIsAvailableSwapPage(VOID
);
647 MmShowOutOfSpaceMessagePagingFile(VOID
);
649 /* process.c ****************************************************************/
653 MmInitializeProcessAddressSpace(
654 IN PEPROCESS Process
,
655 IN PEPROCESS Clone OPTIONAL
,
656 IN PVOID Section OPTIONAL
,
658 IN POBJECT_NAME_INFORMATION
*AuditName OPTIONAL
663 MmCreatePeb(struct _EPROCESS
*Process
);
668 struct _EPROCESS
*Process
,
670 PINITIAL_TEB InitialTeb
676 struct _EPROCESS
*Process
,
682 MmCleanProcessAddressSpace(IN PEPROCESS Process
);
686 MmDeleteProcessAddressSpace(IN PEPROCESS Process
);
690 MmGetSessionLocaleId(VOID
);
694 MmSetMemoryPriorityProcess(
695 IN PEPROCESS Process
,
696 IN UCHAR MemoryPriority
699 /* i386/pfault.c *************************************************************/
711 /* mm.c **********************************************************************/
716 IN BOOLEAN StoreInstruction
,
718 IN KPROCESSOR_MODE Mode
,
719 IN PVOID TrapInformation
722 /* anonmem.c *****************************************************************/
726 MmNotPresentFaultVirtualMemory(
727 PMM_AVL_TABLE AddressSpace
,
728 MEMORY_AREA
* MemoryArea
,
735 MmPageOutVirtualMemory(
736 PMM_AVL_TABLE AddressSpace
,
737 PMEMORY_AREA MemoryArea
,
739 struct _MM_PAGEOP
* PageOp
745 PMEMORY_AREA MemoryArea
,
747 PMEMORY_BASIC_INFORMATION Info
,
754 struct _EPROCESS
* Process
,
755 PMEMORY_AREA MemoryArea
761 PMM_AVL_TABLE AddressSpace
,
762 PMEMORY_AREA MemoryArea
,
771 MmWritePageVirtualMemory(
772 PMM_AVL_TABLE AddressSpace
,
778 /* kmap.c ********************************************************************/
782 ExAllocatePage(VOID
);
786 ExUnmapPage(PVOID Addr
);
790 ExAllocatePageWithPhysPage(PFN_TYPE Page
);
801 MiZeroPage(PFN_TYPE Page
);
803 /* memsafe.s *****************************************************************/
807 MmSafeReadPtr(PVOID Source
);
809 /* pageop.c ******************************************************************/
813 MmReleasePageOp(PMM_PAGEOP PageOp
);
821 PMM_SECTION_SEGMENT Segment
,
833 PMM_SECTION_SEGMENT Segment
,
839 MmInitializePageOp(VOID
);
841 /* process.c *****************************************************************/
845 MmCreateKernelStack(BOOLEAN GuiStack
, UCHAR Node
);
849 MmDeleteKernelStack(PVOID Stack
,
852 /* balace.c ******************************************************************/
856 MmInitializeMemoryConsumer(
858 NTSTATUS (*Trim
)(ULONG Target
, ULONG Priority
, PULONG NrFreed
)
863 MmInitializeBalancer(
864 ULONG NrAvailablePages
,
870 MmReleasePageMemoryConsumer(
877 MmRequestPageMemoryConsumer(
880 PPFN_TYPE AllocatedPage
885 MiInitBalancerThread(VOID
);
889 MmRebalanceMemoryConsumers(VOID
);
891 /* rmap.c **************************************************************/
895 MmSetRmapListHeadPage(
897 struct _MM_RMAP_ENTRY
* ListHead
900 struct _MM_RMAP_ENTRY
*
902 MmGetRmapListHeadPage(PFN_TYPE Page
);
908 struct _EPROCESS
*Process
,
917 VOID (*DeleteMapping
)(PVOID Context
, struct _EPROCESS
*Process
, PVOID Address
)
924 struct _EPROCESS
*Process
,
930 MmInitializeRmapList(VOID
);
934 MmSetCleanAllRmaps(PFN_TYPE Page
);
938 MmSetDirtyAllRmaps(PFN_TYPE Page
);
942 MmIsDirtyPageRmap(PFN_TYPE Page
);
946 MmWritePagePhysicalAddress(PFN_TYPE Page
);
950 MmPageOutPhysicalAddress(PFN_TYPE Page
);
952 /* freelist.c **********************************************************/
954 #define ASSERT_PFN(x) ASSERT((x)->Flags.Type != 0)
958 MiGetPfnEntry(IN PFN_TYPE Pfn
)
961 extern PPHYSICAL_PAGE MmPageArray
;
962 extern ULONG MmPageArraySize
;
964 /* Mark MmPageArraySize as unreferenced, otherwise it will appear as an unused variable on a Release build */
965 UNREFERENCED_PARAMETER(MmPageArraySize
);
967 /* Make sure the PFN number is valid */
968 ASSERT(Pfn
<= MmPageArraySize
);
971 Page
= &MmPageArray
[Pfn
];
973 /* Make sure it's valid */
982 MmGetLRUNextUserPage(PFN_TYPE PreviousPage
);
986 MmGetLRUFirstUserPage(VOID
);
990 MmInsertLRULastUserPage(PFN_TYPE Page
);
994 MmRemoveLRUUserPage(PFN_TYPE Page
);
998 MmLockPage(PFN_TYPE Page
);
1002 MmLockPageUnsafe(PFN_TYPE Page
);
1006 MmUnlockPage(PFN_TYPE Page
);
1010 MmGetLockCountPage(PFN_TYPE Page
);
1015 MmAcquirePageListLock()
1017 KeAcquireQueuedSpinLock(LockQueuePfnLock
);
1023 MmReleasePageListLock(KIRQL oldIrql
)
1025 KeReleaseQueuedSpinLock(LockQueuePfnLock
, oldIrql
);
1030 MmInitializePageList(
1036 MmGetContinuousPages(
1037 ULONG NumberOfBytes
,
1038 PHYSICAL_ADDRESS LowestAcceptableAddress
,
1039 PHYSICAL_ADDRESS HighestAcceptableAddress
,
1040 PHYSICAL_ADDRESS BoundaryAddressMultiple
1045 MmZeroPageThreadMain(
1049 /* i386/page.c *********************************************************/
1053 MmCreateHyperspaceMapping(PFN_TYPE Page
);
1057 MmChangeHyperspaceMapping(
1064 MmDeleteHyperspaceMapping(PVOID Address
);
1068 MmCreateVirtualMappingForKernel(
1077 MmCommitPagedPoolAddress(
1084 MmCreateVirtualMapping(
1085 struct _EPROCESS
* Process
,
1094 MmCreateVirtualMappingUnsafe(
1095 struct _EPROCESS
* Process
,
1105 struct _EPROCESS
* Process
,
1111 struct _EPROCESS
* Process
,
1119 struct _EPROCESS
* Process
,
1125 MmInitGlobalKernelPageDirectory(VOID
);
1129 MmDisableVirtualMapping(
1130 struct _EPROCESS
*Process
,
1138 MmEnableVirtualMapping(
1139 struct _EPROCESS
*Process
,
1145 MmRawDeleteVirtualMapping(PVOID Address
);
1149 MmDeletePageFileMapping(
1150 struct _EPROCESS
*Process
,
1152 SWAPENTRY
* SwapEntry
1157 MmCreatePageFileMapping(
1158 struct _EPROCESS
*Process
,
1166 struct _EPROCESS
*Process
,
1172 MmTransferOwnershipPage(
1180 struct _EPROCESS
*Process
,
1188 SWAPENTRY SavedSwapEntry
1193 MmAllocPagesSpecifyRange(
1195 PHYSICAL_ADDRESS LowestAddress
,
1196 PHYSICAL_ADDRESS HighestAddress
,
1197 ULONG NumberOfPages
,
1203 MmDereferencePage(PFN_TYPE Page
);
1207 MmReferencePage(PFN_TYPE Page
);
1211 MmReferencePageUnsafe(PFN_TYPE Page
);
1215 MmIsAccessedAndResetAccessPage(
1216 struct _EPROCESS
*Process
,
1222 MmGetReferenceCountPage(PFN_TYPE Page
);
1226 MmIsPageInUse(PFN_TYPE Page
);
1236 MmGetFlagsPage(PFN_TYPE Page
);
1240 MmSetSavedSwapEntryPage(
1242 SWAPENTRY SavedSwapEntry
);
1246 MmGetSavedSwapEntryPage(PFN_TYPE Page
);
1251 struct _EPROCESS
*Process
,
1257 MmCreatePageTable(PVOID PAddress
);
1262 struct _EPROCESS
*Process
,
1269 struct _EPROCESS
*Process
,
1275 MmCreateProcessAddressSpace(
1278 IN PLARGE_INTEGER DirectoryTableBase
1283 MmInitializeHandBuiltProcess(
1284 IN PEPROCESS Process
,
1285 IN PLARGE_INTEGER DirectoryTableBase
1291 MmInitializeHandBuiltProcess2(
1292 IN PEPROCESS Process
1297 MmReleaseMmInfo(struct _EPROCESS
*Process
);
1301 Mmi386ReleaseMmInfo(struct _EPROCESS
*Process
);
1305 MmDeleteVirtualMapping(
1306 struct _EPROCESS
*Process
,
1316 struct _EPROCESS
*Process
,
1322 MmMarkPageMapped(PFN_TYPE Page
);
1326 MmMarkPageUnmapped(PFN_TYPE Page
);
1331 struct _EPROCESS
*Process
,
1338 MiInitPageDirectoryMap(VOID
);
1342 MiGetUserPageDirectoryCount(VOID
);
1344 /* wset.c ********************************************************************/
1353 /* region.c ************************************************************/
1358 PMM_AVL_TABLE AddressSpace
,
1360 PLIST_ENTRY RegionListHead
,
1365 PMM_ALTER_REGION_FUNC AlterFunc
1371 PLIST_ENTRY RegionListHead
,
1381 PLIST_ENTRY RegionListHead
,
1383 PVOID
* RegionBaseAddress
1386 /* section.c *****************************************************************/
1390 MmGetFileObjectForSection(
1391 IN PROS_SECTION_OBJECT Section
1395 MmGetFileNameForAddress(
1397 OUT PUNICODE_STRING ModuleName
1402 MmGetFileNameForSection(
1403 IN PROS_SECTION_OBJECT Section
,
1404 OUT POBJECT_NAME_INFORMATION
*ModuleName
1417 PMEMORY_AREA MemoryArea
,
1419 PMEMORY_BASIC_INFORMATION Info
,
1425 MmProtectSectionView(
1426 PMM_AVL_TABLE AddressSpace
,
1427 PMEMORY_AREA MemoryArea
,
1436 MmWritePageSectionView(
1437 PMM_AVL_TABLE AddressSpace
,
1445 MmInitSectionImplementation(VOID
);
1449 MmNotPresentFaultSectionView(
1450 PMM_AVL_TABLE AddressSpace
,
1451 MEMORY_AREA
* MemoryArea
,
1458 MmPageOutSectionView(
1459 PMM_AVL_TABLE AddressSpace
,
1460 PMEMORY_AREA MemoryArea
,
1462 struct _MM_PAGEOP
*PageOp
1467 MmCreatePhysicalMemorySection(VOID
);
1471 MmAccessFaultSectionView(
1472 PMM_AVL_TABLE AddressSpace
,
1473 MEMORY_AREA
* MemoryArea
,
1480 MmFreeSectionSegments(PFILE_OBJECT FileObject
);
1482 /* mpw.c *********************************************************************/
1486 MmInitMpwThread(VOID
);
1490 MmInitBsmThread(VOID
);
1492 /* pager.c *******************************************************************/
1496 MiIsPagerThread(VOID
);
1500 MiStartPagerThread(VOID
);
1504 MiStopPagerThread(VOID
);
1508 MiQueryVirtualMemory(
1509 IN HANDLE ProcessHandle
,
1511 IN MEMORY_INFORMATION_CLASS VirtualMemoryInformationClass
,
1512 OUT PVOID VirtualMemoryInformation
,
1514 OUT PULONG ResultLength
1517 /* sysldr.c ******************************************************************/
1521 MiReloadBootLoadedDrivers(
1522 IN PLOADER_PARAMETER_BLOCK LoaderBlock
1527 MiInitializeLoadedModuleList(
1528 IN PLOADER_PARAMETER_BLOCK LoaderBlock
1534 IN PUNICODE_STRING FileName
,
1535 IN PUNICODE_STRING NamePrefix OPTIONAL
,
1536 IN PUNICODE_STRING LoadedName OPTIONAL
,
1538 OUT PVOID
*ModuleObject
,
1539 OUT PVOID
*ImageBaseAddress
1544 MmUnloadSystemImage(
1545 IN PVOID ImageHandle
1551 IN HANDLE ImageHandle
,
1552 IN BOOLEAN PurgeSection
1558 MiSyncThreadProcessViews(IN PVOID Process
,
1562 MmUpdatePageDir((PEPROCESS
)Process
, Address
, Size
);
1566 extern PMM_AVL_TABLE MmKernelAddressSpace
;
1570 MmLockAddressSpace(PMM_AVL_TABLE AddressSpace
)
1572 KeAcquireGuardedMutex(&CONTAINING_RECORD(AddressSpace
, EPROCESS
, VadRoot
)->AddressCreationLock
);
1577 MmUnlockAddressSpace(PMM_AVL_TABLE AddressSpace
)
1579 KeReleaseGuardedMutex(&CONTAINING_RECORD(AddressSpace
, EPROCESS
, VadRoot
)->AddressCreationLock
);
1584 MmGetAddressSpaceOwner(IN PMM_AVL_TABLE AddressSpace
)
1586 if (AddressSpace
== MmKernelAddressSpace
) return NULL
;
1587 return CONTAINING_RECORD(AddressSpace
, EPROCESS
, VadRoot
);
1592 MmGetCurrentAddressSpace(VOID
)
1594 return &((PEPROCESS
)KeGetCurrentThread()->ApcState
.Process
)->VadRoot
;
1599 MmGetKernelAddressSpace(VOID
)
1601 return MmKernelAddressSpace
;