mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 08:25:48 +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) \
|
#define MiAddressToPteOffset(x) \
|
||||||
((((ULONG)(x)) << 10) >> 22)
|
((((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_PAGE_TABLE(v) (((ULONG)(v)) / (1024 * PAGE_SIZE))
|
||||||
#define ADDR_TO_PDE_OFFSET(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_PTE_OFFSET(v) ((((ULONG)(v)) % (1024 * PAGE_SIZE)) / PAGE_SIZE)
|
||||||
|
|
|
@ -1050,6 +1050,16 @@ MiGetPfnEntry(IN PFN_TYPE Pfn)
|
||||||
return Page;
|
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
|
PFN_TYPE
|
||||||
NTAPI
|
NTAPI
|
||||||
MmGetLRUNextUserPage(PFN_TYPE PreviousPage);
|
MmGetLRUNextUserPage(PFN_TYPE PreviousPage);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue