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
;
253 typedef struct _MADDRESS_SPACE
255 PMEMORY_AREA MemoryAreaRoot
;
258 PUSHORT PageTableRefCountTable
;
260 } MADDRESS_SPACE
, *PMADDRESS_SPACE
;
270 ULONG PagingRequestsInLastMinute
;
271 ULONG PagingRequestsInLastFiveMinutes
;
272 ULONG PagingRequestsInLastFifteenMinutes
;
275 typedef struct _PHYSICAL_PAGE
284 ULONG StartOfAllocation
: 1;
285 ULONG EndOfAllocation
: 1;
291 LIST_ENTRY ListEntry
;
292 ULONG ReferenceCount
;
293 SWAPENTRY SavedSwapEntry
;
296 struct _MM_RMAP_ENTRY
* RmapListHead
;
298 PHYSICAL_PAGE
, *PPHYSICAL_PAGE
;
300 extern MM_STATS MmStats
;
302 typedef struct _MM_PAGEOP
304 /* Type of operation. */
306 /* Number of threads interested in this operation. */
307 ULONG ReferenceCount
;
308 /* Event that will be set when the operation is completed. */
309 KEVENT CompletionEvent
;
310 /* Status of the operation once it is completed. */
312 /* TRUE if the operation was abandoned. */
314 /* The memory area to be affected by the operation. */
317 struct _MM_PAGEOP
* Next
;
318 struct _ETHREAD
* Thread
;
320 * These fields are used to identify the operation if it is against a
321 * virtual memory area.
326 * These fields are used to identify the operation if it is against a
329 PMM_SECTION_SEGMENT Segment
;
331 } MM_PAGEOP
, *PMM_PAGEOP
;
333 typedef struct _MM_MEMORY_CONSUMER
337 NTSTATUS (*Trim
)(ULONG Target
, ULONG Priority
, PULONG NrFreed
);
338 } MM_MEMORY_CONSUMER
, *PMM_MEMORY_CONSUMER
;
340 typedef struct _MM_REGION
345 LIST_ENTRY RegionListEntry
;
346 } MM_REGION
, *PMM_REGION
;
348 /* Entry describing free pool memory */
349 typedef struct _MMFREE_POOL_ENTRY
354 struct _MMFREE_POOL_ENTRY
*Owner
;
355 } MMFREE_POOL_ENTRY
, *PMMFREE_POOL_ENTRY
;
357 /* Paged pool information */
358 typedef struct _MM_PAGED_POOL_INFO
360 PRTL_BITMAP PagedPoolAllocationMap
;
361 PRTL_BITMAP EndOfPagedPoolBitmap
;
362 PMMPTE FirstPteForPagedPool
;
363 PMMPTE LastPteForPagedPool
;
364 PMMPTE NextPdeForPagedPoolExpansion
;
366 SIZE_T PagedPoolCommit
;
367 SIZE_T AllocatedPagedPool
;
368 } MM_PAGED_POOL_INFO
, *PMM_PAGED_POOL_INFO
;
370 extern MM_MEMORY_CONSUMER MiMemoryConsumers
[MC_MAXIMUM
];
373 (*PMM_ALTER_REGION_FUNC
)(
374 PMADDRESS_SPACE AddressSpace
,
384 (*PMM_FREE_PAGE_FUNC
)(
386 PMEMORY_AREA MemoryArea
,
393 /* aspace.c ******************************************************************/
397 MmInitializeKernelAddressSpace(VOID
);
401 MmInitializeAddressSpace(
402 struct _EPROCESS
* Process
,
403 PMADDRESS_SPACE AddressSpace
);
407 MmDestroyAddressSpace(PMADDRESS_SPACE AddressSpace
);
409 /* marea.c *******************************************************************/
413 MmInitMemoryAreas(VOID
);
418 PMADDRESS_SPACE AddressSpace
,
423 PMEMORY_AREA
*Result
,
424 BOOLEAN FixedAddress
,
425 ULONG AllocationFlags
,
426 PHYSICAL_ADDRESS BoundaryAddressMultiple OPTIONAL
431 MmLocateMemoryAreaByAddress(
432 PMADDRESS_SPACE AddressSpace
,
439 PMADDRESS_SPACE AddressSpace
,
446 PMADDRESS_SPACE AddressSpace
,
447 PMEMORY_AREA MemoryArea
,
448 PMM_FREE_PAGE_FUNC FreePage
,
449 PVOID FreePageContext
454 MmFreeMemoryAreaByPtr(
455 PMADDRESS_SPACE AddressSpace
,
457 PMM_FREE_PAGE_FUNC FreePage
,
458 PVOID FreePageContext
463 MmDumpMemoryAreas(PMADDRESS_SPACE AddressSpace
);
467 MmLocateMemoryAreaByRegion(
468 PMADDRESS_SPACE AddressSpace
,
476 PMADDRESS_SPACE AddressSpace
,
478 ULONG_PTR Granularity
,
484 MmReleaseMemoryAreaIfDecommitted(
485 struct _EPROCESS
*Process
,
486 PMADDRESS_SPACE AddressSpace
,
492 MmMapMemoryArea(PVOID BaseAddress
,
497 /* npool.c *******************************************************************/
501 MiDebugDumpNonPagedPool(BOOLEAN NewOnly
);
505 MiDebugDumpNonPagedPoolStats(BOOLEAN NewOnly
);
509 MiInitializeNonPagedPool(VOID
);
514 IN POOL_TYPE PoolType
,
515 IN SIZE_T SizeInBytes
521 IN PVOID VirtualAddress
527 IN PVOID StartingAddress
537 /* pool.c *******************************************************************/
541 ExAllocateNonPagedPoolWithTag(
550 ExAllocatePagedPoolWithTag(
558 ExFreeNonPagedPool(PVOID block
);
562 ExFreePagedPool(IN PVOID Block
);
566 MmInitializePagedPool(VOID
);
570 MiAllocateSpecialPool(
571 IN POOL_TYPE PoolType
,
572 IN SIZE_T NumberOfBytes
,
580 IN POOL_TYPE PoolType
,
581 IN ULONG CurrentMaxQuota
,
582 OUT PULONG NewMaxQuota
585 /* mdl.c *********************************************************************/
594 /* mminit.c ******************************************************************/
598 MiShutdownMemoryManager(VOID
);
608 MmInitSystem(IN ULONG Phase
,
609 IN PLOADER_PARAMETER_BLOCK LoaderBlock
);
613 MiFreeInitMemory(VOID
);
617 MmInitializeMdlImplementation(VOID
);
619 /* pagefile.c ****************************************************************/
623 MmAllocSwapPage(VOID
);
627 MmDereserveSwapPages(ULONG Nr
);
631 MmFreeSwapPage(SWAPENTRY Entry
);
635 MmInitPagingFile(VOID
);
646 MmReserveSwapPages(ULONG Nr
);
659 ULONG BugCodeParameter1
,
660 ULONG BugCodeParameter2
,
661 ULONG BugCodeParameter3
,
662 ULONG BugCodeParameter4
,
663 struct _KTRAP_FRAME
* TrapFrame
668 MmIsAvailableSwapPage(VOID
);
672 MmShowOutOfSpaceMessagePagingFile(VOID
);
674 /* process.c ****************************************************************/
678 MmInitializeProcessAddressSpace(
679 IN PEPROCESS Process
,
680 IN PEPROCESS Clone OPTIONAL
,
681 IN PVOID Section OPTIONAL
,
683 IN POBJECT_NAME_INFORMATION
*AuditName OPTIONAL
688 MmCreatePeb(struct _EPROCESS
*Process
);
693 struct _EPROCESS
*Process
,
695 PINITIAL_TEB InitialTeb
701 struct _EPROCESS
*Process
,
707 MmCleanProcessAddressSpace(IN PEPROCESS Process
);
711 MmDeleteProcessAddressSpace(IN PEPROCESS Process
);
715 MmGetSessionLocaleId(VOID
);
719 MmSetMemoryPriorityProcess(
720 IN PEPROCESS Process
,
721 IN UCHAR MemoryPriority
724 /* i386/pfault.c *************************************************************/
736 /* mm.c **********************************************************************/
741 IN BOOLEAN StoreInstruction
,
743 IN KPROCESSOR_MODE Mode
,
744 IN PVOID TrapInformation
747 /* anonmem.c *****************************************************************/
751 MmNotPresentFaultVirtualMemory(
752 PMADDRESS_SPACE AddressSpace
,
753 MEMORY_AREA
* MemoryArea
,
760 MmPageOutVirtualMemory(
761 PMADDRESS_SPACE AddressSpace
,
762 PMEMORY_AREA MemoryArea
,
764 struct _MM_PAGEOP
* PageOp
770 PMEMORY_AREA MemoryArea
,
772 PMEMORY_BASIC_INFORMATION Info
,
779 struct _EPROCESS
* Process
,
780 PMEMORY_AREA MemoryArea
786 PMADDRESS_SPACE AddressSpace
,
787 PMEMORY_AREA MemoryArea
,
796 MmWritePageVirtualMemory(
797 PMADDRESS_SPACE AddressSpace
,
803 /* kmap.c ********************************************************************/
807 ExAllocatePage(VOID
);
811 ExUnmapPage(PVOID Addr
);
815 ExAllocatePageWithPhysPage(PFN_TYPE Page
);
826 MiZeroPage(PFN_TYPE Page
);
828 /* memsafe.s *****************************************************************/
832 MmSafeReadPtr(PVOID Source
);
834 /* pageop.c ******************************************************************/
838 MmReleasePageOp(PMM_PAGEOP PageOp
);
846 PMM_SECTION_SEGMENT Segment
,
858 PMM_SECTION_SEGMENT Segment
,
864 MmInitializePageOp(VOID
);
866 /* process.c *****************************************************************/
870 MmCreateKernelStack(BOOLEAN GuiStack
, UCHAR Node
);
874 MmDeleteKernelStack(PVOID Stack
,
877 /* balace.c ******************************************************************/
881 MmInitializeMemoryConsumer(
883 NTSTATUS (*Trim
)(ULONG Target
, ULONG Priority
, PULONG NrFreed
)
888 MmInitializeBalancer(
889 ULONG NrAvailablePages
,
895 MmReleasePageMemoryConsumer(
902 MmRequestPageMemoryConsumer(
905 PPFN_TYPE AllocatedPage
910 MiInitBalancerThread(VOID
);
914 MmRebalanceMemoryConsumers(VOID
);
916 /* rmap.c **************************************************************/
920 MmSetRmapListHeadPage(
922 struct _MM_RMAP_ENTRY
* ListHead
925 struct _MM_RMAP_ENTRY
*
927 MmGetRmapListHeadPage(PFN_TYPE Page
);
933 struct _EPROCESS
*Process
,
942 VOID (*DeleteMapping
)(PVOID Context
, struct _EPROCESS
*Process
, PVOID Address
)
949 struct _EPROCESS
*Process
,
955 MmInitializeRmapList(VOID
);
959 MmSetCleanAllRmaps(PFN_TYPE Page
);
963 MmSetDirtyAllRmaps(PFN_TYPE Page
);
967 MmIsDirtyPageRmap(PFN_TYPE Page
);
971 MmWritePagePhysicalAddress(PFN_TYPE Page
);
975 MmPageOutPhysicalAddress(PFN_TYPE Page
);
977 /* freelist.c **********************************************************/
979 #define ASSERT_PFN(x) ASSERT((x)->Flags.Type != 0)
983 MiGetPfnEntry(IN PFN_TYPE Pfn
)
986 extern PPHYSICAL_PAGE MmPageArray
;
987 extern ULONG MmPageArraySize
;
989 /* Make sure the PFN number is valid */
990 ASSERT(Pfn
<= MmPageArraySize
);
993 Page
= &MmPageArray
[Pfn
];
995 /* Make sure it's valid */
1004 MmGetLRUNextUserPage(PFN_TYPE PreviousPage
);
1008 MmGetLRUFirstUserPage(VOID
);
1012 MmInsertLRULastUserPage(PFN_TYPE Page
);
1016 MmRemoveLRUUserPage(PFN_TYPE Page
);
1020 MmLockPage(PFN_TYPE Page
);
1024 MmLockPageUnsafe(PFN_TYPE Page
);
1028 MmUnlockPage(PFN_TYPE Page
);
1032 MmGetLockCountPage(PFN_TYPE Page
);
1036 MmInitializePageList(
1042 MmGetContinuousPages(
1043 ULONG NumberOfBytes
,
1044 PHYSICAL_ADDRESS LowestAcceptableAddress
,
1045 PHYSICAL_ADDRESS HighestAcceptableAddress
,
1046 PHYSICAL_ADDRESS BoundaryAddressMultiple
1051 MmZeroPageThreadMain(
1055 /* i386/page.c *********************************************************/
1059 MmCreateHyperspaceMapping(PFN_TYPE Page
);
1063 MmChangeHyperspaceMapping(
1070 MmDeleteHyperspaceMapping(PVOID Address
);
1074 MmCreateVirtualMappingForKernel(
1083 MmCommitPagedPoolAddress(
1090 MmCreateVirtualMapping(
1091 struct _EPROCESS
* Process
,
1100 MmCreateVirtualMappingUnsafe(
1101 struct _EPROCESS
* Process
,
1111 struct _EPROCESS
* Process
,
1117 struct _EPROCESS
* Process
,
1125 struct _EPROCESS
* Process
,
1131 MmInitGlobalKernelPageDirectory(VOID
);
1135 MmDisableVirtualMapping(
1136 struct _EPROCESS
*Process
,
1144 MmEnableVirtualMapping(
1145 struct _EPROCESS
*Process
,
1151 MmRawDeleteVirtualMapping(PVOID Address
);
1155 MmDeletePageFileMapping(
1156 struct _EPROCESS
*Process
,
1158 SWAPENTRY
* SwapEntry
1163 MmCreatePageFileMapping(
1164 struct _EPROCESS
*Process
,
1172 struct _EPROCESS
*Process
,
1178 MmTransferOwnershipPage(
1186 struct _EPROCESS
*Process
,
1194 SWAPENTRY SavedSwapEntry
1199 MmAllocPagesSpecifyRange(
1201 PHYSICAL_ADDRESS LowestAddress
,
1202 PHYSICAL_ADDRESS HighestAddress
,
1203 ULONG NumberOfPages
,
1209 MmDereferencePage(PFN_TYPE Page
);
1213 MmReferencePage(PFN_TYPE Page
);
1217 MmReferencePageUnsafe(PFN_TYPE Page
);
1221 MmIsAccessedAndResetAccessPage(
1222 struct _EPROCESS
*Process
,
1228 MmGetReferenceCountPage(PFN_TYPE Page
);
1232 MmIsPageInUse(PFN_TYPE Page
);
1242 MmGetFlagsPage(PFN_TYPE Page
);
1246 MmSetSavedSwapEntryPage(
1248 SWAPENTRY SavedSwapEntry
);
1252 MmGetSavedSwapEntryPage(PFN_TYPE Page
);
1257 struct _EPROCESS
*Process
,
1263 MmCreatePageTable(PVOID PAddress
);
1268 struct _EPROCESS
*Process
,
1275 struct _EPROCESS
*Process
,
1281 MmCreateProcessAddressSpace(
1284 IN PLARGE_INTEGER DirectoryTableBase
1289 MmInitializeHandBuiltProcess(
1290 IN PEPROCESS Process
,
1291 IN PLARGE_INTEGER DirectoryTableBase
1297 MmInitializeHandBuiltProcess2(
1298 IN PEPROCESS Process
1303 MmReleaseMmInfo(struct _EPROCESS
*Process
);
1307 Mmi386ReleaseMmInfo(struct _EPROCESS
*Process
);
1311 MmDeleteVirtualMapping(
1312 struct _EPROCESS
*Process
,
1322 struct _EPROCESS
*Process
,
1328 MmMarkPageMapped(PFN_TYPE Page
);
1332 MmMarkPageUnmapped(PFN_TYPE Page
);
1337 struct _EPROCESS
*Process
,
1344 MiInitPageDirectoryMap(VOID
);
1348 MiGetUserPageDirectoryCount(VOID
);
1350 /* wset.c ********************************************************************/
1359 /* region.c ************************************************************/
1364 PMADDRESS_SPACE AddressSpace
,
1366 PLIST_ENTRY RegionListHead
,
1371 PMM_ALTER_REGION_FUNC AlterFunc
1377 PLIST_ENTRY RegionListHead
,
1387 PLIST_ENTRY RegionListHead
,
1389 PVOID
* RegionBaseAddress
1392 /* section.c *****************************************************************/
1396 MmGetFileObjectForSection(
1397 IN PROS_SECTION_OBJECT Section
1401 MmGetFileNameForAddress(
1403 OUT PUNICODE_STRING ModuleName
1408 MmGetFileNameForSection(
1409 IN PROS_SECTION_OBJECT Section
,
1410 OUT POBJECT_NAME_INFORMATION
*ModuleName
1423 PMEMORY_AREA MemoryArea
,
1425 PMEMORY_BASIC_INFORMATION Info
,
1431 MmProtectSectionView(
1432 PMADDRESS_SPACE AddressSpace
,
1433 PMEMORY_AREA MemoryArea
,
1442 MmWritePageSectionView(
1443 PMADDRESS_SPACE AddressSpace
,
1451 MmInitSectionImplementation(VOID
);
1455 MmNotPresentFaultSectionView(
1456 PMADDRESS_SPACE AddressSpace
,
1457 MEMORY_AREA
* MemoryArea
,
1464 MmPageOutSectionView(
1465 PMADDRESS_SPACE AddressSpace
,
1466 PMEMORY_AREA MemoryArea
,
1468 struct _MM_PAGEOP
*PageOp
1473 MmCreatePhysicalMemorySection(VOID
);
1477 MmAccessFaultSectionView(
1478 PMADDRESS_SPACE AddressSpace
,
1479 MEMORY_AREA
* MemoryArea
,
1486 MmFreeSectionSegments(PFILE_OBJECT FileObject
);
1488 /* mpw.c *********************************************************************/
1492 MmInitMpwThread(VOID
);
1496 MmInitBsmThread(VOID
);
1498 /* pager.c *******************************************************************/
1502 MiIsPagerThread(VOID
);
1506 MiStartPagerThread(VOID
);
1510 MiStopPagerThread(VOID
);
1514 MiQueryVirtualMemory(
1515 IN HANDLE ProcessHandle
,
1517 IN MEMORY_INFORMATION_CLASS VirtualMemoryInformationClass
,
1518 OUT PVOID VirtualMemoryInformation
,
1520 OUT PULONG ResultLength
1523 /* sysldr.c ******************************************************************/
1527 MiReloadBootLoadedDrivers(
1528 IN PLOADER_PARAMETER_BLOCK LoaderBlock
1533 MiInitializeLoadedModuleList(
1534 IN PLOADER_PARAMETER_BLOCK LoaderBlock
1540 IN PUNICODE_STRING FileName
,
1541 IN PUNICODE_STRING NamePrefix OPTIONAL
,
1542 IN PUNICODE_STRING LoadedName OPTIONAL
,
1544 OUT PVOID
*ModuleObject
,
1545 OUT PVOID
*ImageBaseAddress
1550 MmUnloadSystemImage(
1551 IN PVOID ImageHandle
1557 IN HANDLE ImageHandle
,
1558 IN BOOLEAN PurgeSection
1564 MiSyncThreadProcessViews(IN PVOID Process
,
1568 MmUpdatePageDir((PEPROCESS
)Process
, Address
, Size
);
1572 extern MADDRESS_SPACE MmKernelAddressSpace
;
1576 MmLockAddressSpace(PMADDRESS_SPACE AddressSpace
)
1578 KeEnterCriticalRegion();
1579 ExAcquirePushLockExclusive(AddressSpace
->Lock
);
1584 MmUnlockAddressSpace(PMADDRESS_SPACE AddressSpace
)
1586 ExReleasePushLock(AddressSpace
->Lock
);
1587 KeLeaveCriticalRegion();
1592 MmGetCurrentAddressSpace(VOID
)
1594 return (PMADDRESS_SPACE
)&((PEPROCESS
)KeGetCurrentThread()->ApcState
.Process
)->VadRoot
;
1599 MmGetKernelAddressSpace(VOID
)
1601 return &MmKernelAddressSpace
;