3 #include <internal/arch/mm.h>
5 /* TYPES *********************************************************************/
9 extern PMMSUPPORT MmKernelAddressSpace
;
10 extern PFN_COUNT MiFreeSwapPages
;
11 extern PFN_COUNT MiUsedSwapPages
;
12 extern PFN_COUNT MmNumberOfPhysicalPages
;
13 extern UCHAR MmDisablePagingExecutive
;
14 extern PFN_NUMBER MmLowestPhysicalPage
;
15 extern PFN_NUMBER MmHighestPhysicalPage
;
16 extern PFN_NUMBER MmAvailablePages
;
17 extern PFN_NUMBER MmResidentAvailablePages
;
19 extern LIST_ENTRY MmLoadedUserImageList
;
21 extern KMUTANT MmSystemLoadLock
;
23 extern ULONG MmNumberOfPagingFiles
;
25 extern PVOID MmUnloadedDrivers
;
26 extern PVOID MmLastUnloadedDrivers
;
27 extern PVOID MmTriageActionTaken
;
28 extern PVOID KernelVerifier
;
29 extern MM_DRIVER_VERIFIER_DATA MmVerifierData
;
31 extern SIZE_T MmTotalCommitLimit
;
32 extern SIZE_T MmTotalCommittedPages
;
33 extern SIZE_T MmSharedCommit
;
34 extern SIZE_T MmDriverCommit
;
35 extern SIZE_T MmProcessCommit
;
36 extern SIZE_T MmPagedPoolCommit
;
37 extern SIZE_T MmPeakCommitment
;
38 extern SIZE_T MmtotalCommitLimitMaximum
;
40 extern PVOID MiDebugMapping
; // internal
41 extern PMMPTE MmDebugPte
; // internal
45 struct _MM_RMAP_ENTRY
;
46 typedef ULONG_PTR SWAPENTRY
;
49 // MmDbgCopyMemory Flags
51 #define MMDBG_COPY_WRITE 0x00000001
52 #define MMDBG_COPY_PHYSICAL 0x00000002
53 #define MMDBG_COPY_UNSAFE 0x00000004
54 #define MMDBG_COPY_CACHED 0x00000008
55 #define MMDBG_COPY_UNCACHED 0x00000010
56 #define MMDBG_COPY_WRITE_COMBINED 0x00000020
59 // Maximum chunk size per copy
61 #define MMDBG_COPY_MAX_SIZE 0x8
63 #if defined(_X86_) // intenal for marea.c
64 #define MI_STATIC_MEMORY_AREAS (14)
66 #define MI_STATIC_MEMORY_AREAS (13)
69 #define MEMORY_AREA_SECTION_VIEW (1)
70 #define MEMORY_AREA_CACHE (2)
71 #define MEMORY_AREA_OWNED_BY_ARM3 (15)
72 #define MEMORY_AREA_STATIC (0x80000000)
74 /* Although Microsoft says this isn't hardcoded anymore,
75 they won't be able to change it. Stuff depends on it */
76 #define MM_VIRTMEM_GRANULARITY (64 * 1024)
78 #define STATUS_MM_RESTART_OPERATION ((NTSTATUS)0xD0000001)
81 * Additional flags for protection attributes
83 #define PAGE_WRITETHROUGH (1024)
84 #define PAGE_SYSTEM (2048)
86 #define SEC_PHYSICALMEMORY (0x80000000)
88 #define MM_PAGEFILE_SEGMENT (0x1)
89 #define MM_DATAFILE_SEGMENT (0x2)
94 #define MC_MAXIMUM (3)
96 #define PAGED_POOL_MASK 1
97 #define MUST_SUCCEED_POOL_MASK 2
98 #define CACHE_ALIGNED_POOL_MASK 4
99 #define QUOTA_POOL_MASK 8
100 #define SESSION_POOL_MASK 32
101 #define VERIFIER_POOL_MASK 64
103 // FIXME: use ALIGN_UP_BY
104 #define MM_ROUND_UP(x,s) \
105 ((PVOID)(((ULONG_PTR)(x)+(s)-1) & ~((ULONG_PTR)(s)-1)))
107 #define MM_ROUND_DOWN(x,s) \
108 ((PVOID)(((ULONG_PTR)(x)) & ~((ULONG_PTR)(s)-1)))
110 #define PAGE_FLAGS_VALID_FOR_SECTION \
115 PAGE_EXECUTE_READ | \
116 PAGE_EXECUTE_READWRITE | \
117 PAGE_EXECUTE_WRITECOPY | \
121 #define PAGE_IS_READABLE \
125 PAGE_EXECUTE_READ | \
126 PAGE_EXECUTE_READWRITE | \
127 PAGE_EXECUTE_WRITECOPY)
129 #define PAGE_IS_WRITABLE \
132 PAGE_EXECUTE_READWRITE | \
133 PAGE_EXECUTE_WRITECOPY)
135 #define PAGE_IS_EXECUTABLE \
137 PAGE_EXECUTE_READ | \
138 PAGE_EXECUTE_READWRITE | \
139 PAGE_EXECUTE_WRITECOPY)
141 #define PAGE_IS_WRITECOPY \
143 PAGE_EXECUTE_WRITECOPY)
146 // Wait entry for marking pages that are being serviced
148 #define MM_WAIT_ENTRY 0x7ffffc00
150 #define InterlockedCompareExchangePte(PointerPte, Exchange, Comperand) \
151 InterlockedCompareExchange((PLONG)(PointerPte), Exchange, Comperand)
153 #define InterlockedExchangePte(PointerPte, Value) \
154 InterlockedExchange((PLONG)(PointerPte), Value)
156 typedef struct _MM_SECTION_SEGMENT
158 FAST_MUTEX Lock
; /* lock which protects the page directory */
159 PFILE_OBJECT FileObject
;
160 LARGE_INTEGER RawLength
; /* length of the segment which is part of the mapped file */
161 LARGE_INTEGER Length
; /* absolute length of the segment */
162 ULONG ReferenceCount
;
171 ULONGLONG FileOffset
; /* start offset into the file for image sections */
172 ULONG_PTR VirtualAddress
; /* start offset into the address range for image sections */
173 ULONG Characteristics
;
176 LIST_ENTRY ListOfSegments
;
177 RTL_GENERIC_TABLE PageTable
;
178 } MM_SECTION_SEGMENT
, *PMM_SECTION_SEGMENT
;
180 typedef struct _MM_IMAGE_SECTION_OBJECT
182 SECTION_IMAGE_INFORMATION ImageInformation
;
185 PMM_SECTION_SEGMENT Segments
;
186 } MM_IMAGE_SECTION_OBJECT
, *PMM_IMAGE_SECTION_OBJECT
;
188 typedef struct _ROS_SECTION_OBJECT
192 LARGE_INTEGER MaximumSize
;
193 ULONG SectionPageProtection
;
194 ULONG AllocationAttributes
;
195 PFILE_OBJECT FileObject
;
198 PMM_IMAGE_SECTION_OBJECT ImageSection
;
199 PMM_SECTION_SEGMENT Segment
;
201 } ROS_SECTION_OBJECT
, *PROS_SECTION_OBJECT
;
203 #define MA_GetStartingAddress(_MemoryArea) ((_MemoryArea)->StartingVpn << PAGE_SHIFT)
204 #define MA_GetEndingAddress(_MemoryArea) (((_MemoryArea)->EndingVpn + 1) << PAGE_SHIFT)
206 typedef struct _MEMORY_AREA
209 ULONG_PTR StartingVpn
;
211 struct _MEMORY_AREA
*Parent
;
212 struct _MEMORY_AREA
*LeftChild
;
213 struct _MEMORY_AREA
*RightChild
;
217 BOOLEAN DeleteInProgress
;
224 ROS_SECTION_OBJECT
* Section
;
225 LARGE_INTEGER ViewOffset
;
226 PMM_SECTION_SEGMENT Segment
;
227 LIST_ENTRY RegionListHead
;
231 LIST_ENTRY RegionListHead
;
234 } MEMORY_AREA
, *PMEMORY_AREA
;
236 typedef struct _MM_RMAP_ENTRY
238 struct _MM_RMAP_ENTRY
* Next
;
245 MM_RMAP_ENTRY
, *PMM_RMAP_ENTRY
;
248 extern ULONG MI_PFN_CURRENT_USAGE
;
249 extern CHAR MI_PFN_CURRENT_PROCESS_NAME
[16];
250 #define MI_SET_USAGE(x) MI_PFN_CURRENT_USAGE = x
251 #define MI_SET_PROCESS2(x) memcpy(MI_PFN_CURRENT_PROCESS_NAME, x, 16)
253 #define MI_SET_USAGE(x)
254 #define MI_SET_PROCESS2(x)
257 typedef enum _MI_PFN_USAGES
259 MI_USAGE_NOT_SET
= 0,
261 MI_USAGE_NONPAGED_POOL
,
262 MI_USAGE_NONPAGED_POOL_EXPANSION
,
263 MI_USAGE_KERNEL_STACK
,
264 MI_USAGE_KERNEL_STACK_EXPANSION
,
270 MI_USAGE_PAGE_DIRECTORY
,
271 MI_USAGE_LEGACY_PAGE_DIRECTORY
,
272 MI_USAGE_DRIVER_PAGE
,
273 MI_USAGE_CONTINOUS_ALLOCATION
,
275 MI_USAGE_DEMAND_ZERO
,
278 MI_USAGE_PFN_DATABASE
,
279 MI_USAGE_BOOT_DRIVER
,
280 MI_USAGE_INIT_MEMORY
,
285 // These two mappings are actually used by Windows itself, based on the ASSERTS
287 #define StartOfAllocation ReadInProgress
288 #define EndOfAllocation WriteInProgress
290 typedef struct _MMPFNENTRY
293 USHORT ReadInProgress
:1; // StartOfAllocation
294 USHORT WriteInProgress
:1; // EndOfAllocation
295 USHORT PrototypePte
:1;
297 USHORT PageLocation
:3;
298 USHORT RemovalRequested
:1;
299 USHORT CacheAttribute
:2;
301 USHORT ParityError
:1;
305 typedef struct _MMPFN
313 SINGLE_LIST_ENTRY NextStackPfn
;
322 ULONG_PTR ShareCount
;
328 USHORT ReferenceCount
;
333 USHORT ReferenceCount
;
340 LONG AweReferenceCount
;
343 PMM_RMAP_ENTRY RmapListHead
;
347 ULONG_PTR EntireFrame
;
350 ULONG_PTR PteFrame
:25;
351 ULONG_PTR InPageError
:1;
352 ULONG_PTR VerifierAllocation
:1;
353 ULONG_PTR AweAllocation
:1;
354 ULONG_PTR Priority
:3;
355 ULONG_PTR MustBeCached
:1;
359 MI_PFN_USAGES PfnUsage
;
360 CHAR ProcessName
[16];
363 // HACK until WS lists are supported
367 extern PMMPFN MmPfnDatabase
;
369 typedef struct _MMPFNLIST
375 } MMPFNLIST
, *PMMPFNLIST
;
377 extern MMPFNLIST MmZeroedPageListHead
;
378 extern MMPFNLIST MmFreePageListHead
;
379 extern MMPFNLIST MmStandbyPageListHead
;
380 extern MMPFNLIST MmModifiedPageListHead
;
381 extern MMPFNLIST MmModifiedNoWritePageListHead
;
383 typedef struct _MM_MEMORY_CONSUMER
387 NTSTATUS (*Trim
)(ULONG Target
, ULONG Priority
, PULONG NrFreed
);
388 } MM_MEMORY_CONSUMER
, *PMM_MEMORY_CONSUMER
;
390 typedef struct _MM_REGION
395 LIST_ENTRY RegionListEntry
;
396 } MM_REGION
, *PMM_REGION
;
399 /* Entry describing free pool memory */
400 typedef struct _MMFREE_POOL_ENTRY
405 struct _MMFREE_POOL_ENTRY
*Owner
;
406 } MMFREE_POOL_ENTRY
, *PMMFREE_POOL_ENTRY
;
408 /* Signature of a freed block */
409 #define MM_FREE_POOL_SIGNATURE 'ARM3'
411 /* Paged pool information */
412 typedef struct _MM_PAGED_POOL_INFO
414 PRTL_BITMAP PagedPoolAllocationMap
;
415 PRTL_BITMAP EndOfPagedPoolBitmap
;
416 PMMPTE FirstPteForPagedPool
;
417 PMMPTE LastPteForPagedPool
;
418 PMMPDE NextPdeForPagedPoolExpansion
;
420 SIZE_T PagedPoolCommit
;
421 SIZE_T AllocatedPagedPool
;
422 } MM_PAGED_POOL_INFO
, *PMM_PAGED_POOL_INFO
;
424 extern MM_MEMORY_CONSUMER MiMemoryConsumers
[MC_MAXIMUM
];
427 (*PMM_ALTER_REGION_FUNC
)(
428 PMMSUPPORT AddressSpace
,
438 (*PMM_FREE_PAGE_FUNC
)(
440 PMEMORY_AREA MemoryArea
,
448 // Mm copy support for Kd
460 // Determines if a given address is a session address
480 /* marea.c *******************************************************************/
485 PMMSUPPORT AddressSpace
,
490 PMEMORY_AREA
*Result
,
491 ULONG AllocationFlags
,
492 ULONG AllocationGranularity
497 MmLocateMemoryAreaByAddress(
498 PMMSUPPORT AddressSpace
,
505 PMMSUPPORT AddressSpace
,
506 PMEMORY_AREA MemoryArea
,
507 PMM_FREE_PAGE_FUNC FreePage
,
508 PVOID FreePageContext
513 MiRosCleanupMemoryArea(
519 MmFreeMemoryAreaByPtr(
520 PMMSUPPORT AddressSpace
,
522 PMM_FREE_PAGE_FUNC FreePage
,
523 PVOID FreePageContext
528 MmLocateMemoryAreaByRegion(
529 PMMSUPPORT AddressSpace
,
537 PMMSUPPORT AddressSpace
,
539 ULONG_PTR Granularity
,
545 MiRosCheckMemoryAreas(
546 PMMSUPPORT AddressSpace
);
550 MiCheckAllProcessMemoryAreas(VOID
);
552 /* npool.c *******************************************************************/
556 MiInitializeNonPagedPool(VOID
);
561 IN POOL_TYPE PoolType
,
562 IN SIZE_T SizeInBytes
568 IN PVOID VirtualAddress
574 IN PVOID StartingAddress
577 /* pool.c *******************************************************************/
582 IN POOL_TYPE PoolType
,
583 IN ULONG CurrentMaxQuota
,
584 OUT PULONG NewMaxQuota
587 /* mdl.c *********************************************************************/
596 /* mminit.c ******************************************************************/
606 MmInitSystem(IN ULONG Phase
,
607 IN PLOADER_PARAMETER_BLOCK LoaderBlock
);
610 /* pagefile.c ****************************************************************/
614 MmAllocSwapPage(VOID
);
618 MmFreeSwapPage(SWAPENTRY Entry
);
622 MmInitPagingFile(VOID
);
626 MmIsFileObjectAPagingFile(PFILE_OBJECT FileObject
);
644 MmShowOutOfSpaceMessagePagingFile(VOID
);
649 _In_ PFN_NUMBER Page
,
650 _In_ ULONG PageFileIndex
,
651 _In_ ULONG_PTR PageFileOffset
);
653 /* process.c ****************************************************************/
657 MmInitializeProcessAddressSpace(
658 IN PEPROCESS Process
,
659 IN PEPROCESS Clone OPTIONAL
,
660 IN PVOID Section OPTIONAL
,
662 IN POBJECT_NAME_INFORMATION
*AuditName OPTIONAL
668 IN PEPROCESS Process
,
669 IN PINITIAL_PEB InitialPeb
,
676 IN PEPROCESS Process
,
677 IN PCLIENT_ID ClientId
,
678 IN PINITIAL_TEB InitialTeb
,
685 struct _EPROCESS
*Process
,
691 MmCleanProcessAddressSpace(IN PEPROCESS Process
);
695 MmDeleteProcessAddressSpace(IN PEPROCESS Process
);
699 MmGetSessionLocaleId(VOID
);
703 MmSetMemoryPriorityProcess(
704 IN PEPROCESS Process
,
705 IN UCHAR MemoryPriority
708 /* i386/pfault.c *************************************************************/
720 /* special.c *****************************************************************/
724 MiInitializeSpecialPool(VOID
);
729 IN SIZE_T NumberOfBytes
,
734 MmIsSpecialPoolAddress(
739 MmIsSpecialPoolAddressFree(
744 MmAllocateSpecialPool(
745 IN SIZE_T NumberOfBytes
,
747 IN POOL_TYPE PoolType
,
748 IN ULONG SpecialType
);
755 /* mm.c **********************************************************************/
760 IN BOOLEAN StoreInstruction
,
762 IN KPROCESSOR_MODE Mode
,
763 IN PVOID TrapInformation
766 /* kmap.c ********************************************************************/
775 /* process.c *****************************************************************/
779 MmCreateKernelStack(BOOLEAN GuiStack
, UCHAR Node
);
783 MmDeleteKernelStack(PVOID Stack
,
786 /* balace.c ******************************************************************/
790 MmInitializeMemoryConsumer(
792 NTSTATUS (*Trim
)(ULONG Target
, ULONG Priority
, PULONG NrFreed
)
797 MmInitializeBalancer(
798 ULONG NrAvailablePages
,
804 MmReleasePageMemoryConsumer(
811 MmRequestPageMemoryConsumer(
814 PPFN_NUMBER AllocatedPage
819 MiInitBalancerThread(VOID
);
823 MmRebalanceMemoryConsumers(VOID
);
825 /* rmap.c **************************************************************/
829 MmSetRmapListHeadPage(
831 struct _MM_RMAP_ENTRY
* ListHead
834 struct _MM_RMAP_ENTRY
*
836 MmGetRmapListHeadPage(PFN_NUMBER Page
);
842 struct _EPROCESS
*Process
,
851 VOID (*DeleteMapping
)(PVOID Context
, struct _EPROCESS
*Process
, PVOID Address
)
858 struct _EPROCESS
*Process
,
864 MmInitializeRmapList(VOID
);
868 MmSetCleanAllRmaps(PFN_NUMBER Page
);
872 MmSetDirtyAllRmaps(PFN_NUMBER Page
);
876 MmIsDirtyPageRmap(PFN_NUMBER Page
);
880 MmPageOutPhysicalAddress(PFN_NUMBER Page
);
882 /* freelist.c **********************************************************/
886 MiGetPfnEntry(IN PFN_NUMBER Pfn
)
889 extern RTL_BITMAP MiPfnBitMap
;
891 /* Make sure the PFN number is valid */
892 if (Pfn
> MmHighestPhysicalPage
) return NULL
;
894 /* Make sure this page actually has a PFN entry */
895 if ((MiPfnBitMap
.Buffer
) && !(RtlTestBit(&MiPfnBitMap
, (ULONG
)Pfn
))) return NULL
;
898 Page
= &MmPfnDatabase
[Pfn
];
906 MiGetPfnEntryIndex(IN PMMPFN Pfn1
)
909 // This will return the Page Frame Number (PFN) from the MMPFN
911 return Pfn1
- MmPfnDatabase
;
916 MmGetLRUNextUserPage(PFN_NUMBER PreviousPage
);
920 MmGetLRUFirstUserPage(VOID
);
924 MmInsertLRULastUserPage(PFN_NUMBER Page
);
928 MmRemoveLRUUserPage(PFN_NUMBER Page
);
932 MmDumpArmPfnDatabase(
933 IN BOOLEAN StatusOnly
942 /* hypermap.c *****************************************************************/
944 extern PEPROCESS HyperProcess
;
945 extern KIRQL HyperIrql
;
949 MiMapPageInHyperSpace(IN PEPROCESS Process
,
955 MiUnmapPageInHyperSpace(IN PEPROCESS Process
,
961 MiMapPagesInZeroSpace(IN PMMPFN Pfn1
,
962 IN PFN_NUMBER NumberOfPages
);
966 MiUnmapPagesInZeroSpace(IN PVOID VirtualAddress
,
967 IN PFN_NUMBER NumberOfPages
);
970 // ReactOS Compatibility Layer
974 MmCreateHyperspaceMapping(IN PFN_NUMBER Page
)
976 HyperProcess
= (PEPROCESS
)KeGetCurrentThread()->ApcState
.Process
;
977 return MiMapPageInHyperSpace(HyperProcess
, Page
, &HyperIrql
);
980 #define MmDeleteHyperspaceMapping(x) MiUnmapPageInHyperSpace(HyperProcess, x, HyperIrql);
982 /* i386/page.c *********************************************************/
986 MmCreateVirtualMapping(
987 struct _EPROCESS
* Process
,
996 MmCreateVirtualMappingUnsafe(
997 struct _EPROCESS
* Process
,
1007 struct _EPROCESS
* Process
,
1013 struct _EPROCESS
* Process
,
1021 struct _EPROCESS
* Process
,
1028 struct _EPROCESS
* Process
,
1034 MmInitGlobalKernelPageDirectory(VOID
);
1038 MmGetPageFileMapping(
1039 struct _EPROCESS
*Process
,
1041 SWAPENTRY
* SwapEntry
);
1045 MmDeletePageFileMapping(
1046 struct _EPROCESS
*Process
,
1048 SWAPENTRY
* SwapEntry
1053 MmCreatePageFileMapping(
1054 struct _EPROCESS
*Process
,
1062 struct _EPROCESS
*Process
,
1069 struct _EPROCESS
*Process
,
1081 MmDereferencePage(PFN_NUMBER Page
);
1085 MmReferencePage(PFN_NUMBER Page
);
1089 MmGetReferenceCountPage(PFN_NUMBER Page
);
1093 MmIsPageInUse(PFN_NUMBER Page
);
1097 MmSetSavedSwapEntryPage(
1099 SWAPENTRY SavedSwapEntry
);
1103 MmGetSavedSwapEntryPage(PFN_NUMBER Page
);
1108 struct _EPROCESS
*Process
,
1115 struct _EPROCESS
*Process
,
1122 struct _EPROCESS
*Process
,
1128 MmCreateProcessAddressSpace(
1131 IN PULONG_PTR DirectoryTableBase
1136 MmInitializeHandBuiltProcess(
1137 IN PEPROCESS Process
,
1138 IN PULONG_PTR DirectoryTableBase
1144 MmInitializeHandBuiltProcess2(
1145 IN PEPROCESS Process
1150 MmSetExecuteOptions(IN ULONG ExecuteOptions
);
1154 MmGetExecuteOptions(IN PULONG ExecuteOptions
);
1158 MmDeleteVirtualMapping(
1159 struct _EPROCESS
*Process
,
1168 struct _EPROCESS
*Process
,
1172 /* wset.c ********************************************************************/
1181 /* region.c ************************************************************/
1186 PMMSUPPORT AddressSpace
,
1188 PLIST_ENTRY RegionListHead
,
1193 PMM_ALTER_REGION_FUNC AlterFunc
1199 PLIST_ENTRY RegionListHead
,
1209 PLIST_ENTRY RegionListHead
,
1211 PVOID
* RegionBaseAddress
1214 /* section.c *****************************************************************/
1218 MmGetImageInformation(
1219 OUT PSECTION_IMAGE_INFORMATION ImageInformation
1224 MmGetFileObjectForSection(
1229 MmGetFileNameForAddress(
1231 OUT PUNICODE_STRING ModuleName
1236 MmGetFileNameForSection(
1238 OUT POBJECT_NAME_INFORMATION
*ModuleName
1244 PMEMORY_AREA MemoryArea
,
1246 PMEMORY_BASIC_INFORMATION Info
,
1247 PSIZE_T ResultLength
1252 MmProtectSectionView(
1253 PMMSUPPORT AddressSpace
,
1254 PMEMORY_AREA MemoryArea
,
1263 MmInitSectionImplementation(VOID
);
1267 MmNotPresentFaultSectionView(
1268 PMMSUPPORT AddressSpace
,
1269 MEMORY_AREA
* MemoryArea
,
1276 MmPageOutSectionView(
1277 PMMSUPPORT AddressSpace
,
1278 PMEMORY_AREA MemoryArea
,
1285 MmCreatePhysicalMemorySection(VOID
);
1289 MmAccessFaultSectionView(
1290 PMMSUPPORT AddressSpace
,
1291 MEMORY_AREA
* MemoryArea
,
1297 MmFreeSectionSegments(PFILE_OBJECT FileObject
);
1299 /* sysldr.c ******************************************************************/
1303 MiReloadBootLoadedDrivers(
1304 IN PLOADER_PARAMETER_BLOCK LoaderBlock
1309 MiInitializeLoadedModuleList(
1310 IN PLOADER_PARAMETER_BLOCK LoaderBlock
1316 IN PUNICODE_STRING FileName
,
1317 IN PUNICODE_STRING NamePrefix OPTIONAL
,
1318 IN PUNICODE_STRING LoadedName OPTIONAL
,
1320 OUT PVOID
*ModuleObject
,
1321 OUT PVOID
*ImageBaseAddress
1326 MmUnloadSystemImage(
1327 IN PVOID ImageHandle
1333 IN HANDLE ImageHandle
,
1334 IN BOOLEAN PurgeSection
1339 MmCallDllInitialize(
1340 IN PLDR_DATA_TABLE_ENTRY LdrEntry
,
1341 IN PLIST_ENTRY ListHead
1345 /* procsup.c *****************************************************************/
1350 IN PVOID StackPointer
1356 MmLockAddressSpace(PMMSUPPORT AddressSpace
)
1358 KeAcquireGuardedMutex(&CONTAINING_RECORD(AddressSpace
, EPROCESS
, Vm
)->AddressCreationLock
);
1363 MmUnlockAddressSpace(PMMSUPPORT AddressSpace
)
1365 KeReleaseGuardedMutex(&CONTAINING_RECORD(AddressSpace
, EPROCESS
, Vm
)->AddressCreationLock
);
1370 MmGetAddressSpaceOwner(IN PMMSUPPORT AddressSpace
)
1372 if (AddressSpace
== MmKernelAddressSpace
) return NULL
;
1373 return CONTAINING_RECORD(AddressSpace
, EPROCESS
, Vm
);
1378 MmGetCurrentAddressSpace(VOID
)
1380 return &((PEPROCESS
)KeGetCurrentThread()->ApcState
.Process
)->Vm
;
1385 MmGetKernelAddressSpace(VOID
)
1387 return MmKernelAddressSpace
;
1391 /* expool.c ******************************************************************/
1395 ExpCheckPoolAllocation(
1401 /* mmsup.c *****************************************************************/
1405 MmAdjustWorkingSetSize(
1406 IN SIZE_T WorkingSetMinimumInBytes
,
1407 IN SIZE_T WorkingSetMaximumInBytes
,
1408 IN ULONG SystemCache
,
1409 IN BOOLEAN IncreaseOkay
);
1412 /* session.c *****************************************************************/
1414 _IRQL_requires_max_(APC_LEVEL
)
1418 _Inout_ PVOID SessionEntry
,
1419 _Out_ PKAPC_STATE ApcState
);
1421 _IRQL_requires_max_(APC_LEVEL
)
1425 _Inout_ PVOID SessionEntry
,
1426 _Out_ PKAPC_STATE ApcState
);
1431 _Inout_ PVOID SessionEntry
);
1436 _In_ ULONG SessionId
);
1438 _IRQL_requires_max_(APC_LEVEL
)
1441 MmSetSessionLocaleId(
1442 _In_ LCID LocaleId
);
1445 /* virtual.c *****************************************************************/
1449 MmCopyVirtualMemory(IN PEPROCESS SourceProcess
,
1450 IN PVOID SourceAddress
,
1451 IN PEPROCESS TargetProcess
,
1452 OUT PVOID TargetAddress
,
1453 IN SIZE_T BufferSize
,
1454 IN KPROCESSOR_MODE PreviousMode
,
1455 OUT PSIZE_T ReturnSize
);