Author: tkreuzer
Date: Sat Jan 22 09:43:52 2011
New Revision: 50458
URL:
http://svn.reactos.org/svn/reactos?rev=50458&view=rev
Log:
[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.
Modified:
trunk/reactos/ntoskrnl/include/internal/i386/mm.h
trunk/reactos/ntoskrnl/mm/ARM3/pool.c
trunk/reactos/ntoskrnl/mm/ARM3/virtual.c
Modified: trunk/reactos/ntoskrnl/include/internal/i386/mm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/i386/mm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/i386/mm.h [iso-8859-1] Sat Jan 22 09:43:52
2011
@@ -39,11 +39,13 @@
// 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
Modified: trunk/reactos/ntoskrnl/mm/ARM3/pool.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/pool.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/pool.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/pool.c [iso-8859-1] Sat Jan 22 09:43:52 2011
@@ -463,7 +463,7 @@
// Get the first PTE in expansion space
//
PointerPde = MmPagedPoolInfo.NextPdeForPagedPoolExpansion;
- BaseVa = MiPdeToAddress(PointerPde);
+ BaseVa = MiPdeToPte(PointerPde);
BaseVaStart = BaseVa;
//
Modified: trunk/reactos/ntoskrnl/mm/ARM3/virtual.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/virtual.c…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/virtual.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/virtual.c [iso-8859-1] Sat Jan 22 09:43:52 2011
@@ -1127,7 +1127,7 @@
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 @@
if (!PointerPde->u.Hard.Valid)
{
/* It isn't, go ahead and do the fault */
- LockChange = MiMakeSystemAddressValid(MiPdeToAddress(PointerPde),
+ LockChange = MiMakeSystemAddressValid(MiPdeToPte(PointerPde),
TargetProcess);
}