ReactOS 0.4.16-dev-197-g92996da
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

BOOLEAN MiArchCreateProcessAddressSpace (_In_ PEPROCESS Process, _In_ PULONG_PTR DirectoryTableBase)
 

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

◆ MiArchCreateProcessAddressSpace()

BOOLEAN MiArchCreateProcessAddressSpace ( _In_ PEPROCESS  Process,
_In_ PULONG_PTR  DirectoryTableBase 
)

Definition at line 19 of file procsup.c.

22{
23 PFN_NUMBER PdeIndex = DirectoryTableBase[0] >> PAGE_SHIFT;
24 PFN_NUMBER HyperIndex = DirectoryTableBase[1] >> PAGE_SHIFT;
25 PMMPTE PointerPte;
26 MMPTE PdePte, TempPte;
27 PMMPTE PteTable;
28 ULONG PdeOffset;
30
31 /* Get a PTE */
32 PointerPte = MiReserveSystemPtes(1, SystemPteSpace);
33 if (!PointerPte)
34 return FALSE;
35 PteTable = MiPteToAddress(PointerPte);
36
37 /* Build a page table for hyper space */
39 PointerPte,
41 HyperIndex);
42
43 /* Set it dirty and map it */
44 MI_MAKE_DIRTY_PAGE(&PdePte);
45 MI_WRITE_VALID_PTE(PointerPte, PdePte);
46
47 /* Now write the PTE/PDE entry for the working set list index itself */
49 TempPte.u.Hard.PageFrameNumber = Process->WorkingSetPage;
51 PteTable[PdeOffset] = TempPte;
52
53 /* Now we map the page directory */
55 PointerPte,
57 PdeIndex);
58
59 /* Set it dirty and map it */
60 MI_MAKE_DIRTY_PAGE(&PdePte);
61 *PointerPte = PdePte;
62 /* We changed the page! */
63 __invlpg(PteTable);
64
65 /* Now get the page directory (which we'll double map, so call it a page table) */
66 PteTable = MiPteToAddress(PointerPte);
67
68 /* Copy all the kernel mappings */
70 RtlCopyMemory(&PteTable[PdeOffset],
72 PAGE_SIZE - PdeOffset * sizeof(MMPTE));
73
74 /* Now write the PTE/PDE entry for hyperspace itself */
76 TempPte.u.Hard.PageFrameNumber = HyperIndex;
77 PdeOffset = MiGetPdeOffset(HYPER_SPACE);
78 PteTable[PdeOffset] = TempPte;
79
80 /* Sanity check */
81 PdeOffset++;
83
84 /* Now do the x86 trick of making the PDE a page table itself */
85 PdeOffset = MiGetPdeOffset(PTE_BASE);
86 TempPte.u.Hard.PageFrameNumber = PdeIndex;
87 PteTable[PdeOffset] = TempPte;
88
89 /* Let go of the system PTE */
90 MiReleaseSystemPtes(PointerPte, 1, SystemPteSpace);
91
92 /* Insert us into the Mm process list */
94 InsertTailList(&MmProcessList, &Process->MmProcessLinks);
96
97 return TRUE;
98}
HARDWARE_PTE_ARMV6 TempPte
Definition: winldr.c:76
#define MM_READWRITE
Definition: bootanim.c:19
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define InsertTailList(ListHead, Entry)
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define PAGE_SHIFT
Definition: env_spec_w32.h:45
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:223
__INTRIN_INLINE void __invlpg(void *Address)
Definition: intrin_x86.h:1968
LIST_ENTRY MmProcessList
Definition: largepag.c:20
@ SystemPteSpace
Definition: miarm.h:403
FORCEINLINE KIRQL MiAcquireExpansionLock(VOID)
Definition: miarm.h:1531
VOID NTAPI MiReleaseSystemPtes(IN PMMPTE StartingPte, IN ULONG NumberOfPtes, IN MMSYSTEM_PTE_POOL_TYPE SystemPtePoolType)
Definition: syspte.c:264
FORCEINLINE VOID MI_MAKE_HARDWARE_PTE_KERNEL(IN PMMPTE NewPte, IN PMMPTE MappingPte, IN ULONG_PTR ProtectionMask, IN PFN_NUMBER PageFrameNumber)
Definition: miarm.h:773
FORCEINLINE VOID MiReleaseExpansionLock(KIRQL OldIrql)
Definition: miarm.h:1544
PMMPTE NTAPI MiReserveSystemPtes(IN ULONG NumberOfPtes, IN MMSYSTEM_PTE_POOL_TYPE SystemPtePoolType)
Definition: syspte.c:246
FORCEINLINE VOID MI_WRITE_VALID_PTE(IN PMMPTE PointerPte, IN MMPTE TempPte)
Definition: miarm.h:959
#define MiAddressToPteOffset(x)
Definition: mmx86.c:21
#define PTE_BASE
Definition: mmx86.c:14
#define MiAddressToPde(x)
Definition: mmx86.c:20
#define ASSERT(a)
Definition: mode.c:44
PMMWSL MmWorkingSetList
Definition: wslist.cpp:19
#define HYPER_SPACE
Definition: mm.h:14
#define MiGetPdeOffset(x)
Definition: mm.h:195
#define MmSystemRangeStart
Definition: mm.h:32
#define MI_MAKE_DIRTY_PAGE(x)
Definition: mm.h:98
#define MiPteToAddress(_Pte)
Definition: mm.h:116
PVOID MmHyperSpaceEnd
Definition: init.c:56
MMPTE ValidKernelPteLocal
Definition: init.c:33
ULONG PFN_NUMBER
Definition: ke.h:9
ULONG PageFrameNumber
Definition: mmtypes.h:109
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG
Definition: typedefs.h:59
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778