Skip to content

Instantly share code, notes, and snippets.

@mvankuipers
Created July 7, 2017 23:34
Show Gist options
  • Save mvankuipers/5393a5b8c0a9872385a9cccad53d2e43 to your computer and use it in GitHub Desktop.
Save mvankuipers/5393a5b8c0a9872385a9cccad53d2e43 to your computer and use it in GitHub Desktop.
Structure defining a page directory (PD) entry in IA-32e paging.
typedef struct _PDE
{
union
{
struct
{
ULONG64 Present : 1; // Must be 1, region invalid if 0.
ULONG64 ReadWrite : 1; // If 0, writes not allowed.
ULONG64 UserSupervisor : 1; // If 0, user-mode accesses not allowed.
ULONG64 PageWriteThrough : 1; // Determines the memory type used to access PT.
ULONG64 PageCacheDisable : 1; // Determines the memory type used to access PT.
ULONG64 Accessed : 1; // If 0, this entry has not been used for translation.
ULONG64 Ignored1 : 1;
ULONG64 PageSize : 1; // If 1, this entry maps a 2MB page.
ULONG64 Ignored2 : 4;
ULONG64 PageFrameNumber : 36; // The page frame number of the PT of this PDE.
ULONG64 Reserved : 4;
ULONG64 Ignored3 : 11;
ULONG64 ExecuteDisable : 1; // If 1, instruction fetches not allowed.
};
ULONG64 Value;
};
} PDE, *PPDE;
static_assert(sizeof(PDE) == sizeof(PVOID), "Size mismatch, only 64-bit supported.");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment