[NTOS] Fix x64 definition of MMPFN

Adjust the definition of COLORED_LIST_HEAD to always match the new MI_PFN_BITS define.
This commit is contained in:
Timo Kreuzer 2022-12-07 20:50:34 +02:00
parent b02dd8eb22
commit 7f2ed4d02f
2 changed files with 15 additions and 12 deletions

View file

@ -369,6 +369,12 @@ typedef struct _MMPFNENTRY
USHORT ParityError:1;
} MMPFNENTRY;
#ifdef _WIN64
#define MI_PFN_BITS 57
#else
#define MI_PFN_BITS 25
#endif
// Mm internal
typedef struct _MMPFN
{
@ -402,6 +408,9 @@ typedef struct _MMPFN
USHORT ShortFlags;
} e2;
} u3;
#ifdef _WIN64
ULONG UsedPageTableEntries;
#endif
union
{
MMPTE OriginalPte;
@ -415,7 +424,7 @@ typedef struct _MMPFN
ULONG_PTR EntireFrame;
struct
{
ULONG_PTR PteFrame:25;
ULONG_PTR PteFrame : MI_PFN_BITS;
ULONG_PTR InPageError:1;
ULONG_PTR VerifierAllocation:1;
ULONG_PTR AweAllocation:1;

View file

@ -206,24 +206,18 @@ extern const ULONG MmProtectToValue[32];
//
#define MI_INITIAL_SESSION_IDS 64
#if defined(_M_IX86) || defined(_M_ARM)
//
// PFN List Sentinel
//
#ifdef _WIN64
#define LIST_HEAD 0xFFFFFFFFFFFFFFFFLL
#else
#define LIST_HEAD 0xFFFFFFFF
#endif
//
// Because GCC cannot automatically downcast 0xFFFFFFFF to lesser-width bits,
// we need a manual definition suited to the number of bits in the PteFrame.
// This is used as a LIST_HEAD for the colored list
//
#define COLORED_LIST_HEAD ((1 << 25) - 1) // 0x1FFFFFF
#elif defined(_M_AMD64)
#define LIST_HEAD 0xFFFFFFFFFFFFFFFFLL
#define COLORED_LIST_HEAD ((1ULL << 57) - 1) // 0x1FFFFFFFFFFFFFFLL
#else
#error Define these please!
#endif
#define COLORED_LIST_HEAD (((ULONG_PTR)1 << MI_PFN_BITS) - 1)
//
// Returns the color of a page