[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:
Timo Kreuzer 2011-01-22 09:43:52 +00:00
parent e62f89f35b
commit a89924e2bd
3 changed files with 9 additions and 7 deletions

View file

@ -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

View file

@ -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;
//

View file

@ -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);
}