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->VadNode.StartingVpn << PAGE_SHIFT)
204 #define MA_GetEndingAddress(_MemoryArea) ((_MemoryArea->VadNode.EndingVpn + 1) << PAGE_SHIFT)
206 typedef struct _MEMORY_AREA
213 BOOLEAN DeleteInProgress
;
220 ROS_SECTION_OBJECT
* Section
;
221 LARGE_INTEGER ViewOffset
;
222 PMM_SECTION_SEGMENT Segment
;
223 LIST_ENTRY RegionListHead
;
227 LIST_ENTRY RegionListHead
;
230 } MEMORY_AREA
, *PMEMORY_AREA
;
232 typedef struct _MM_RMAP_ENTRY
234 struct _MM_RMAP_ENTRY
* Next
;
241 MM_RMAP_ENTRY
, *PMM_RMAP_ENTRY
;
244 extern ULONG MI_PFN_CURRENT_USAGE
;
245 extern CHAR MI_PFN_CURRENT_PROCESS_NAME
[16];
246 #define MI_SET_USAGE(x) MI_PFN_CURRENT_USAGE = x
247 #define MI_SET_PROCESS2(x) memcpy(MI_PFN_CURRENT_PROCESS_NAME, x, 16)
249 #define MI_SET_USAGE(x)
250 #define MI_SET_PROCESS2(x)
253 typedef enum _MI_PFN_USAGES
255 MI_USAGE_NOT_SET
= 0,
257 MI_USAGE_NONPAGED_POOL
,
258 MI_USAGE_NONPAGED_POOL_EXPANSION
,
259 MI_USAGE_KERNEL_STACK
,
260 MI_USAGE_KERNEL_STACK_EXPANSION
,
266 MI_USAGE_PAGE_DIRECTORY
,
267 MI_USAGE_LEGACY_PAGE_DIRECTORY
,
268 MI_USAGE_DRIVER_PAGE
,
269 MI_USAGE_CONTINOUS_ALLOCATION
,
271 MI_USAGE_DEMAND_ZERO
,
274 MI_USAGE_PFN_DATABASE
,
275 MI_USAGE_BOOT_DRIVER
,
276 MI_USAGE_INIT_MEMORY
,
281 // These two mappings are actually used by Windows itself, based on the ASSERTS
283 #define StartOfAllocation ReadInProgress
284 #define EndOfAllocation WriteInProgress
286 typedef struct _MMPFNENTRY
289 USHORT ReadInProgress
:1; // StartOfAllocation
290 USHORT WriteInProgress
:1; // EndOfAllocation
291 USHORT PrototypePte
:1;
293 USHORT PageLocation
:3;
294 USHORT RemovalRequested
:1;
295 USHORT CacheAttribute
:2;
297 USHORT ParityError
:1;
301 typedef struct _MMPFN
309 SINGLE_LIST_ENTRY NextStackPfn
;
318 ULONG_PTR ShareCount
;
324 USHORT ReferenceCount
;
329 USHORT ReferenceCount
;
336 LONG AweReferenceCount
;
339 PMM_RMAP_ENTRY RmapListHead
;
343 ULONG_PTR EntireFrame
;
346 ULONG_PTR PteFrame
:25;
347 ULONG_PTR InPageError
:1;
348 ULONG_PTR VerifierAllocation
:1;
349 ULONG_PTR AweAllocation
:1;
350 ULONG_PTR Priority
:3;
351 ULONG_PTR MustBeCached
:1;
355 MI_PFN_USAGES PfnUsage
;
356 CHAR ProcessName
[16];
359 // HACK until WS lists are supported
363 extern PMMPFN MmPfnDatabase
;
365 typedef struct _MMPFNLIST
371 } MMPFNLIST
, *PMMPFNLIST
;
373 extern MMPFNLIST MmZeroedPageListHead
;
374 extern MMPFNLIST MmFreePageListHead
;
375 extern MMPFNLIST MmStandbyPageListHead
;
376 extern MMPFNLIST MmModifiedPageListHead
;
377 extern MMPFNLIST MmModifiedNoWritePageListHead
;
379 typedef struct _MM_MEMORY_CONSUMER
383 NTSTATUS (*Trim
)(ULONG Target
, ULONG Priority
, PULONG NrFreed
);
384 } MM_MEMORY_CONSUMER
, *PMM_MEMORY_CONSUMER
;
386 typedef struct _MM_REGION
391 LIST_ENTRY RegionListEntry
;
392 } MM_REGION
, *PMM_REGION
;
395 /* Entry describing free pool memory */
396 typedef struct _MMFREE_POOL_ENTRY
401 struct _MMFREE_POOL_ENTRY
*Owner
;
402 } MMFREE_POOL_ENTRY
, *PMMFREE_POOL_ENTRY
;
404 /* Signature of a freed block */
405 #define MM_FREE_POOL_SIGNATURE 'ARM3'
407 /* Paged pool information */
408 typedef struct _MM_PAGED_POOL_INFO
410 PRTL_BITMAP PagedPoolAllocationMap
;
411 PRTL_BITMAP EndOfPagedPoolBitmap
;
412 PMMPTE FirstPteForPagedPool
;
413 PMMPTE LastPteForPagedPool
;
414 PMMPDE NextPdeForPagedPoolExpansion
;
416 SIZE_T PagedPoolCommit
;
417 SIZE_T AllocatedPagedPool
;
418 } MM_PAGED_POOL_INFO
, *PMM_PAGED_POOL_INFO
;
420 extern MM_MEMORY_CONSUMER MiMemoryConsumers
[MC_MAXIMUM
];
423 (*PMM_ALTER_REGION_FUNC
)(
424 PMMSUPPORT AddressSpace
,
434 (*PMM_FREE_PAGE_FUNC
)(
436 PMEMORY_AREA MemoryArea
,
444 // Mm copy support for Kd
456 // Determines if a given address is a session address
476 /* marea.c *******************************************************************/
481 PMMSUPPORT AddressSpace
,
486 PMEMORY_AREA
*Result
,
487 ULONG AllocationFlags
,
488 ULONG AllocationGranularity
493 MmLocateMemoryAreaByAddress(
494 PMMSUPPORT AddressSpace
,
501 PMMSUPPORT AddressSpace
,
502 PMEMORY_AREA MemoryArea
,
503 PMM_FREE_PAGE_FUNC FreePage
,
504 PVOID FreePageContext
509 MiRosCleanupMemoryArea(
515 MmLocateMemoryAreaByRegion(
516 PMMSUPPORT AddressSpace
,
524 PMMSUPPORT AddressSpace
,
526 ULONG_PTR Granularity
,
532 MiRosCheckMemoryAreas(
533 PMMSUPPORT AddressSpace
);
537 MiCheckAllProcessMemoryAreas(VOID
);
539 /* npool.c *******************************************************************/
543 MiInitializeNonPagedPool(VOID
);
548 IN POOL_TYPE PoolType
,
549 IN SIZE_T SizeInBytes
555 IN PVOID VirtualAddress
561 IN PVOID StartingAddress
564 /* pool.c *******************************************************************/
569 IN POOL_TYPE PoolType
,
570 IN ULONG CurrentMaxQuota
,
571 OUT PULONG NewMaxQuota
574 /* mdl.c *********************************************************************/
583 /* mminit.c ******************************************************************/
593 MmInitSystem(IN ULONG Phase
,
594 IN PLOADER_PARAMETER_BLOCK LoaderBlock
);
597 /* pagefile.c ****************************************************************/
601 MmAllocSwapPage(VOID
);
605 MmFreeSwapPage(SWAPENTRY Entry
);
609 MmInitPagingFile(VOID
);
613 MmIsFileObjectAPagingFile(PFILE_OBJECT FileObject
);
631 MmShowOutOfSpaceMessagePagingFile(VOID
);
636 _In_ PFN_NUMBER Page
,
637 _In_ ULONG PageFileIndex
,
638 _In_ ULONG_PTR PageFileOffset
);
640 /* process.c ****************************************************************/
644 MmInitializeProcessAddressSpace(
645 IN PEPROCESS Process
,
646 IN PEPROCESS Clone OPTIONAL
,
647 IN PVOID Section OPTIONAL
,
649 IN POBJECT_NAME_INFORMATION
*AuditName OPTIONAL
655 IN PEPROCESS Process
,
656 IN PINITIAL_PEB InitialPeb
,
663 IN PEPROCESS Process
,
664 IN PCLIENT_ID ClientId
,
665 IN PINITIAL_TEB InitialTeb
,
672 struct _EPROCESS
*Process
,
678 MmCleanProcessAddressSpace(IN PEPROCESS Process
);
682 MmDeleteProcessAddressSpace(IN PEPROCESS Process
);
686 MmGetSessionLocaleId(VOID
);
690 MmSetMemoryPriorityProcess(
691 IN PEPROCESS Process
,
692 IN UCHAR MemoryPriority
695 /* i386/pfault.c *************************************************************/
707 /* special.c *****************************************************************/
711 MiInitializeSpecialPool(VOID
);
716 IN SIZE_T NumberOfBytes
,
721 MmIsSpecialPoolAddress(
726 MmIsSpecialPoolAddressFree(
731 MmAllocateSpecialPool(
732 IN SIZE_T NumberOfBytes
,
734 IN POOL_TYPE PoolType
,
735 IN ULONG SpecialType
);
742 /* mm.c **********************************************************************/
747 IN BOOLEAN StoreInstruction
,
749 IN KPROCESSOR_MODE Mode
,
750 IN PVOID TrapInformation
753 /* kmap.c ********************************************************************/
762 /* process.c *****************************************************************/
766 MmCreateKernelStack(BOOLEAN GuiStack
, UCHAR Node
);
770 MmDeleteKernelStack(PVOID Stack
,
773 /* balace.c ******************************************************************/
777 MmInitializeMemoryConsumer(
779 NTSTATUS (*Trim
)(ULONG Target
, ULONG Priority
, PULONG NrFreed
)
784 MmInitializeBalancer(
785 ULONG NrAvailablePages
,
791 MmReleasePageMemoryConsumer(
798 MmRequestPageMemoryConsumer(
801 PPFN_NUMBER AllocatedPage
806 MiInitBalancerThread(VOID
);
810 MmRebalanceMemoryConsumers(VOID
);
812 /* rmap.c **************************************************************/
816 MmSetRmapListHeadPage(
818 struct _MM_RMAP_ENTRY
* ListHead
821 struct _MM_RMAP_ENTRY
*
823 MmGetRmapListHeadPage(PFN_NUMBER Page
);
829 struct _EPROCESS
*Process
,
838 VOID (*DeleteMapping
)(PVOID Context
, struct _EPROCESS
*Process
, PVOID Address
)
845 struct _EPROCESS
*Process
,
851 MmInitializeRmapList(VOID
);
855 MmSetCleanAllRmaps(PFN_NUMBER Page
);
859 MmSetDirtyAllRmaps(PFN_NUMBER Page
);
863 MmIsDirtyPageRmap(PFN_NUMBER Page
);
867 MmPageOutPhysicalAddress(PFN_NUMBER Page
);
869 /* freelist.c **********************************************************/
873 MiGetPfnEntry(IN PFN_NUMBER Pfn
)
876 extern RTL_BITMAP MiPfnBitMap
;
878 /* Make sure the PFN number is valid */
879 if (Pfn
> MmHighestPhysicalPage
) return NULL
;
881 /* Make sure this page actually has a PFN entry */
882 if ((MiPfnBitMap
.Buffer
) && !(RtlTestBit(&MiPfnBitMap
, (ULONG
)Pfn
))) return NULL
;
885 Page
= &MmPfnDatabase
[Pfn
];
893 MiGetPfnEntryIndex(IN PMMPFN Pfn1
)
896 // This will return the Page Frame Number (PFN) from the MMPFN
898 return Pfn1
- MmPfnDatabase
;
903 MmGetLRUNextUserPage(PFN_NUMBER PreviousPage
);
907 MmGetLRUFirstUserPage(VOID
);
911 MmInsertLRULastUserPage(PFN_NUMBER Page
);
915 MmRemoveLRUUserPage(PFN_NUMBER Page
);
919 MmDumpArmPfnDatabase(
920 IN BOOLEAN StatusOnly
929 /* hypermap.c *****************************************************************/
931 extern PEPROCESS HyperProcess
;
932 extern KIRQL HyperIrql
;
936 MiMapPageInHyperSpace(IN PEPROCESS Process
,
942 MiUnmapPageInHyperSpace(IN PEPROCESS Process
,
948 MiMapPagesInZeroSpace(IN PMMPFN Pfn1
,
949 IN PFN_NUMBER NumberOfPages
);
953 MiUnmapPagesInZeroSpace(IN PVOID VirtualAddress
,
954 IN PFN_NUMBER NumberOfPages
);
957 // ReactOS Compatibility Layer
961 MmCreateHyperspaceMapping(IN PFN_NUMBER Page
)
963 HyperProcess
= (PEPROCESS
)KeGetCurrentThread()->ApcState
.Process
;
964 return MiMapPageInHyperSpace(HyperProcess
, Page
, &HyperIrql
);
967 #define MmDeleteHyperspaceMapping(x) MiUnmapPageInHyperSpace(HyperProcess, x, HyperIrql);
969 /* i386/page.c *********************************************************/
973 MmCreateVirtualMapping(
974 struct _EPROCESS
* Process
,
983 MmCreateVirtualMappingUnsafe(
984 struct _EPROCESS
* Process
,
994 struct _EPROCESS
* Process
,
1000 struct _EPROCESS
* Process
,
1008 struct _EPROCESS
* Process
,
1015 struct _EPROCESS
* Process
,
1021 MmInitGlobalKernelPageDirectory(VOID
);
1025 MmGetPageFileMapping(
1026 struct _EPROCESS
*Process
,
1028 SWAPENTRY
* SwapEntry
);
1032 MmDeletePageFileMapping(
1033 struct _EPROCESS
*Process
,
1035 SWAPENTRY
* SwapEntry
1040 MmCreatePageFileMapping(
1041 struct _EPROCESS
*Process
,
1049 struct _EPROCESS
*Process
,
1056 struct _EPROCESS
*Process
,
1068 MmDereferencePage(PFN_NUMBER Page
);
1072 MmReferencePage(PFN_NUMBER Page
);
1076 MmGetReferenceCountPage(PFN_NUMBER Page
);
1080 MmIsPageInUse(PFN_NUMBER Page
);
1084 MmSetSavedSwapEntryPage(
1086 SWAPENTRY SavedSwapEntry
);
1090 MmGetSavedSwapEntryPage(PFN_NUMBER Page
);
1095 struct _EPROCESS
*Process
,
1102 struct _EPROCESS
*Process
,
1109 struct _EPROCESS
*Process
,
1115 MmCreateProcessAddressSpace(
1118 IN PULONG_PTR DirectoryTableBase
1123 MmInitializeHandBuiltProcess(
1124 IN PEPROCESS Process
,
1125 IN PULONG_PTR DirectoryTableBase
1131 MmInitializeHandBuiltProcess2(
1132 IN PEPROCESS Process
1137 MmSetExecuteOptions(IN ULONG ExecuteOptions
);
1141 MmGetExecuteOptions(IN PULONG ExecuteOptions
);
1145 MmDeleteVirtualMapping(
1146 struct _EPROCESS
*Process
,
1155 struct _EPROCESS
*Process
,
1159 /* wset.c ********************************************************************/
1168 /* region.c ************************************************************/
1173 PMMSUPPORT AddressSpace
,
1175 PLIST_ENTRY RegionListHead
,
1180 PMM_ALTER_REGION_FUNC AlterFunc
1186 PLIST_ENTRY RegionListHead
,
1196 PLIST_ENTRY RegionListHead
,
1198 PVOID
* RegionBaseAddress
1201 /* section.c *****************************************************************/
1205 MmGetImageInformation(
1206 OUT PSECTION_IMAGE_INFORMATION ImageInformation
1211 MmGetFileObjectForSection(
1216 MmGetFileNameForAddress(
1218 OUT PUNICODE_STRING ModuleName
1223 MmGetFileNameForSection(
1225 OUT POBJECT_NAME_INFORMATION
*ModuleName
1231 PMEMORY_AREA MemoryArea
,
1233 PMEMORY_BASIC_INFORMATION Info
,
1234 PSIZE_T ResultLength
1239 MmProtectSectionView(
1240 PMMSUPPORT AddressSpace
,
1241 PMEMORY_AREA MemoryArea
,
1250 MmInitSectionImplementation(VOID
);
1254 MmNotPresentFaultSectionView(
1255 PMMSUPPORT AddressSpace
,
1256 MEMORY_AREA
* MemoryArea
,
1263 MmPageOutSectionView(
1264 PMMSUPPORT AddressSpace
,
1265 PMEMORY_AREA MemoryArea
,
1272 MmCreatePhysicalMemorySection(VOID
);
1276 MmAccessFaultSectionView(
1277 PMMSUPPORT AddressSpace
,
1278 MEMORY_AREA
* MemoryArea
,
1284 MmFreeSectionSegments(PFILE_OBJECT FileObject
);
1286 /* sysldr.c ******************************************************************/
1290 MiReloadBootLoadedDrivers(
1291 IN PLOADER_PARAMETER_BLOCK LoaderBlock
1296 MiInitializeLoadedModuleList(
1297 IN PLOADER_PARAMETER_BLOCK LoaderBlock
1303 IN PUNICODE_STRING FileName
,
1304 IN PUNICODE_STRING NamePrefix OPTIONAL
,
1305 IN PUNICODE_STRING LoadedName OPTIONAL
,
1307 OUT PVOID
*ModuleObject
,
1308 OUT PVOID
*ImageBaseAddress
1313 MmUnloadSystemImage(
1314 IN PVOID ImageHandle
1320 IN HANDLE ImageHandle
,
1321 IN BOOLEAN PurgeSection
1326 MmCallDllInitialize(
1327 IN PLDR_DATA_TABLE_ENTRY LdrEntry
,
1328 IN PLIST_ENTRY ListHead
1332 /* procsup.c *****************************************************************/
1337 IN PVOID StackPointer
1343 MmLockAddressSpace(PMMSUPPORT AddressSpace
)
1345 KeAcquireGuardedMutex(&CONTAINING_RECORD(AddressSpace
, EPROCESS
, Vm
)->AddressCreationLock
);
1350 MmUnlockAddressSpace(PMMSUPPORT AddressSpace
)
1352 KeReleaseGuardedMutex(&CONTAINING_RECORD(AddressSpace
, EPROCESS
, Vm
)->AddressCreationLock
);
1357 MmGetAddressSpaceOwner(IN PMMSUPPORT AddressSpace
)
1359 if (AddressSpace
== MmKernelAddressSpace
) return NULL
;
1360 return CONTAINING_RECORD(AddressSpace
, EPROCESS
, Vm
);
1365 MmGetCurrentAddressSpace(VOID
)
1367 return &((PEPROCESS
)KeGetCurrentThread()->ApcState
.Process
)->Vm
;
1372 MmGetKernelAddressSpace(VOID
)
1374 return MmKernelAddressSpace
;
1378 /* expool.c ******************************************************************/
1382 ExpCheckPoolAllocation(
1393 /* mmsup.c *****************************************************************/
1397 MmAdjustWorkingSetSize(
1398 IN SIZE_T WorkingSetMinimumInBytes
,
1399 IN SIZE_T WorkingSetMaximumInBytes
,
1400 IN ULONG SystemCache
,
1401 IN BOOLEAN IncreaseOkay
);
1404 /* session.c *****************************************************************/
1406 _IRQL_requires_max_(APC_LEVEL
)
1410 _Inout_ PVOID SessionEntry
,
1411 _Out_ PKAPC_STATE ApcState
);
1413 _IRQL_requires_max_(APC_LEVEL
)
1417 _Inout_ PVOID SessionEntry
,
1418 _Out_ PKAPC_STATE ApcState
);
1423 _Inout_ PVOID SessionEntry
);
1428 _In_ ULONG SessionId
);
1430 _IRQL_requires_max_(APC_LEVEL
)
1433 MmSetSessionLocaleId(
1434 _In_ LCID LocaleId
);
1437 /* virtual.c *****************************************************************/
1441 MmCopyVirtualMemory(IN PEPROCESS SourceProcess
,
1442 IN PVOID SourceAddress
,
1443 IN PEPROCESS TargetProcess
,
1444 OUT PVOID TargetAddress
,
1445 IN SIZE_T BufferSize
,
1446 IN KPROCESSOR_MODE PreviousMode
,
1447 OUT PSIZE_T ReturnSize
);