mirror of
https://github.com/reactos/reactos.git
synced 2024-09-29 22:16:01 +00:00
[NTOS:MM] Make MiIsEntireRangeCommitted 64-bits aware
This commit is contained in:
parent
8bfba59b3e
commit
3aa346c21f
|
@ -2008,19 +2008,87 @@ MiIsEntireRangeCommitted(IN ULONG_PTR StartingAddress,
|
||||||
{
|
{
|
||||||
PMMPTE PointerPte, LastPte;
|
PMMPTE PointerPte, LastPte;
|
||||||
PMMPDE PointerPde;
|
PMMPDE PointerPde;
|
||||||
BOOLEAN OnBoundary = TRUE;
|
BOOLEAN OnPdeBoundary = TRUE;
|
||||||
|
#if _MI_PAGING_LEVELS >= 3
|
||||||
|
PMMPPE PointerPpe;
|
||||||
|
BOOLEAN OnPpeBoundary = TRUE;
|
||||||
|
#if _MI_PAGING_LEVELS == 4
|
||||||
|
PMMPXE PointerPxe;
|
||||||
|
BOOLEAN OnPxeBoundary = TRUE;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
/* Get the PDE and PTE addresses */
|
/* Check that we hols the right locks */
|
||||||
PointerPde = MiAddressToPde(StartingAddress);
|
ASSERT(PsGetCurrentThread()->OwnsProcessWorkingSetExclusive || PsGetCurrentThread()->OwnsProcessWorkingSetShared);
|
||||||
|
|
||||||
|
/* Get the PTE addresses */
|
||||||
PointerPte = MiAddressToPte(StartingAddress);
|
PointerPte = MiAddressToPte(StartingAddress);
|
||||||
LastPte = MiAddressToPte(EndingAddress);
|
LastPte = MiAddressToPte(EndingAddress);
|
||||||
|
|
||||||
/* Loop all the PTEs */
|
/* Loop all the PTEs */
|
||||||
while (PointerPte <= LastPte)
|
while (PointerPte <= LastPte)
|
||||||
{
|
{
|
||||||
/* Check if we've hit an new PDE boundary */
|
#if _MI_PAGING_LEVELS == 4
|
||||||
if (OnBoundary)
|
/* Check for new PXE boundary */
|
||||||
|
if (OnPxeBoundary)
|
||||||
|
{
|
||||||
|
PointerPxe = MiPteToPxe(PointerPte);
|
||||||
|
|
||||||
|
/* Check that this loop is sane */
|
||||||
|
ASSERT(OnPpeBoundary);
|
||||||
|
ASSERT(OnPdeBoundary);
|
||||||
|
|
||||||
|
if (PointerPxe->u.Long != 0)
|
||||||
|
{
|
||||||
|
/* Make it valid if needed */
|
||||||
|
if (PointerPxe->u.Hard.Valid == 0)
|
||||||
|
MiMakeSystemAddressValid(MiPteToPpe(PointerPte), Process);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Is the entire VAD committed? If not, fail */
|
||||||
|
if (!Vad->u.VadFlags.MemCommit) return FALSE;
|
||||||
|
|
||||||
|
PointerPxe++;
|
||||||
|
PointerPte = MiPxeToPte(PointerPte);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if _MI_PAGING_LEVELS >= 3
|
||||||
|
/* Check for new PPE boundary */
|
||||||
|
if (OnPpeBoundary)
|
||||||
|
{
|
||||||
|
PointerPpe = MiPteToPpe(PointerPte);
|
||||||
|
|
||||||
|
/* Check that this loop is sane */
|
||||||
|
ASSERT(OnPdeBoundary);
|
||||||
|
|
||||||
|
if (PointerPpe->u.Long != 0)
|
||||||
|
{
|
||||||
|
/* Make it valid if needed */
|
||||||
|
if (PointerPpe->u.Hard.Valid == 0)
|
||||||
|
MiMakeSystemAddressValid(MiPteToPde(PointerPte), Process);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Is the entire VAD committed? If not, fail */
|
||||||
|
if (!Vad->u.VadFlags.MemCommit) return FALSE;
|
||||||
|
|
||||||
|
PointerPpe++;
|
||||||
|
PointerPte = MiPpeToPte(PointerPpe);
|
||||||
|
#if _MI_PAGING_LEVELS == 4
|
||||||
|
OnPxeBoundary = MiIsPteOnPxeBoundary(PointerPte);
|
||||||
|
#endif
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
/* Check if we've hit a new PDE boundary */
|
||||||
|
if (OnPdeBoundary)
|
||||||
{
|
{
|
||||||
/* Is this PDE demand zero? */
|
/* Is this PDE demand zero? */
|
||||||
PointerPde = MiPteToPde(PointerPte);
|
PointerPde = MiPteToPde(PointerPte);
|
||||||
|
@ -2035,12 +2103,18 @@ MiIsEntireRangeCommitted(IN ULONG_PTR StartingAddress,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* Is the entire VAD committed? If not, fail */
|
||||||
|
if (!Vad->u.VadFlags.MemCommit) return FALSE;
|
||||||
|
|
||||||
/* The PTE was already valid, so move to the next one */
|
/* The PTE was already valid, so move to the next one */
|
||||||
PointerPde++;
|
PointerPde++;
|
||||||
PointerPte = MiPdeToPte(PointerPde);
|
PointerPte = MiPdeToPte(PointerPde);
|
||||||
|
#if _MI_PAGING_LEVELS >= 3
|
||||||
/* Is the entire VAD committed? If not, fail */
|
OnPpeBoundary = MiIsPteOnPpeBoundary(PointerPte);
|
||||||
if (!Vad->u.VadFlags.MemCommit) return FALSE;
|
#if _MI_PAGING_LEVELS == 4
|
||||||
|
OnPxeBoundary = MiIsPteOnPxeBoundary(PointerPte);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* New loop iteration with our new, on-boundary PTE. */
|
/* New loop iteration with our new, on-boundary PTE. */
|
||||||
continue;
|
continue;
|
||||||
|
@ -2068,7 +2142,13 @@ MiIsEntireRangeCommitted(IN ULONG_PTR StartingAddress,
|
||||||
|
|
||||||
/* Move to the next PTE */
|
/* Move to the next PTE */
|
||||||
PointerPte++;
|
PointerPte++;
|
||||||
OnBoundary = MiIsPteOnPdeBoundary(PointerPte);
|
OnPdeBoundary = MiIsPteOnPdeBoundary(PointerPte);
|
||||||
|
#if _MI_PAGING_LEVELS >= 3
|
||||||
|
OnPpeBoundary = MiIsPteOnPpeBoundary(PointerPte);
|
||||||
|
#if _MI_PAGING_LEVELS == 4
|
||||||
|
OnPxeBoundary = MiIsPteOnPxeBoundary(PointerPte);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* All PTEs seem valid, and no VAD checks failed, the range is okay */
|
/* All PTEs seem valid, and no VAD checks failed, the range is okay */
|
||||||
|
|
Loading…
Reference in a new issue