ReactOS 0.4.16-dev-734-g364d6e0
procsup.c File Reference
#include <ntoskrnl.h>
#include <debug.h>
#include <mm/ARM3/miarm.h>
Include dependency graph for procsup.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define MODULE_INVOLVED_IN_ARM3
 

Functions

NTSTATUS NTAPI MiCreatePebOrTeb (IN PEPROCESS Process, IN ULONG Size, OUT PULONG_PTR BaseAddress)
 
VOID NTAPI MmDeleteTeb (IN PEPROCESS Process, IN PTEB Teb)
 
VOID NTAPI MmDeleteKernelStack (IN PVOID StackBase, IN BOOLEAN GuiStack)
 
PVOID NTAPI MmCreateKernelStack (IN BOOLEAN GuiStack, IN UCHAR Node)
 
NTSTATUS NTAPI MmGrowKernelStackEx (IN PVOID StackPointer, IN ULONG GrowSize)
 
NTSTATUS NTAPI MmGrowKernelStack (IN PVOID StackPointer)
 
NTSTATUS NTAPI MmSetMemoryPriorityProcess (IN PEPROCESS Process, IN UCHAR MemoryPriority)
 
NTSTATUS NTAPI MmCreatePeb (IN PEPROCESS Process, IN PINITIAL_PEB InitialPeb, OUT PPEB *BasePeb)
 
NTSTATUS NTAPI MmCreateTeb (IN PEPROCESS Process, IN PCLIENT_ID ClientId, IN PINITIAL_TEB InitialTeb, OUT PTEB *BaseTeb)
 
NTSTATUS NTAPI MmInitializeProcessAddressSpace (IN PEPROCESS Process, IN PEPROCESS ProcessClone OPTIONAL, IN PVOID Section OPTIONAL, IN OUT PULONG Flags, IN POBJECT_NAME_INFORMATION *AuditName OPTIONAL)
 
NTSTATUS NTAPI MmInitializeHandBuiltProcess (IN PEPROCESS Process, IN PULONG_PTR DirectoryTableBase)
 
NTSTATUS NTAPI MmInitializeHandBuiltProcess2 (IN PEPROCESS Process)
 
BOOLEAN NTAPI MmCreateProcessAddressSpace (IN ULONG MinWs, IN PEPROCESS Process, OUT PULONG_PTR DirectoryTableBase)
 
VOID NTAPI MmCleanProcessAddressSpace (IN PEPROCESS Process)
 
VOID NTAPI MmDeleteProcessAddressSpace (IN PEPROCESS Process)
 
NTSTATUS NTAPI NtAllocateUserPhysicalPages (IN HANDLE ProcessHandle, IN OUT PULONG_PTR NumberOfPages, IN OUT PULONG_PTR UserPfnArray)
 
NTSTATUS NTAPI NtMapUserPhysicalPages (IN PVOID VirtualAddresses, IN ULONG_PTR NumberOfPages, IN OUT PULONG_PTR UserPfnArray)
 
NTSTATUS NTAPI NtMapUserPhysicalPagesScatter (IN PVOID *VirtualAddresses, IN ULONG_PTR NumberOfPages, IN OUT PULONG_PTR UserPfnArray)
 
NTSTATUS NTAPI NtFreeUserPhysicalPages (IN HANDLE ProcessHandle, IN OUT PULONG_PTR NumberOfPages, IN OUT PULONG_PTR UserPfnArray)
 

Variables

ULONG MmProcessColorSeed = 0x12345678
 
ULONG MmMaximumDeadKernelStacks = 5
 
SLIST_HEADER MmDeadStackSListHead
 
ULONG MmRotatingUniprocessorNumber = 0
 

Macro Definition Documentation

◆ MODULE_INVOLVED_IN_ARM3

#define MODULE_INVOLVED_IN_ARM3

Definition at line 15 of file procsup.c.

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file procsup.c.

Function Documentation

◆ MiCreatePebOrTeb()

NTSTATUS NTAPI MiCreatePebOrTeb ( IN PEPROCESS  Process,
IN ULONG  Size,
OUT PULONG_PTR  BaseAddress 
)

Definition at line 29 of file procsup.c.

32{
33 PMMVAD_LONG Vad;
35 ULONG_PTR HighestAddress, RandomBase;
36 ULONG AlignedSize;
37 LARGE_INTEGER CurrentTime;
38
40 if (!NT_SUCCESS(Status))
41 return Status;
42
43 /* Allocate a VAD */
44 Vad = ExAllocatePoolWithTag(NonPagedPool, sizeof(MMVAD_LONG), 'ldaV');
45 if (!Vad)
46 {
48 goto FailPath;
49 }
50
51 /* Setup the primary flags with the size, and make it commited, private, RW */
52 Vad->u.LongFlags = 0;
54 Vad->u.VadFlags.MemCommit = TRUE;
57 Vad->u.VadFlags.NoChange = TRUE;
58 Vad->u1.Parent = NULL;
59
60 /* Setup the secondary flags to make it a secured, writable, long VAD */
61 Vad->u2.LongFlags2 = 0;
63 Vad->u2.VadFlags2.LongVad = TRUE;
65
66 Vad->ControlArea = NULL; // For Memory-Area hack
68
69 /* Check if this is a PEB creation */
70 ASSERT(sizeof(TEB) != sizeof(PEB));
71 if (Size == sizeof(PEB))
72 {
73 /* Create a random value to select one page in a 64k region */
74 KeQueryTickCount(&CurrentTime);
75 CurrentTime.LowPart &= (_64K / PAGE_SIZE) - 1;
76
77 /* Calculate a random base address */
78 RandomBase = (ULONG_PTR)MM_HIGHEST_VAD_ADDRESS + 1;
79 RandomBase -= CurrentTime.LowPart << PAGE_SHIFT;
80
81 /* Make sure the base address is not too high */
82 AlignedSize = ROUND_TO_PAGES(Size);
83 if ((RandomBase + AlignedSize) > (ULONG_PTR)MM_HIGHEST_VAD_ADDRESS + 1)
84 {
85 RandomBase = (ULONG_PTR)MM_HIGHEST_VAD_ADDRESS + 1 - AlignedSize;
86 }
87
88 /* Calculate the highest allowed address */
89 HighestAddress = RandomBase + AlignedSize - 1;
90 }
91 else
92 {
93 HighestAddress = (ULONG_PTR)MM_HIGHEST_VAD_ADDRESS;
94 }
95
96 *BaseAddress = 0;
99 Size,
100 HighestAddress,
101 PAGE_SIZE,
103 if (!NT_SUCCESS(Status))
104 {
105 ExFreePoolWithTag(Vad, 'ldaV');
107 goto FailPath;
108 }
109
110
111 /* Success */
112 return STATUS_SUCCESS;
113
114FailPath:
116
117 return Status;
118}
LONG NTSTATUS
Definition: precomp.h:26
#define MM_READWRITE
Definition: bootanim.c:19
#define STATUS_NO_MEMORY
Definition: d3dkmdt.h:51
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define ULONG_PTR
Definition: config.h:101
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define PAGE_SHIFT
Definition: env_spec_w32.h:45
#define NonPagedPool
Definition: env_spec_w32.h:307
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:223
Status
Definition: gdiplustypes.h:25
#define _64K
Definition: miarm.h:23
NTSTATUS NTAPI MiInsertVadEx(_Inout_ PMMVAD Vad, _In_ ULONG_PTR *BaseAddress, _In_ SIZE_T ViewSize, _In_ ULONG_PTR HighestAddress, _In_ ULONG_PTR Alignment, _In_ ULONG AllocationType)
Definition: vadnode.c:282
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
#define MEM_TOP_DOWN
Definition: nt_native.h:1321
#define MM_HIGHEST_VAD_ADDRESS
Definition: mm.h:46
NTSTATUS NTAPI PsChargeProcessNonPagedPoolQuota(_In_ PEPROCESS Process, _In_ SIZE_T Amount)
Charges the non paged pool quota of a given process.
Definition: quota.c:811
VOID NTAPI PsReturnProcessNonPagedPoolQuota(_In_ PEPROCESS Process, _In_ SIZE_T Amount)
Returns the non paged quota pool that the process was taking up.
Definition: quota.c:938
#define KeQueryTickCount(CurrentCount)
Definition: ke.h:43
#define STATUS_SUCCESS
Definition: shellext.h:65
ULONG ReadOnly
Definition: mmtypes.h:710
ULONG OneSecured
Definition: mmtypes.h:708
ULONG LongVad
Definition: mmtypes.h:711
ULONG_PTR NoChange
Definition: mmtypes.h:693
ULONG_PTR MemCommit
Definition: mmtypes.h:695
ULONG_PTR Protection
Definition: mmtypes.h:696
ULONG_PTR CommitCharge
Definition: mmtypes.h:691
ULONG_PTR PrivateMemory
Definition: mmtypes.h:698
union _MMVAD_LONG::@2635 u2
union _MMVAD_LONG::@2634 u
PMMPTE FirstPrototypePte
Definition: mmtypes.h:766
MMVAD_FLAGS VadFlags
Definition: mmtypes.h:763
ULONG_PTR LongFlags
Definition: mmtypes.h:762
union _MMVAD_LONG::@2633 u1
PCONTROL_AREA ControlArea
Definition: mmtypes.h:765
PMMVAD Parent
Definition: mmtypes.h:754
ULONG LongFlags2
Definition: mmtypes.h:770
MMVAD_FLAGS2 VadFlags2
Definition: mmtypes.h:771
Definition: compat.h:836
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
ULONG LowPart
Definition: typedefs.h:106
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
#define ROUND_TO_PAGES(Size)
#define BYTES_TO_PAGES(Size)

Referenced by MmCreatePeb(), and MmCreateTeb().

◆ MmCleanProcessAddressSpace()

VOID NTAPI MmCleanProcessAddressSpace ( IN PEPROCESS  Process)

Definition at line 1263 of file procsup.c.

1264{
1265 PMMVAD Vad;
1266 PMM_AVL_TABLE VadTree;
1268
1269 /* Remove from the session */
1271
1272 /* Abort early, when the address space wasn't fully initialized */
1273 if (Process->AddressSpaceInitialized < 2)
1274 {
1275 DPRINT1("Incomplete address space for Process %p. Might leak resources.\n",
1276 Process);
1277 return;
1278 }
1279
1280 /* Lock the process address space from changes */
1283
1284 /* VM is deleted now */
1285 Process->VmDeleted = TRUE;
1287
1288 /* Enumerate the VADs */
1289 VadTree = &Process->VadRoot;
1290 while (VadTree->NumberGenericTableElements)
1291 {
1292 /* Grab the current VAD */
1293 Vad = (PMMVAD)VadTree->BalancedRoot.RightChild;
1294
1295 /* Check for old-style memory areas */
1296 if (Vad->u.VadFlags.Spare == 1)
1297 {
1298 /* Let RosMm handle this */
1300 continue;
1301 }
1302
1303 /* Lock the working set */
1305
1306 /* Remove this VAD from the tree */
1307 ASSERT(VadTree->NumberGenericTableElements >= 1);
1308 MiRemoveNode((PMMADDRESS_NODE)Vad, VadTree);
1309
1310 /* Only regular VADs supported for now */
1311 ASSERT(Vad->u.VadFlags.VadType == VadNone);
1312
1313 /* Check if this is a section VAD */
1314 if (!(Vad->u.VadFlags.PrivateMemory) && (Vad->ControlArea))
1315 {
1316 /* Remove the view */
1318 }
1319 else
1320 {
1321 /* Delete the addresses */
1323 (Vad->EndingVpn << PAGE_SHIFT) | (PAGE_SIZE - 1),
1324 Vad);
1325
1326 /* Release the working set */
1328 }
1329
1330 /* Skip ARM3 fake VADs, they'll be freed by MmDeleteProcessAddresSpace */
1331 if (Vad->u.VadFlags.Spare == 1)
1332 {
1333 /* Set a flag so MmDeleteMemoryArea knows to free, but not to remove */
1334 Vad->u.VadFlags.Spare = 2;
1335 continue;
1336 }
1337
1338 /* Free the VAD memory */
1339 ExFreePool(Vad);
1340
1341 /* Return the quota the VAD used */
1343 }
1344
1345 /* Lock the working set */
1347 ASSERT(Process->CloneRoot == NULL);
1348 ASSERT(Process->PhysicalVadRoot == NULL);
1349
1350 /* Delete the shared user data section */
1352
1353 /* Release the working set */
1355
1356 /* Release the address space */
1358}
#define DPRINT1
Definition: precomp.h:8
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
#define USER_SHARED_DATA
Definition: pstypes.h:51
if(dx< 0)
Definition: linetemp.h:194
VOID NTAPI MiDeleteVirtualAddresses(IN ULONG_PTR Va, IN ULONG_PTR EndingAddress, IN PMMVAD Vad)
Definition: virtual.c:530
VOID NTAPI MiRemoveNode(IN PMMADDRESS_NODE Node, IN PMM_AVL_TABLE Table)
Definition: vadnode.c:440
VOID NTAPI MiRemoveMappedView(IN PEPROCESS CurrentProcess, IN PMMVAD Vad)
Definition: section.c:766
FORCEINLINE VOID MiUnlockProcessWorkingSetUnsafe(IN PEPROCESS Process, IN PETHREAD Thread)
Definition: miarm.h:1252
VOID NTAPI MiSessionRemoveProcess(VOID)
Definition: session.c:392
FORCEINLINE VOID MiLockProcessWorkingSetUnsafe(IN PEPROCESS Process, IN PETHREAD Thread)
Definition: miarm.h:1182
@ VadNone
Definition: mmtypes.h:204
struct _MMVAD * PMMVAD
FORCEINLINE VOID MmLockAddressSpace(PMMSUPPORT AddressSpace)
Definition: mm.h:1698
VOID NTAPI MiRosCleanupMemoryArea(PEPROCESS Process, PMMVAD Vad)
Definition: marea.c:521
FORCEINLINE VOID MmUnlockAddressSpace(PMMSUPPORT AddressSpace)
Definition: mm.h:1711
struct _MMADDRESS_NODE * RightChild
Definition: mmtypes.h:652
ULONG_PTR Spare
Definition: mmtypes.h:697
ULONG_PTR VadType
Definition: mmtypes.h:694
union _MMVAD::@2631 u
ULONG_PTR EndingVpn
Definition: mmtypes.h:730
PCONTROL_AREA ControlArea
Definition: mmtypes.h:736
ULONG_PTR StartingVpn
Definition: mmtypes.h:729
MMVAD_FLAGS VadFlags
Definition: mmtypes.h:734
ULONG_PTR NumberGenericTableElements
Definition: mmtypes.h:668
MMADDRESS_NODE BalancedRoot
Definition: mmtypes.h:662

Referenced by PspExitProcess(), and PspExitThread().

◆ MmCreateKernelStack()

PVOID NTAPI MmCreateKernelStack ( IN BOOLEAN  GuiStack,
IN UCHAR  Node 
)

Definition at line 276 of file procsup.c.

278{
279 PFN_COUNT StackPtes, StackPages;
280 PMMPTE PointerPte, StackPte;
282 MMPTE TempPte, InvalidPte;
284 PFN_NUMBER PageFrameIndex;
285 ULONG i;
286 PSLIST_ENTRY SListEntry;
287
288 //
289 // Calculate pages needed
290 //
291 if (GuiStack)
292 {
293 //
294 // We'll allocate 64KB stack, but only commit 12K
295 //
296 StackPtes = BYTES_TO_PAGES(MmLargeStackSize);
298 }
299 else
300 {
301 //
302 // If the dead stack S-LIST has a stack on it, use it instead of allocating
303 // new system PTEs for this stack
304 //
306 {
308 if (SListEntry != NULL)
309 {
310 BaseAddress = (SListEntry + 1);
311 return BaseAddress;
312 }
313 }
314
315 //
316 // We'll allocate 12K and that's it
317 //
319 StackPages = StackPtes;
320 }
321
322 //
323 // Reserve stack pages, plus a guard page
324 //
325 StackPte = MiReserveSystemPtes(StackPtes + 1, SystemPteSpace);
326 if (!StackPte) return NULL;
327
328 //
329 // Get the stack address
330 //
331 BaseAddress = MiPteToAddress(StackPte + StackPtes + 1);
332
333 //
334 // Select the right PTE address where we actually start committing pages
335 //
336 PointerPte = StackPte;
337 if (GuiStack) PointerPte += BYTES_TO_PAGES(MmLargeStackSize -
339
340
341 /* Setup the temporary invalid PTE */
342 MI_MAKE_SOFTWARE_PTE(&InvalidPte, MM_NOACCESS);
343
344 /* Setup the template stack PTE */
346
347 //
348 // Acquire the PFN DB lock
349 //
350 OldIrql = MiAcquirePfnLock();
351
352 //
353 // Loop each stack page
354 //
355 for (i = 0; i < StackPages; i++)
356 {
357 //
358 // Next PTE
359 //
360 PointerPte++;
361
362 /* Get a page and write the current invalid PTE */
364 MI_SET_PROCESS2(PsGetCurrentProcess()->ImageFileName);
365 PageFrameIndex = MiRemoveAnyPage(MI_GET_NEXT_COLOR());
366 MI_WRITE_INVALID_PTE(PointerPte, InvalidPte);
367
368 /* Initialize the PFN entry for this page */
369 MiInitializePfn(PageFrameIndex, PointerPte, 1);
370
371 /* Write the valid PTE */
372 TempPte.u.Hard.PageFrameNumber = PageFrameIndex;
373 MI_WRITE_VALID_PTE(PointerPte, TempPte);
374 }
375
376 //
377 // Release the PFN lock
378 //
379 MiReleasePfnLock(OldIrql);
380
381 //
382 // Return the stack address
383 //
384 return BaseAddress;
385}
HARDWARE_PTE_ARMV6 TempPte
Definition: winldr.c:76
UCHAR KIRQL
Definition: env_spec_w32.h:591
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
@ SystemPteSpace
Definition: miarm.h:417
#define MI_GET_NEXT_COLOR()
Definition: miarm.h:246
PFN_NUMBER NTAPI MiRemoveAnyPage(IN ULONG Color)
Definition: pfnlist.c:477
#define MI_MAKE_SOFTWARE_PTE(p, x)
Definition: miarm.h:203
FORCEINLINE VOID MI_MAKE_HARDWARE_PTE_KERNEL(IN PMMPTE NewPte, IN PMMPTE MappingPte, IN ULONG_PTR ProtectionMask, IN PFN_NUMBER PageFrameNumber)
Definition: miarm.h:787
FORCEINLINE VOID MI_WRITE_INVALID_PTE(IN PMMPTE PointerPte, IN MMPTE InvalidPte)
Definition: miarm.h:1006
PMMPTE NTAPI MiReserveSystemPtes(IN ULONG NumberOfPtes, IN MMSYSTEM_PTE_POOL_TYPE SystemPtePoolType)
Definition: syspte.c:246
#define MM_NOACCESS
Definition: miarm.h:65
ULONG MmLargeStackSize
Definition: mminit.c:262
FORCEINLINE VOID MI_WRITE_VALID_PTE(IN PMMPTE PointerPte, IN MMPTE TempPte)
Definition: miarm.h:973
VOID NTAPI MiInitializePfn(IN PFN_NUMBER PageFrameIndex, IN PMMPTE PointerPte, IN BOOLEAN Modified)
Definition: pfnlist.c:970
#define MiPteToAddress(_Pte)
Definition: mm.h:116
#define MI_SET_PROCESS2(x)
Definition: mm.h:326
@ MI_USAGE_KERNEL_STACK
Definition: mm.h:335
#define MI_SET_USAGE(x)
Definition: mm.h:324
SLIST_HEADER MmDeadStackSListHead
Definition: procsup.c:22
#define KERNEL_STACK_SIZE
#define KERNEL_LARGE_STACK_COMMIT
ULONG PFN_NUMBER
Definition: ke.h:9
ULONG PageFrameNumber
Definition: mmtypes.h:109
FORCEINLINE USHORT ExQueryDepthSList(_In_ PSLIST_HEADER SListHead)
Definition: exfuncs.h:153
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778
ULONG PFN_COUNT
Definition: mmtypes.h:102
#define PsGetCurrentProcess
Definition: psfuncs.h:17
#define InterlockedPopEntrySList(SListHead)
Definition: rtlfuncs.h:3409
#define PSLIST_ENTRY
Definition: rtltypes.h:134

◆ MmCreatePeb()

NTSTATUS NTAPI MmCreatePeb ( IN PEPROCESS  Process,
IN PINITIAL_PEB  InitialPeb,
OUT PPEB BasePeb 
)

Definition at line 518 of file procsup.c.

521{
522 PPEB Peb = NULL;
524 SIZE_T ViewSize = 0;
525 PVOID TableBase = NULL;
526 PIMAGE_NT_HEADERS NtHeaders;
527 PIMAGE_LOAD_CONFIG_DIRECTORY ImageConfigData;
529 USHORT Characteristics;
530 SectionOffset.QuadPart = (ULONGLONG)0;
531 *BasePeb = NULL;
532
533 //
534 // Attach to Process
535 //
537
538 //
539 // Map NLS Tables
540 //
543 &TableBase,
544 0,
545 0,
547 &ViewSize,
548 ViewShare,
551 DPRINT("NLS Tables at: %p\n", TableBase);
552 if (!NT_SUCCESS(Status))
553 {
554 /* Cleanup and exit */
556 return Status;
557 }
558
559 //
560 // Allocate the PEB
561 //
563 DPRINT("PEB at: %p\n", Peb);
564 if (!NT_SUCCESS(Status))
565 {
566 /* Cleanup and exit */
568 return Status;
569 }
570
571 //
572 // Use SEH in case we can't load the PEB
573 //
575 {
576 //
577 // Initialize the PEB
578 //
579 RtlZeroMemory(Peb, sizeof(PEB));
580
581 //
582 // Set up data
583 //
584 Peb->ImageBaseAddress = Process->SectionBaseAddress;
585 Peb->InheritedAddressSpace = InitialPeb->InheritedAddressSpace;
586 Peb->Mutant = InitialPeb->Mutant;
587 Peb->ImageUsesLargePages = InitialPeb->ImageUsesLargePages;
588
589 //
590 // NLS
591 //
595
596 //
597 // Default Version Data (could get changed below)
598 //
601 Peb->OSBuildNumber = (USHORT)(NtBuildNumber & 0x3FFF);
603 Peb->OSCSDVersion = (USHORT)CmNtCSDVersion;
604
605 //
606 // Heap and Debug Data
607 //
610 Peb->BeingDebugged = (BOOLEAN)(Process->DebugPort != NULL);
618 Peb->MaximumNumberOfHeaps = (PAGE_SIZE - sizeof(PEB)) / sizeof(PVOID);
619 Peb->ProcessHeaps = (PVOID*)(Peb + 1);
620
621 //
622 // Session ID
623 //
624 if (Process->Session) Peb->SessionId = MmGetSessionId(Process);
625 }
627 {
628 //
629 // Fail
630 //
633 }
634 _SEH2_END;
635
636 //
637 // Use SEH in case we can't load the image
638 //
640 {
641 //
642 // Get NT Headers
643 //
645 Characteristics = NtHeaders->FileHeader.Characteristics;
646 }
648 {
649 //
650 // Fail
651 //
654 }
655 _SEH2_END;
656
657 //
658 // Parse the headers
659 //
660 if (NtHeaders)
661 {
662 //
663 // Use SEH in case we can't load the headers
664 //
666 {
667 //
668 // Get the Image Config Data too
669 //
671 TRUE,
673 (PULONG)&ViewSize);
674 if (ImageConfigData)
675 {
676 //
677 // Probe it
678 //
679 ProbeForRead(ImageConfigData,
681 sizeof(ULONG));
682 }
683
684 //
685 // Write subsystem data
686 //
690
691 //
692 // Check for version data
693 //
694 if (NtHeaders->OptionalHeader.Win32VersionValue)
695 {
696 //
697 // Extract values and write them
698 //
700 Peb->OSMinorVersion = (NtHeaders->OptionalHeader.Win32VersionValue >> 8) & 0xFF;
701 Peb->OSBuildNumber = (NtHeaders->OptionalHeader.Win32VersionValue >> 16) & 0x3FFF;
702 Peb->OSPlatformId = (NtHeaders->OptionalHeader.Win32VersionValue >> 30) ^ 2;
703
704 /* Process CSD version override */
705 if ((ImageConfigData) && (ImageConfigData->CSDVersion))
706 {
707 /* Take the value from the image configuration directory */
708 Peb->OSCSDVersion = ImageConfigData->CSDVersion;
709 }
710 }
711
712 /* Process optional process affinity mask override */
713 if ((ImageConfigData) && (ImageConfigData->ProcessAffinityMask))
714 {
715 /* Take the value from the image configuration directory */
717 }
718
719 //
720 // Check if this is a UP image
721 if (Characteristics & IMAGE_FILE_UP_SYSTEM_ONLY)
722 {
723 //
724 // Set single processor rotating affinity.
725 // See https://www.microsoftpressstore.com/articles/article.aspx?p=2233328&seqNum=3
726 //
730 }
731 }
733 {
734 //
735 // Fail
736 //
739 }
740 _SEH2_END;
741 }
742
743 //
744 // Detach from the Process
745 //
747 *BasePeb = Peb;
748 return STATUS_SUCCESS;
749}
SIZE_T MmHeapSegmentReserve
Definition: mminit.c:366
SIZE_T MmHeapDeCommitFreeBlockThreshold
Definition: mminit.c:369
SIZE_T MmHeapDeCommitTotalFreeThreshold
Definition: mminit.c:368
SIZE_T MmHeapSegmentCommit
Definition: mminit.c:367
struct _PEB PEB
#define PAGE_READONLY
Definition: compat.h:138
#define RtlImageDirectoryEntryToData
Definition: compat.h:809
#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG
Definition: compat.h:153
#define RtlImageNtHeader
Definition: compat.h:806
PPEB Peb
Definition: dllmain.c:27
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
SIZE_T MmMinimumStackCommitInBytes
Definition: mminit.c:370
LARGE_INTEGER MmCriticalSectionTimeout
Definition: mminit.c:388
#define PCHAR
Definition: match.c:90
FORCEINLINE KAFFINITY AFFINITY_MASK(ULONG Index)
Definition: kefuncs.h:39
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER SectionOffset
Definition: mmfuncs.h:407
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T ViewSize
Definition: mmfuncs.h:408
#define VER_PLATFORM_WIN32_NT
Definition: rtltypes.h:238
@ ViewShare
Definition: nt_native.h:1278
ULONG ExpOemCodePageDataOffset
Definition: init.c:86
ULONG NtMajorVersion
Definition: init.c:45
ULONG ExpUnicodeCaseTableDataOffset
Definition: init.c:87
ULONG NtGlobalFlag
Definition: init.c:54
PVOID ExpNlsSectionPointer
Definition: init.c:90
ULONG ExpAnsiCodePageDataOffset
Definition: init.c:86
ULONG NtMinorVersion
Definition: init.c:46
ULONG CmNtCSDVersion
Definition: init.c:59
KAFFINITY KeActiveProcessors
Definition: processor.c:17
ULONG NTAPI MmGetSessionId(IN PEPROCESS Process)
Definition: session.c:179
CCHAR KeNumberProcessors
Definition: processor.c:16
ULONG MmRotatingUniprocessorNumber
Definition: procsup.c:23
NTSTATUS NTAPI MiCreatePebOrTeb(IN PEPROCESS Process, IN ULONG Size, OUT PULONG_PTR BaseAddress)
Definition: procsup.c:29
#define STATUS_INVALID_IMAGE_PROTECT
Definition: ntstatus.h:540
#define BOOLEAN
Definition: pedump.c:73
unsigned short USHORT
Definition: pedump.c:61
#define IMAGE_FILE_UP_SYSTEM_ONLY
Definition: pedump.c:170
VOID NTAPI KeDetachProcess(VOID)
Definition: procobj.c:621
VOID NTAPI KeAttachProcess(IN PKPROCESS Process)
Definition: procobj.c:582
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
#define _SEH2_END
Definition: pseh2_64.h:155
#define _SEH2_TRY
Definition: pseh2_64.h:55
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:168
NTSTATUS NTAPI MmMapViewOfSection(IN PVOID SectionObject, IN PEPROCESS Process, IN OUT PVOID *BaseAddress, IN ULONG_PTR ZeroBits, IN SIZE_T CommitSize, IN OUT PLARGE_INTEGER SectionOffset OPTIONAL, IN OUT PSIZE_T ViewSize, IN SECTION_INHERIT InheritDisposition, IN ULONG AllocationType, IN ULONG Protect)
Definition: section.c:4001
#define DPRINT
Definition: sndvol32.h:73
ULONG NtBuildNumber
Definition: init.c:50
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
IMAGE_FILE_HEADER FileHeader
Definition: ntddk_ex.h:183
ULONG HeapDeCommitTotalFreeThreshold
Definition: ntddk_ex.h:277
ULONG HeapSegmentCommit
Definition: ntddk_ex.h:276
ULONG ImageSubsystem
Definition: ntddk_ex.h:304
ULONG NumberOfProcessors
Definition: ntddk_ex.h:269
ULONG ImageProcessAffinityMask
Definition: ntddk_ex.h:307
PVOID ImageBaseAddress
Definition: ntddk_ex.h:245
ULONG SessionId
Definition: btrfs_drv.h:1919
LARGE_INTEGER CriticalSectionTimeout
Definition: ntddk_ex.h:274
ULONG MaximumNumberOfHeaps
Definition: ntddk_ex.h:287
ULONG OSMinorVersion
Definition: ntddk_ex.h:301
PVOID * ProcessHeaps
Definition: ntddk_ex.h:288
ULONG HeapSegmentReserve
Definition: ntddk_ex.h:275
PVOID AnsiCodePageData
Definition: ntddk_ex.h:264
ULONG ImageSubsystemMinorVersion
Definition: ntddk_ex.h:306
BYTE BeingDebugged
Definition: btrfs_drv.h:1909
SIZE_T MinimumStackCommit
Definition: winternl.h:358
HANDLE Mutant
Definition: ntddk_ex.h:243
ULONG OSMajorVersion
Definition: ntddk_ex.h:300
ULONG OSBuildNumber
Definition: ntddk_ex.h:302
PVOID OemCodePageData
Definition: ntddk_ex.h:265
ULONG NtGlobalFlag
Definition: ntddk_ex.h:270
BOOLEAN InheritedAddressSpace
Definition: ntddk_ex.h:239
ULONG ImageSubsystemMajorVersion
Definition: ntddk_ex.h:305
ULONG OSPlatformId
Definition: ntddk_ex.h:303
ULONG HeapDeCommitFreeBlockThreshold
Definition: ntddk_ex.h:278
PVOID UnicodeCaseTableData
Definition: ntddk_ex.h:266
uint32_t * PULONG_PTR
Definition: typedefs.h:65
uint32_t * PULONG
Definition: typedefs.h:59
void * PVOID
Definition: typedefs.h:50
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint64_t ULONGLONG
Definition: typedefs.h:67

Referenced by PspCreateProcess().

◆ MmCreateProcessAddressSpace()

BOOLEAN NTAPI MmCreateProcessAddressSpace ( IN ULONG  MinWs,
IN PEPROCESS  Process,
OUT PULONG_PTR  DirectoryTableBase 
)

Definition at line 1161 of file procsup.c.

1164{
1165 KIRQL OldIrql;
1166 PFN_NUMBER TableBaseIndex, HyperIndex, WsListIndex;
1167 ULONG Color;
1168
1169 /* Make sure we don't already have a page directory setup */
1170 ASSERT(Process->Pcb.DirectoryTableBase[0] == 0);
1171 ASSERT(Process->Pcb.DirectoryTableBase[1] == 0);
1172 ASSERT(Process->WorkingSetPage == 0);
1173
1174 /* Choose a process color */
1175 Process->NextPageColor = (USHORT)RtlRandom(&MmProcessColorSeed);
1176
1177 /* Setup the hyperspace lock */
1178 KeInitializeSpinLock(&Process->HyperSpaceLock);
1179
1180 /* Lock PFN database */
1181 OldIrql = MiAcquirePfnLock();
1182
1183 /*
1184 * Get a page for the table base, one for hyper space & one for the working set list.
1185 * The PFNs for these pages will be initialized in MmInitializeProcessAddressSpace,
1186 * when we are already attached to the process.
1187 * The other pages (if any) are allocated in the arch-specific part.
1188 */
1191 TableBaseIndex = MiRemoveZeroPageSafe(Color);
1192 if (!TableBaseIndex)
1193 {
1194 /* No zero pages, grab a free one */
1195 TableBaseIndex = MiRemoveAnyPage(Color);
1196
1197 /* Zero it outside the PFN lock */
1198 MiReleasePfnLock(OldIrql);
1199 MiZeroPhysicalPage(TableBaseIndex);
1200 OldIrql = MiAcquirePfnLock();
1201 }
1204 HyperIndex = MiRemoveZeroPageSafe(Color);
1205 if (!HyperIndex)
1206 {
1207 /* No zero pages, grab a free one */
1208 HyperIndex = MiRemoveAnyPage(Color);
1209
1210 /* Zero it outside the PFN lock */
1211 MiReleasePfnLock(OldIrql);
1212 MiZeroPhysicalPage(HyperIndex);
1213 OldIrql = MiAcquirePfnLock();
1214 }
1217 WsListIndex = MiRemoveZeroPageSafe(Color);
1218 if (!WsListIndex)
1219 {
1220 /* No zero pages, grab a free one */
1221 WsListIndex = MiRemoveAnyPage(Color);
1222
1223 /* Zero it outside the PFN lock */
1224 MiReleasePfnLock(OldIrql);
1225 MiZeroPhysicalPage(WsListIndex);
1226 }
1227 else
1228 {
1229 /* Release the PFN lock */
1230 MiReleasePfnLock(OldIrql);
1231 }
1232
1233 /* Set the base directory pointers */
1234 Process->WorkingSetPage = WsListIndex;
1235 DirectoryTableBase[0] = TableBaseIndex << PAGE_SHIFT;
1236 DirectoryTableBase[1] = HyperIndex << PAGE_SHIFT;
1237
1238 /* Perform the arch-specific parts */
1239 if (!MiArchCreateProcessAddressSpace(Process, DirectoryTableBase))
1240 {
1241 OldIrql = MiAcquirePfnLock();
1242 MiInsertPageInFreeList(WsListIndex);
1243 MiInsertPageInFreeList(HyperIndex);
1244 MiInsertPageInFreeList(TableBaseIndex);
1245 MiReleasePfnLock(OldIrql);
1246 Process->WorkingSetPage = 0;
1247 DirectoryTableBase[0] = 0;
1248 DirectoryTableBase[1] = 0;
1249 return FALSE;
1250 }
1251
1252 /* Switch to phase 1 initialization */
1253 ASSERT(Process->AddressSpaceInitialized == 0);
1254 Process->AddressSpaceInitialized = 1;
1255
1256 /* Add the process to the session */
1258 return TRUE;
1259}
#define KeInitializeSpinLock(sl)
Definition: env_spec_w32.h:604
VOID NTAPI MiSessionAddProcess(IN PEPROCESS NewProcess)
Definition: session.c:423
VOID NTAPI MiInsertPageInFreeList(IN PFN_NUMBER PageFrameIndex)
Definition: pfnlist.c:611
#define MI_GET_NEXT_PROCESS_COLOR(x)
Definition: miarm.h:247
FORCEINLINE PFN_NUMBER MiRemoveZeroPageSafe(IN ULONG Color)
Definition: miarm.h:2413
NTSYSAPI ULONG NTAPI RtlRandom(_Inout_ PULONG Seed)
VOID NTAPI MiZeroPhysicalPage(IN PFN_NUMBER PageFrameIndex)
Definition: pfnlist.c:122
@ MI_USAGE_PAGE_TABLE
Definition: mm.h:341
@ MI_USAGE_PAGE_DIRECTORY
Definition: mm.h:342
BOOLEAN MiArchCreateProcessAddressSpace(_In_ PEPROCESS Process, _In_ PULONG_PTR DirectoryTableBase)
Definition: procsup.c:21
ULONG MmProcessColorSeed
Definition: procsup.c:20

◆ MmCreateTeb()

NTSTATUS NTAPI MmCreateTeb ( IN PEPROCESS  Process,
IN PCLIENT_ID  ClientId,
IN PINITIAL_TEB  InitialTeb,
OUT PTEB BaseTeb 
)

Definition at line 753 of file procsup.c.

757{
758 PTEB Teb;
760 *BaseTeb = NULL;
761
762 //
763 // Attach to Target
764 //
766
767 //
768 // Allocate the TEB
769 //
770 Status = MiCreatePebOrTeb(Process, sizeof(TEB), (PULONG_PTR)&Teb);
771 if (!NT_SUCCESS(Status))
772 {
773 /* Cleanup and exit */
775 return Status;
776 }
777
778 //
779 // Use SEH in case we can't load the TEB
780 //
782 {
783 //
784 // Initialize the PEB
785 //
786 RtlZeroMemory(Teb, sizeof(TEB));
787
788 //
789 // Set TIB Data
790 //
791#ifdef _M_AMD64
792 Teb->NtTib.ExceptionList = NULL;
793#else
795#endif
796 Teb->NtTib.Self = (PNT_TIB)Teb;
797
798 //
799 // Identify this as an OS/2 V3.0 ("Cruiser") TIB
800 //
801 Teb->NtTib.Version = 30 << 8;
802
803 //
804 // Set TEB Data
805 //
806 Teb->ClientId = *ClientId;
807 Teb->RealClientId = *ClientId;
810
811 //
812 // Check if we have a grandparent TEB
813 //
814 if ((InitialTeb->PreviousStackBase == NULL) &&
815 (InitialTeb->PreviousStackLimit == NULL))
816 {
817 //
818 // Use initial TEB values
819 //
820 Teb->NtTib.StackBase = InitialTeb->StackBase;
821 Teb->NtTib.StackLimit = InitialTeb->StackLimit;
822 Teb->DeallocationStack = InitialTeb->AllocatedStackBase;
823 }
824 else
825 {
826 //
827 // Use grandparent TEB values
828 //
829 Teb->NtTib.StackBase = InitialTeb->PreviousStackBase;
830 Teb->NtTib.StackLimit = InitialTeb->PreviousStackLimit;
831 }
832
833 //
834 // Initialize the static unicode string
835 //
838 }
840 {
841 //
842 // Get error code
843 //
845 }
846 _SEH2_END;
847
848 //
849 // Return
850 //
852 *BaseTeb = Teb;
853 return Status;
854}
struct _NT_TIB * PNT_TIB
#define EXCEPTION_CHAIN_END
Definition: rtltypes.h:63
LCID PsDefaultThreadLocaleId
Definition: locale.c:24
struct _NT_TIB * Self
Definition: compat.h:720
PVOID StackLimit
Definition: compat.h:713
DWORD Version
Definition: compat.h:717
PVOID StackBase
Definition: compat.h:712
struct _EXCEPTION_REGISTRATION_RECORD * ExceptionList
Definition: compat.h:711
WCHAR StaticUnicodeBuffer[261]
Definition: compat.h:877
ULONG CurrentLocale
Definition: compat.h:849
NT_TIB NtTib
Definition: ntddk_ex.h:332
UNICODE_STRING StaticUnicodeString
Definition: compat.h:876
CLIENT_ID ClientId
Definition: compat.h:839
CLIENT_ID RealClientId
Definition: compat.h:861
PPEB ProcessEnvironmentBlock
Definition: ntddk_ex.h:337
PVOID DeallocationStack
Definition: compat.h:878
USHORT MaximumLength
Definition: env_spec_w32.h:370
_Out_ PCLIENT_ID ClientId
Definition: kefuncs.h:1151

Referenced by PspCreateThread().

◆ MmDeleteKernelStack()

VOID NTAPI MmDeleteKernelStack ( IN PVOID  StackBase,
IN BOOLEAN  GuiStack 
)

Definition at line 187 of file procsup.c.

189{
190 PMMPTE PointerPte;
191 PFN_NUMBER PageFrameNumber, PageTableFrameNumber;
192 PFN_COUNT StackPages;
193 PMMPFN Pfn1, Pfn2;
194 ULONG i;
196 PSLIST_ENTRY SListEntry;
197
198 //
199 // This should be the guard page, so decrement by one
200 //
201 PointerPte = MiAddressToPte(StackBase);
202 PointerPte--;
203
204 //
205 // If this is a small stack, just push the stack onto the dead stack S-LIST
206 //
207 if (!GuiStack)
208 {
210 {
211 SListEntry = ((PSLIST_ENTRY)StackBase) - 1;
213 return;
214 }
215 }
216
217 //
218 // Calculate pages used
219 //
220 StackPages = BYTES_TO_PAGES(GuiStack ?
222
223 /* Acquire the PFN lock */
224 OldIrql = MiAcquirePfnLock();
225
226 //
227 // Loop them
228 //
229 for (i = 0; i < StackPages; i++)
230 {
231 //
232 // Check if this is a valid PTE
233 //
234 if (PointerPte->u.Hard.Valid == 1)
235 {
236 /* Get the PTE's page */
237 PageFrameNumber = PFN_FROM_PTE(PointerPte);
238 Pfn1 = MiGetPfnEntry(PageFrameNumber);
239
240 /* Now get the page of the page table mapping it */
241 PageTableFrameNumber = Pfn1->u4.PteFrame;
242 Pfn2 = MiGetPfnEntry(PageTableFrameNumber);
243
244 /* Remove a shared reference, since the page is going away */
245 MiDecrementShareCount(Pfn2, PageTableFrameNumber);
246
247 /* Set the special pending delete marker */
248 MI_SET_PFN_DELETED(Pfn1);
249
250 /* And now delete the actual stack page */
251 MiDecrementShareCount(Pfn1, PageFrameNumber);
252 }
253
254 //
255 // Next one
256 //
257 PointerPte--;
258 }
259
260 //
261 // We should be at the guard page now
262 //
263 ASSERT(PointerPte->u.Hard.Valid == 0);
264
265 /* Release the PFN lock */
266 MiReleasePfnLock(OldIrql);
267
268 //
269 // Release the PTEs
270 //
271 MiReleaseSystemPtes(PointerPte, StackPages + 1, SystemPteSpace);
272}
#define MI_SET_PFN_DELETED(x)
Definition: miarm.h:208
VOID NTAPI MiReleaseSystemPtes(IN PMMPTE StartingPte, IN ULONG NumberOfPtes, IN MMSYSTEM_PTE_POOL_TYPE SystemPtePoolType)
Definition: syspte.c:264
VOID NTAPI MiDecrementShareCount(IN PMMPFN Pfn1, IN PFN_NUMBER PageFrameIndex)
Definition: pfnlist.c:1141
#define MiAddressToPte(x)
Definition: mmx86.c:19
#define PFN_FROM_PTE(v)
Definition: mm.h:92
FORCEINLINE PMMPFN MiGetPfnEntry(IN PFN_NUMBER Pfn)
Definition: mm.h:1054
ULONG MmMaximumDeadKernelStacks
Definition: procsup.c:21
Definition: mm.h:381
union _MMPFN::@1811 u4
ULONG_PTR PteFrame
Definition: mm.h:425
ULONG64 Valid
Definition: mmtypes.h:150
union _MMPTE::@2342 u
MMPTE_HARDWARE Hard
Definition: mmtypes.h:217
#define InterlockedPushEntrySList(SListHead, SListEntry)
Definition: rtlfuncs.h:3406

◆ MmDeleteProcessAddressSpace()

VOID NTAPI MmDeleteProcessAddressSpace ( IN PEPROCESS  Process)

Definition at line 1362 of file procsup.c.

1363{
1364 PMMPFN Pfn1, Pfn2;
1365 KIRQL OldIrql;
1366 PFN_NUMBER PageFrameIndex;
1367
1368#ifndef _M_AMD64
1370 RemoveEntryList(&Process->MmProcessLinks);
1372#endif
1373
1374 //ASSERT(Process->CommitCharge == 0);
1375
1376 /* Remove us from the list */
1378 if (Process->Vm.WorkingSetExpansionLinks.Flink != NULL)
1379 RemoveEntryList(&Process->Vm.WorkingSetExpansionLinks);
1381
1382 /* Acquire the PFN lock */
1383 OldIrql = MiAcquirePfnLock();
1384
1385 /* Check for fully initialized process */
1386 if (Process->AddressSpaceInitialized == 2)
1387 {
1388 /* Map the working set page and its page table */
1389 Pfn1 = MiGetPfnEntry(Process->WorkingSetPage);
1390 Pfn2 = MiGetPfnEntry(Pfn1->u4.PteFrame);
1391
1392 /* Nuke it */
1393 MI_SET_PFN_DELETED(Pfn1);
1394 MiDecrementShareCount(Pfn2, Pfn1->u4.PteFrame);
1395 MiDecrementShareCount(Pfn1, Process->WorkingSetPage);
1396 ASSERT((Pfn1->u3.e2.ReferenceCount == 0) || (Pfn1->u3.e1.WriteInProgress));
1397
1398 /* Now map hyperspace and its page table */
1399 PageFrameIndex = Process->Pcb.DirectoryTableBase[1] >> PAGE_SHIFT;
1400 Pfn1 = MiGetPfnEntry(PageFrameIndex);
1401 Pfn2 = MiGetPfnEntry(Pfn1->u4.PteFrame);
1402
1403 /* Nuke it */
1404 MI_SET_PFN_DELETED(Pfn1);
1405 MiDecrementShareCount(Pfn2, Pfn1->u4.PteFrame);
1406 MiDecrementShareCount(Pfn1, PageFrameIndex);
1407 ASSERT((Pfn1->u3.e2.ReferenceCount == 0) || (Pfn1->u3.e1.WriteInProgress));
1408
1409 /* Finally, nuke the PDE itself */
1410 PageFrameIndex = Process->Pcb.DirectoryTableBase[0] >> PAGE_SHIFT;
1411 Pfn1 = MiGetPfnEntry(PageFrameIndex);
1412 MI_SET_PFN_DELETED(Pfn1);
1413 MiDecrementShareCount(Pfn1, PageFrameIndex);
1414 MiDecrementShareCount(Pfn1, PageFrameIndex);
1415
1416 /* Page table is now dead. Bye bye... */
1417 ASSERT((Pfn1->u3.e2.ReferenceCount == 0) || (Pfn1->u3.e1.WriteInProgress));
1418 }
1419 else
1420 {
1421 DPRINT1("Deleting partially initialized address space of Process %p. Might leak resources.\n",
1422 Process);
1423 }
1424
1425 /* Release the PFN lock */
1426 MiReleasePfnLock(OldIrql);
1427
1428 /* Drop a reference on the session */
1430
1431 /* Clear out the PDE pages */
1432 Process->Pcb.DirectoryTableBase[0] = 0;
1433 Process->Pcb.DirectoryTableBase[1] = 0;
1434}
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
FORCEINLINE KIRQL MiAcquireExpansionLock(VOID)
Definition: miarm.h:1544
VOID NTAPI MiReleaseProcessReferenceToSessionDataPage(IN PMM_SESSION_SPACE SessionGlobal)
Definition: session.c:209
FORCEINLINE VOID MiReleaseExpansionLock(KIRQL OldIrql)
Definition: miarm.h:1557
USHORT WriteInProgress
Definition: mm.h:369
MMPFNENTRY e1
Definition: mm.h:404
struct _MMPFN::@1808::@1814 e2
union _MMPFN::@1808 u3

Referenced by PspDeleteProcess().

◆ MmDeleteTeb()

VOID NTAPI MmDeleteTeb ( IN PEPROCESS  Process,
IN PTEB  Teb 
)

Definition at line 122 of file procsup.c.

124{
125 ULONG_PTR TebEnd;
127 PMMVAD Vad;
128 PMM_AVL_TABLE VadTree = &Process->VadRoot;
129 DPRINT("Deleting TEB: %p in %16s\n", Teb, Process->ImageFileName);
130
131 /* TEB is one page */
132 TebEnd = (ULONG_PTR)Teb + ROUND_TO_PAGES(sizeof(TEB)) - 1;
133
134 /* Attach to the process */
136
137 /* Lock the process address space */
138 KeAcquireGuardedMutex(&Process->AddressCreationLock);
139
140 /* Find the VAD, make sure it's a TEB VAD */
141 Vad = MiLocateAddress(Teb);
142 DPRINT("Removing node for VAD: %lx %lx\n", Vad->StartingVpn, Vad->EndingVpn);
143 ASSERT(Vad != NULL);
144 if (Vad->StartingVpn != ((ULONG_PTR)Teb >> PAGE_SHIFT))
145 {
146 /* Bug in the AVL code? */
147 DPRINT1("Corrupted VAD!\n");
148 }
149 else
150 {
151 /* Sanity checks for a valid TEB VAD */
152 ASSERT((Vad->StartingVpn == ((ULONG_PTR)Teb >> PAGE_SHIFT) &&
153 (Vad->EndingVpn == (TebEnd >> PAGE_SHIFT))));
154 ASSERT(Vad->u.VadFlags.NoChange == TRUE);
157
158 /* Lock the working set */
160
161 /* Remove this VAD from the tree */
162 ASSERT(VadTree->NumberGenericTableElements >= 1);
163 MiRemoveNode((PMMADDRESS_NODE)Vad, VadTree);
164
165 /* Delete the pages */
167
168 /* Release the working set */
170
171 /* Remove the VAD */
172 ExFreePool(Vad);
173
174 /* Return the quota the VAD used */
176 }
177
178 /* Release the address space lock */
179 KeReleaseGuardedMutex(&Process->AddressCreationLock);
180
181 /* Detach */
183}
VOID FASTCALL KeReleaseGuardedMutex(IN OUT PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:53
VOID FASTCALL KeAcquireGuardedMutex(IN PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:42
PMMVAD NTAPI MiLocateAddress(IN PVOID VirtualAddress)
Definition: vadnode.c:116
ULONG MultipleSecured
Definition: mmtypes.h:709
MMVAD_FLAGS2 VadFlags2
Definition: mmtypes.h:742
union _MMVAD::@2632 u2

◆ MmGrowKernelStack()

NTSTATUS NTAPI MmGrowKernelStack ( IN PVOID  StackPointer)

Definition at line 477 of file procsup.c.

478{
479 //
480 // Call the extended version
481 //
483}
NTSTATUS NTAPI MmGrowKernelStackEx(IN PVOID StackPointer, IN ULONG GrowSize)
Definition: procsup.c:389

Referenced by KiUserModeCallout().

◆ MmGrowKernelStackEx()

NTSTATUS NTAPI MmGrowKernelStackEx ( IN PVOID  StackPointer,
IN ULONG  GrowSize 
)

Definition at line 389 of file procsup.c.

391{
393 PMMPTE LimitPte, NewLimitPte, LastPte;
395 MMPTE TempPte, InvalidPte;
396 PFN_NUMBER PageFrameIndex;
397
398 //
399 // Make sure the stack did not overflow
400 //
401 ASSERT(((ULONG_PTR)Thread->StackBase - (ULONG_PTR)Thread->StackLimit) <=
403
404 //
405 // Get the current stack limit
406 //
407 LimitPte = MiAddressToPte(Thread->StackLimit);
408 ASSERT(LimitPte->u.Hard.Valid == 1);
409
410 //
411 // Get the new one and make sure this isn't a retarded request
412 //
413 NewLimitPte = MiAddressToPte((PVOID)((ULONG_PTR)StackPointer - GrowSize));
414 if (NewLimitPte == LimitPte) return STATUS_SUCCESS;
415
416 //
417 // Now make sure you're not going past the reserved space
418 //
419 LastPte = MiAddressToPte((PVOID)((ULONG_PTR)Thread->StackBase -
421 if (NewLimitPte < LastPte)
422 {
423 //
424 // Sorry!
425 //
427 }
428
429 //
430 // Calculate the number of new pages
431 //
432 LimitPte--;
433
434 /* Setup the temporary invalid PTE */
435 MI_MAKE_SOFTWARE_PTE(&InvalidPte, MM_NOACCESS);
436
437 //
438 // Acquire the PFN DB lock
439 //
440 OldIrql = MiAcquirePfnLock();
441
442 //
443 // Loop each stack page
444 //
445 while (LimitPte >= NewLimitPte)
446 {
447 /* Get a page and write the current invalid PTE */
449 MI_SET_PROCESS2(PsGetCurrentProcess()->ImageFileName);
450 PageFrameIndex = MiRemoveAnyPage(MI_GET_NEXT_COLOR());
451 MI_WRITE_INVALID_PTE(LimitPte, InvalidPte);
452
453 /* Initialize the PFN entry for this page */
454 MiInitializePfn(PageFrameIndex, LimitPte, 1);
455
456 /* Setup the template stack PTE */
457 MI_MAKE_HARDWARE_PTE_KERNEL(&TempPte, LimitPte, MM_READWRITE, PageFrameIndex);
458
459 /* Write the valid PTE */
460 MI_WRITE_VALID_PTE(LimitPte--, TempPte);
461 }
462
463 //
464 // Release the PFN lock
465 //
466 MiReleasePfnLock(OldIrql);
467
468 //
469 // Set the new limit
470 //
471 Thread->StackLimit = (ULONG_PTR)MiPteToAddress(NewLimitPte);
472 return STATUS_SUCCESS;
473}
#define KeGetCurrentThread
Definition: hal.h:55
@ MI_USAGE_KERNEL_STACK_EXPANSION
Definition: mm.h:336
#define STATUS_STACK_OVERFLOW
Definition: ntstatus.h:489

Referenced by MmGrowKernelStack().

◆ MmInitializeHandBuiltProcess()

NTSTATUS NTAPI MmInitializeHandBuiltProcess ( IN PEPROCESS  Process,
IN PULONG_PTR  DirectoryTableBase 
)

Definition at line 1127 of file procsup.c.

1129{
1130 /* Share the directory base with the idle process */
1131 DirectoryTableBase[0] = PsGetCurrentProcess()->Pcb.DirectoryTableBase[0];
1132 DirectoryTableBase[1] = PsGetCurrentProcess()->Pcb.DirectoryTableBase[1];
1133
1134 /* Initialize the Addresss Space */
1135 KeInitializeGuardedMutex(&Process->AddressCreationLock);
1136 KeInitializeSpinLock(&Process->HyperSpaceLock);
1137 Process->Vm.WorkingSetExpansionLinks.Flink = NULL;
1138 ASSERT(Process->VadRoot.NumberGenericTableElements == 0);
1139 Process->VadRoot.BalancedRoot.u1.Parent = &Process->VadRoot.BalancedRoot;
1140
1141 /* Use idle process Working set */
1142 Process->Vm.VmWorkingSetList = PsGetCurrentProcess()->Vm.VmWorkingSetList;
1143 Process->WorkingSetPage = PsGetCurrentProcess()->WorkingSetPage;
1144
1145 /* Done */
1146 Process->HasAddressSpace = TRUE;//??
1147 return STATUS_SUCCESS;
1148}
VOID FASTCALL KeInitializeGuardedMutex(OUT PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:31

Referenced by PspCreateProcess().

◆ MmInitializeHandBuiltProcess2()

NTSTATUS NTAPI MmInitializeHandBuiltProcess2 ( IN PEPROCESS  Process)

Definition at line 1153 of file procsup.c.

1154{
1155 /* Lock the VAD, ARM3-owned ranges away */
1156 return STATUS_SUCCESS;
1157}

Referenced by PspCreateProcess().

◆ MmInitializeProcessAddressSpace()

NTSTATUS NTAPI MmInitializeProcessAddressSpace ( IN PEPROCESS  Process,
IN PEPROCESS ProcessClone  OPTIONAL,
IN PVOID Section  OPTIONAL,
IN OUT PULONG  Flags,
IN POBJECT_NAME_INFORMATION *AuditName  OPTIONAL 
)

Definition at line 932 of file procsup.c.

937{
939 SIZE_T ViewSize = 0;
940 PVOID ImageBase = 0;
941 PMMPTE PointerPte;
943 PMMPDE PointerPde;
944 PMMPFN Pfn;
945 PFN_NUMBER PageFrameNumber;
949 USHORT Length = 0;
950
951#if (_MI_PAGING_LEVELS >= 3)
952 PMMPPE PointerPpe;
953#endif
954#if (_MI_PAGING_LEVELS == 4)
955 PMMPXE PointerPxe;
956#endif
957
958 /* We should have a PDE */
959 ASSERT(Process->Pcb.DirectoryTableBase[0] != 0);
960 ASSERT(Process->PdeUpdateNeeded == FALSE);
961
962 /* Attach to the process */
964
965 /* The address space should now been in phase 1 or 0 */
966 ASSERT(Process->AddressSpaceInitialized <= 1);
967 Process->AddressSpaceInitialized = 2;
968
969 /* Initialize the Addresss Space lock */
970 KeInitializeGuardedMutex(&Process->AddressCreationLock);
971 Process->Vm.WorkingSetExpansionLinks.Flink = NULL;
972
973 /* Initialize AVL tree */
974 ASSERT(Process->VadRoot.NumberGenericTableElements == 0);
975 Process->VadRoot.BalancedRoot.u1.Parent = &Process->VadRoot.BalancedRoot;
976
977 /* Lock our working set */
979
980 /* Lock PFN database */
981 OldIrql = MiAcquirePfnLock();
982
983 /* Setup the PFN for the PDE base of this process */
984#if (_MI_PAGING_LEVELS == 4)
985 PointerPte = MiAddressToPte(PXE_BASE);
986#elif (_MI_PAGING_LEVELS == 3)
987 PointerPte = MiAddressToPte(PPE_BASE);
988#else
989 PointerPte = MiAddressToPte(PDE_BASE);
990#endif
991 PageFrameNumber = PFN_FROM_PTE(PointerPte);
992 ASSERT(Process->Pcb.DirectoryTableBase[0] == PageFrameNumber * PAGE_SIZE);
993 MiInitializePfn(PageFrameNumber, PointerPte, TRUE);
994
995 /* Do the same for hyperspace */
996 PointerPde = MiAddressToPde(HYPER_SPACE);
997 PageFrameNumber = PFN_FROM_PTE(PointerPde);
998 MiInitializePfn(PageFrameNumber, (PMMPTE)PointerPde, TRUE);
999#if (_MI_PAGING_LEVELS == 2)
1000 ASSERT(Process->Pcb.DirectoryTableBase[1] == PageFrameNumber * PAGE_SIZE);
1001#endif
1002
1003#if (_MI_PAGING_LEVELS >= 3)
1004 PointerPpe = MiAddressToPpe((PVOID)HYPER_SPACE);
1005 PageFrameNumber = PFN_FROM_PTE(PointerPpe);
1006 MiInitializePfn(PageFrameNumber, PointerPpe, TRUE);
1007#if (_MI_PAGING_LEVELS == 3)
1008 ASSERT(Process->Pcb.DirectoryTableBase[1] == PageFrameNumber * PAGE_SIZE);
1009#endif
1010#endif
1011#if (_MI_PAGING_LEVELS == 4)
1012 PointerPxe = MiAddressToPxe((PVOID)HYPER_SPACE);
1013 PageFrameNumber = PFN_FROM_PTE(PointerPxe);
1014 MiInitializePfn(PageFrameNumber, PointerPxe, TRUE);
1015 ASSERT(Process->Pcb.DirectoryTableBase[1] == PageFrameNumber * PAGE_SIZE);
1016#endif
1017
1018 /* Do the same for the Working set list */
1019 PointerPte = MiAddressToPte(MmWorkingSetList);
1020 PageFrameNumber = PFN_FROM_PTE(PointerPte);
1021 MiInitializePfn(PageFrameNumber, PointerPte, TRUE);
1022
1023 /* All our pages are now active & valid. Release the lock. */
1024 MiReleasePfnLock(OldIrql);
1025
1026 /* This should be in hyper space, but not in the mapping range */
1027 Process->Vm.VmWorkingSetList = MmWorkingSetList;
1029
1030 /* Now initialize the working set list */
1032
1033 /* The rule is that the owner process is always in the FLINK of the PDE's PFN entry */
1034 Pfn = MiGetPfnEntry(Process->Pcb.DirectoryTableBase[0] >> PAGE_SHIFT);
1035 ASSERT(Pfn->u4.PteFrame == MiGetPfnEntryIndex(Pfn));
1036 ASSERT(Pfn->u1.WsIndex == 0);
1037 Pfn->u1.Event = (PKEVENT)Process;
1038
1039 /* Sanity check */
1040 ASSERT(Process->PhysicalVadRoot == NULL);
1041
1042 /* Release the process working set */
1044
1045#ifdef _M_AMD64
1046 /* On x64 we need a VAD for the shared user page */
1047 Status = MiInsertSharedUserPageVad(Process);
1048 if (!NT_SUCCESS(Status))
1049 {
1050 DPRINT1("MiCreateSharedUserPageVad() failed: 0x%lx\n", Status);
1051 return Status;
1052 }
1053#endif
1054
1055 /* Check if there's a Section Object */
1056 if (Section)
1057 {
1058 /* Determine the image file name and save it to EPROCESS */
1060 FileName = FileObject->FileName;
1061 Source = (PWCHAR)((PCHAR)FileName.Buffer + FileName.Length);
1062 if (FileName.Buffer)
1063 {
1064 /* Loop the file name*/
1065 while (Source > FileName.Buffer)
1066 {
1067 /* Make sure this isn't a backslash */
1069 {
1070 /* If so, stop it here */
1071 Source++;
1072 break;
1073 }
1074 else
1075 {
1076 /* Otherwise, keep going */
1077 Length++;
1078 }
1079 }
1080 }
1081
1082 /* Copy the to the process and truncate it to 15 characters if necessary */
1083 Destination = Process->ImageFileName;
1084 Length = min(Length, sizeof(Process->ImageFileName) - 1);
1085 while (Length--) *Destination++ = (UCHAR)*Source++;
1087
1088 /* Check if caller wants an audit name */
1089 if (AuditName)
1090 {
1091 /* Setup the audit name */
1093 if (!NT_SUCCESS(Status))
1094 {
1095 /* Fail */
1097 return Status;
1098 }
1099 }
1100
1101 /* Map the section */
1102 Status = MmMapViewOfSection(Section,
1103 Process,
1104 (PVOID*)&ImageBase,
1105 0,
1106 0,
1107 NULL,
1108 &ViewSize,
1109 ViewUnmap,
1110 MEM_COMMIT,
1112
1113 /* Save the pointer */
1114 Process->SectionBaseAddress = ImageBase;
1115 }
1116
1117 /* Be nice and detach */
1119
1120 /* Return status to caller */
1121 return Status;
1122}
#define PDE_BASE
Definition: winldr.c:21
#define OBJ_NAME_PATH_SEPARATOR
Definition: arcname_tests.c:25
#define PKEVENT
Definition: env_spec_w32.h:70
struct _FileName FileName
Definition: fatprocs.h:897
FORCEINLINE VOID MiUnlockProcessWorkingSet(IN PEPROCESS Process, IN PETHREAD Thread)
Definition: miarm.h:1207
FORCEINLINE VOID MiLockProcessWorkingSet(IN PEPROCESS Process, IN PETHREAD Thread)
Definition: miarm.h:1137
#define MiAddressToPde(x)
Definition: mmx86.c:20
#define min(a, b)
Definition: monoChain.cc:55
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:3016
#define PAGE_READWRITE
Definition: nt_native.h:1304
@ ViewUnmap
Definition: nt_native.h:1279
#define MEM_COMMIT
Definition: nt_native.h:1313
#define ANSI_NULL
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
PMMWSL MmWorkingSetList
Definition: wslist.cpp:19
#define HYPER_SPACE
Definition: mm.h:14
#define MI_MAPPING_RANGE_END
Definition: mm.h:48
#define HYPER_SPACE_END
Definition: mm.h:15
FORCEINLINE PMMPTE MiAddressToPpe(PVOID Address)
Definition: mm.h:161
FORCEINLINE PMMPTE MiAddressToPxe(PVOID Address)
Definition: mm.h:171
PFILE_OBJECT NTAPI MmGetFileObjectForSection(IN PVOID Section)
Definition: section.c:1541
FORCEINLINE PFN_NUMBER MiGetPfnEntryIndex(IN PMMPFN Pfn1)
Definition: mm.h:1074
NTSTATUS NTAPI SeInitializeProcessAuditName(_In_ PFILE_OBJECT FileObject, _In_ BOOLEAN DoAudit, _Out_ POBJECT_NAME_INFORMATION *AuditInfo)
Initializes a process audit name and returns it to the caller.
Definition: audit.c:105
#define PXE_BASE
#define PPE_BASE
ULONG WsIndex
Definition: mm.h:385
union _MMPFN::@1806 u1
PKEVENT Event
Definition: mm.h:386
uint16_t * PWCHAR
Definition: typedefs.h:56
char * PCHAR
Definition: typedefs.h:51
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
_Use_decl_annotations_ VOID NTAPI MiInitializeWorkingSetList(_Inout_ PMMSUPPORT WorkingSet)
Definition: wslist.cpp:369
* PFILE_OBJECT
Definition: iotypes.h:1998
unsigned char UCHAR
Definition: xmlstorage.h:181

◆ MmSetMemoryPriorityProcess()

NTSTATUS NTAPI MmSetMemoryPriorityProcess ( IN PEPROCESS  Process,
IN UCHAR  MemoryPriority 
)

Definition at line 487 of file procsup.c.

489{
490 UCHAR OldPriority;
491
492 //
493 // Check if we have less then 16MB of Physical Memory
494 //
495 if ((MmSystemSize == MmSmallSystem) &&
496 (MmNumberOfPhysicalPages < ((15 * 1024 * 1024) / PAGE_SIZE)))
497 {
498 //
499 // Always use background priority
500 //
501 MemoryPriority = MEMORY_PRIORITY_BACKGROUND;
502 }
503
504 //
505 // Save the old priority and update it
506 //
507 OldPriority = (UCHAR)Process->Vm.Flags.MemoryPriority;
508 Process->Vm.Flags.MemoryPriority = MemoryPriority;
509
510 //
511 // Return the old priority
512 //
513 return OldPriority;
514}
#define MEMORY_PRIORITY_BACKGROUND
Definition: pstypes.h:125
MM_SYSTEMSIZE MmSystemSize
Definition: mminit.c:326
PFN_COUNT MmNumberOfPhysicalPages
Definition: init.c:48
@ MmSmallSystem
Definition: mmtypes.h:145

Referenced by NtSetInformationProcess(), and PspComputeQuantumAndPriority().

◆ NtAllocateUserPhysicalPages()

NTSTATUS NTAPI NtAllocateUserPhysicalPages ( IN HANDLE  ProcessHandle,
IN OUT PULONG_PTR  NumberOfPages,
IN OUT PULONG_PTR  UserPfnArray 
)

Definition at line 1441 of file procsup.c.

1444{
1447}
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
#define STATUS_NOT_IMPLEMENTED
Definition: d3dkmdt.h:42

Referenced by AllocateUserPhysicalPages().

◆ NtFreeUserPhysicalPages()

NTSTATUS NTAPI NtFreeUserPhysicalPages ( IN HANDLE  ProcessHandle,
IN OUT PULONG_PTR  NumberOfPages,
IN OUT PULONG_PTR  UserPfnArray 
)

Definition at line 1471 of file procsup.c.

1474{
1477}

Referenced by FreeUserPhysicalPages().

◆ NtMapUserPhysicalPages()

NTSTATUS NTAPI NtMapUserPhysicalPages ( IN PVOID  VirtualAddresses,
IN ULONG_PTR  NumberOfPages,
IN OUT PULONG_PTR  UserPfnArray 
)

Definition at line 1451 of file procsup.c.

1454{
1457}

Referenced by MapUserPhysicalPages().

◆ NtMapUserPhysicalPagesScatter()

NTSTATUS NTAPI NtMapUserPhysicalPagesScatter ( IN PVOID VirtualAddresses,
IN ULONG_PTR  NumberOfPages,
IN OUT PULONG_PTR  UserPfnArray 
)

Definition at line 1461 of file procsup.c.

1464{
1467}

Referenced by MapUserPhysicalPagesScatter().

Variable Documentation

◆ MmDeadStackSListHead

SLIST_HEADER MmDeadStackSListHead

Definition at line 22 of file procsup.c.

Referenced by MmArmInitSystem(), MmCreateKernelStack(), and MmDeleteKernelStack().

◆ MmMaximumDeadKernelStacks

ULONG MmMaximumDeadKernelStacks = 5

Definition at line 21 of file procsup.c.

Referenced by MmArmInitSystem(), and MmDeleteKernelStack().

◆ MmProcessColorSeed

ULONG MmProcessColorSeed = 0x12345678

Definition at line 20 of file procsup.c.

Referenced by MmCreateProcessAddressSpace().

◆ MmRotatingUniprocessorNumber

ULONG MmRotatingUniprocessorNumber = 0

Definition at line 23 of file procsup.c.

Referenced by MmCreatePeb().