Skip to content

Instantly share code, notes, and snippets.

@vxcute
Created March 21, 2021 21:30
Show Gist options
  • Select an option

  • Save vxcute/df0cc68c7bfcc07e659dd5aea7116adf to your computer and use it in GitHub Desktop.

Select an option

Save vxcute/df0cc68c7bfcc07e659dd5aea7116adf to your computer and use it in GitHub Desktop.
#pragma pack(push, 1)
typedef unsigned __int64 uint64;
typedef union
{
uint64 All;
struct
{
uint64 Ignored_0 : 3;
uint64 WriteThrough : 1;
uint64 DisableCache : 1;
uint64 Ignored_1 : 7;
uint64 PML4_PTR : 40;
uint64 Reserved : 12;
};
}CR3,*PCR3;
typedef union
{
void* All;
struct
{
uint64 offsets : 12;
uint64 PageTableIndex : 9;
uint64 PageDirectoryIndex : 9;
uint64 PageDirectoryPointerTableIndex : 9;
uint64 PML4Index : 9;
uint64 Reserved : 16;
};
} VirtualAddress, * PVirtualAddress;
typedef union
{
uint64 All;
struct
{
uint64 Present : 1;
uint64 ReadWrite : 1;
uint64 UserModeAccess : 1;
uint64 PageLevelWriteThrough : 1;
uint64 PageLevelCacheDisable : 1;
uint64 Accessed : 1;
uint64 Ignored_0 : 1;
uint64 LargePage : 1;
uint64 Ignored_1 : 4;
uint64 PageFrameNumber : 36;
uint64 Reserved : 4;
uint64 Ignored_2 : 11;
uint64 NX : 1;
};
} PML4, * PPML4;
typedef union
{
uint64 All;
struct
{
uint64 Present : 1;
uint64 ReadWrite : 1;
uint64 UserModeAccess : 1;
uint64 PageLevelWriteThrough : 1;
uint64 PageLevelCacheDisable : 1;
uint64 accessed : 1;
uint64 Ignored_0 : 1;
uint64 LargePage : 1;
uint64 Ignored_1 : 4;
uint64 PageFrameNumber : 36;
uint64 Reserved : 4;
uint64 Ignored3 : 11;
uint64 NX : 1;
};
} PDPT, * PPDPT;
typedef union
{
uint64 All;
struct
{
uint64 Present : 1;
uint64 ReadWrite : 1;
uint64 UserModeAccess : 1;
uint64 PageLevelWriteThrough : 1;
uint64 PageLevelCacheDisable : 1;
uint64 accessed : 1;
uint64 Ignored_0 : 1;
uint64 LargePage : 1;
uint64 Ignored_1 : 4;
uint64 PageFrameNumber : 36;
uint64 Reserved : 4;
uint64 Ignored3 : 11;
uint64 NX : 1;
};
} PD, * PPD;
typedef union
{
uint64 All;
struct
{
uint64 Present : 1;
uint64 ReadWrite : 1;
uint64 UserModeAccess : 1;
uint64 PageLevelWriteThrough : 1;
uint64 PageCacheDisable : 1;
uint64 Accessed : 1;
uint64 Dirty : 1;
uint64 PageAccessType : 1;
uint64 Global : 1;
uint64 Ignored_0 : 3;
uint64 PageFrameNumber : 36;
uint64 Reserved : 4;
uint64 Ignored_1 : 7;
uint64 ProtectionKey : 4;
uint64 NX : 1;
};
} PT, * PPT;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment