mirror of
https://github.com/reactos/reactos.git
synced 2025-04-27 17:10:22 +00:00
- 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. svn path=/trunk/; revision=41507
This commit is contained in:
parent
6464056a16
commit
7afb3ea904
2 changed files with 15 additions and 0 deletions
|
@ -23,6 +23,11 @@ PULONG MmGetPageDirectory(VOID);
|
|||
#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)
|
||||
|
|
|
@ -1050,6 +1050,16 @@ MiGetPfnEntry(IN PFN_TYPE Pfn)
|
|||
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);
|
||||
|
|
Loading…
Reference in a new issue