[ros-diffs] [ros-arm-bringup] 41507: - Add another helper: MiGetPfnEntryIndex. This returns the page frame number (PFN) for a given MMPFN entry. - Also add MiPteToAddress to complement MiAddressToPte. This returns the VA for a given PTE. Bonus points if you can figure out the bit magic.

ros-arm-bringup at svn.reactos.org ros-arm-bringup at svn.reactos.org
Sun Jun 21 06:28:32 CEST 2009


Author: ros-arm-bringup
Date: Sun Jun 21 08:28:31 2009
New Revision: 41507

URL: http://svn.reactos.org/svn/reactos?rev=41507&view=rev
Log:
- Add another helper: MiGetPfnEntryIndex. This returns the page frame number (PFN) for a given MMPFN entry.
- Also add MiPteToAddress to complement MiAddressToPte. This returns the VA for a given PTE. Bonus points if you can figure out the bit magic.


Modified:
    trunk/reactos/ntoskrnl/include/internal/i386/mm.h
    trunk/reactos/ntoskrnl/include/internal/mm.h

Modified: trunk/reactos/ntoskrnl/include/internal/i386/mm.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/i386/mm.h?rev=41507&r1=41506&r2=41507&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/i386/mm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/i386/mm.h [iso-8859-1] Sun Jun 21 08:28:31 2009
@@ -23,6 +23,11 @@
 #define MiAddressToPteOffset(x) \
     ((((ULONG)(x)) << 10) >> 22)
 
+//
+// Convert a PTE into a corresponding address
+//
+#define MiPteToAddress(PTE) ((PVOID)((ULONG)(PTE) << 10))
+
 #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)

Modified: trunk/reactos/ntoskrnl/include/internal/mm.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/mm.h?rev=41507&r1=41506&r2=41507&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] Sun Jun 21 08:28:31 2009
@@ -1050,6 +1050,16 @@
     return Page;
 };
 
+FORCEINLINE
+PFN_NUMBER
+MiGetPfnEntryIndex(IN PMMPFN Pfn1)
+{
+    //
+    // This will return the Page Frame Number (PFN) from the MMPFN
+    //
+    return Pfn1 - MmPfnDatabase;
+}
+
 PFN_TYPE
 NTAPI
 MmGetLRUNextUserPage(PFN_TYPE PreviousPage);



More information about the Ros-diffs mailing list