mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 21:53:06 +00:00
[NTOS:MM:X64] Handle PPEs and PXEs as well in MmInitializeProcessAddressSpace()
But don't set up the PFNs for the initial process on x64, as these have already been set up.
This commit is contained in:
parent
48d1bd2c88
commit
0726cfce10
1 changed files with 30 additions and 6 deletions
|
@ -951,6 +951,12 @@ MmInitializeProcessAddressSpace(IN PEPROCESS Process,
|
||||||
PCHAR Destination;
|
PCHAR Destination;
|
||||||
USHORT Length = 0;
|
USHORT Length = 0;
|
||||||
MMPTE TempPte;
|
MMPTE TempPte;
|
||||||
|
#if (_MI_PAGING_LEVELS >= 3)
|
||||||
|
PMMPPE PointerPpe;
|
||||||
|
#endif
|
||||||
|
#if (_MI_PAGING_LEVELS == 4)
|
||||||
|
PMMPXE PointerPxe;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* We should have a PDE */
|
/* We should have a PDE */
|
||||||
ASSERT(Process->Pcb.DirectoryTableBase[0] != 0);
|
ASSERT(Process->Pcb.DirectoryTableBase[0] != 0);
|
||||||
|
@ -971,12 +977,19 @@ MmInitializeProcessAddressSpace(IN PEPROCESS Process,
|
||||||
ASSERT(Process->VadRoot.NumberGenericTableElements == 0);
|
ASSERT(Process->VadRoot.NumberGenericTableElements == 0);
|
||||||
Process->VadRoot.BalancedRoot.u1.Parent = &Process->VadRoot.BalancedRoot;
|
Process->VadRoot.BalancedRoot.u1.Parent = &Process->VadRoot.BalancedRoot;
|
||||||
|
|
||||||
|
#ifdef _M_AMD64
|
||||||
|
/* On x64 the PFNs for the initial process are already set up */
|
||||||
|
if (Process != &KiInitialProcess) {
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Lock PFN database */
|
/* Lock PFN database */
|
||||||
OldIrql = MiAcquirePfnLock();
|
OldIrql = MiAcquirePfnLock();
|
||||||
|
|
||||||
/* Setup the PFN for the PDE base of this process */
|
/* Setup the PFN for the PDE base of this process */
|
||||||
#ifdef _M_AMD64
|
#if (_MI_PAGING_LEVELS == 4)
|
||||||
PointerPte = MiAddressToPte(PXE_BASE);
|
PointerPte = MiAddressToPte(PXE_BASE);
|
||||||
|
#elif (_MI_PAGING_LEVELS == 3)
|
||||||
|
PointerPte = MiAddressToPte(PPE_BASE);
|
||||||
#else
|
#else
|
||||||
PointerPte = MiAddressToPte(PDE_BASE);
|
PointerPte = MiAddressToPte(PDE_BASE);
|
||||||
#endif
|
#endif
|
||||||
|
@ -985,15 +998,22 @@ MmInitializeProcessAddressSpace(IN PEPROCESS Process,
|
||||||
MiInitializePfn(PageFrameNumber, PointerPte, TRUE);
|
MiInitializePfn(PageFrameNumber, PointerPte, TRUE);
|
||||||
|
|
||||||
/* Do the same for hyperspace */
|
/* Do the same for hyperspace */
|
||||||
#ifdef _M_AMD64
|
PointerPde = MiAddressToPde((PVOID)HYPER_SPACE);
|
||||||
PointerPde = MiAddressToPxe((PVOID)HYPER_SPACE);
|
|
||||||
#else
|
|
||||||
PointerPde = MiAddressToPde(HYPER_SPACE);
|
|
||||||
#endif
|
|
||||||
PageFrameNumber = PFN_FROM_PTE(PointerPde);
|
PageFrameNumber = PFN_FROM_PTE(PointerPde);
|
||||||
//ASSERT(Process->Pcb.DirectoryTableBase[0] == PageFrameNumber * PAGE_SIZE); // we're not lucky
|
//ASSERT(Process->Pcb.DirectoryTableBase[0] == PageFrameNumber * PAGE_SIZE); // we're not lucky
|
||||||
MiInitializePfn(PageFrameNumber, (PMMPTE)PointerPde, TRUE);
|
MiInitializePfn(PageFrameNumber, (PMMPTE)PointerPde, TRUE);
|
||||||
|
|
||||||
|
#if (_MI_PAGING_LEVELS >= 3)
|
||||||
|
PointerPpe = MiAddressToPpe((PVOID)HYPER_SPACE);
|
||||||
|
PageFrameNumber = PFN_FROM_PTE(PointerPpe);
|
||||||
|
MiInitializePfn(PageFrameNumber, PointerPpe, TRUE);
|
||||||
|
#endif
|
||||||
|
#if (_MI_PAGING_LEVELS == 4)
|
||||||
|
PointerPxe = MiAddressToPxe((PVOID)HYPER_SPACE);
|
||||||
|
PageFrameNumber = PFN_FROM_PTE(PointerPxe);
|
||||||
|
MiInitializePfn(PageFrameNumber, PointerPxe, TRUE);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Setup the PFN for the PTE for the working set */
|
/* Setup the PFN for the PTE for the working set */
|
||||||
PointerPte = MiAddressToPte(MI_WORKING_SET_LIST);
|
PointerPte = MiAddressToPte(MI_WORKING_SET_LIST);
|
||||||
MI_MAKE_HARDWARE_PTE(&TempPte, PointerPte, MM_READWRITE, 0);
|
MI_MAKE_HARDWARE_PTE(&TempPte, PointerPte, MM_READWRITE, 0);
|
||||||
|
@ -1013,6 +1033,10 @@ MmInitializeProcessAddressSpace(IN PEPROCESS Process,
|
||||||
/* Release PFN lock */
|
/* Release PFN lock */
|
||||||
MiReleasePfnLock(OldIrql);
|
MiReleasePfnLock(OldIrql);
|
||||||
|
|
||||||
|
#ifdef _M_AMD64
|
||||||
|
} /* On x64 the PFNs for the initial process are already set up */
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _M_AMD64
|
#ifdef _M_AMD64
|
||||||
/* On x64 we need a VAD for the shared user page */
|
/* On x64 we need a VAD for the shared user page */
|
||||||
Status = MiInsertSharedUserPageVad();
|
Status = MiInsertSharedUserPageVad();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue