mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 04:13:34 +00:00
[NTOSKRNL]
MiAddressToPte translates a virtual address to the corresponding PTE, MiAddressToPde to the corresponding PDE. MiPteToAddress is the inverse of MiAddressToPte and translates from a PTE to the virtual address. MiPdeToAddress broke this scheme and didn't calculate the corresponding virtual adress, but the adress of the page table. Fix this inconsistency by renaming the macro to MiPdeToPte and adding a fixed MiPdeToAddress. All references fixed accordingly. svn path=/trunk/; revision=50458
This commit is contained in:
@@ -39,11 +39,13 @@ PULONG MmGetPageDirectory(VOID);
|
||||
// Convert a PTE into a corresponding address
|
||||
//
|
||||
#define MiPteToAddress(PTE) ((PVOID)((ULONG)(PTE) << 10))
|
||||
#define MiPdeToAddress(PDE) ((PVOID)((ULONG)(PDE) << 10))
|
||||
#define MiPdeToAddress(PDE) ((PVOID)((ULONG)(PDE) << 20))
|
||||
#define MiPdeToPte(PDE) ((PMMPTE)MiPteToAddress(PDE))
|
||||
#define MiPteToPde(PTE) ((PMMPDE)MiAddressToPte(PTE))
|
||||
|
||||
#define ADDR_TO_PAGE_TABLE(v) (((ULONG)(v)) / (1024 * PAGE_SIZE))
|
||||
#define ADDR_TO_PDE_OFFSET(v) ((((ULONG)(v)) / (1024 * PAGE_SIZE)))
|
||||
#define ADDR_TO_PTE_OFFSET(v) ((((ULONG)(v)) % (1024 * PAGE_SIZE)) / PAGE_SIZE)
|
||||
#define ADDR_TO_PAGE_TABLE(v) (((ULONG)(v)) / (1024 * PAGE_SIZE))
|
||||
#define ADDR_TO_PDE_OFFSET(v) (((ULONG)(v)) / (1024 * PAGE_SIZE))
|
||||
#define ADDR_TO_PTE_OFFSET(v) ((((ULONG)(v)) % (1024 * PAGE_SIZE)) / PAGE_SIZE)
|
||||
|
||||
#define MiGetPdeOffset ADDR_TO_PDE_OFFSET
|
||||
|
||||
|
||||
@@ -463,7 +463,7 @@ MiAllocatePoolPages(IN POOL_TYPE PoolType,
|
||||
// Get the first PTE in expansion space
|
||||
//
|
||||
PointerPde = MmPagedPoolInfo.NextPdeForPagedPoolExpansion;
|
||||
BaseVa = MiPdeToAddress(PointerPde);
|
||||
BaseVa = MiPdeToPte(PointerPde);
|
||||
BaseVaStart = BaseVa;
|
||||
|
||||
//
|
||||
|
||||
@@ -1127,7 +1127,7 @@ MiQueryAddressState(IN PVOID Va,
|
||||
if (!PointerPde->u.Long)
|
||||
{
|
||||
/* No address in this range used yet, move to the next PDE range */
|
||||
*NextVa = MiPteToAddress(MiPdeToAddress(PointerPde + 1));
|
||||
*NextVa = MiPdeToAddress(PointerPde + 1);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1135,7 +1135,7 @@ MiQueryAddressState(IN PVOID Va,
|
||||
if (!PointerPde->u.Hard.Valid)
|
||||
{
|
||||
/* It isn't, go ahead and do the fault */
|
||||
LockChange = MiMakeSystemAddressValid(MiPdeToAddress(PointerPde),
|
||||
LockChange = MiMakeSystemAddressValid(MiPdeToPte(PointerPde),
|
||||
TargetProcess);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user