22#define PAGE_ATTRIB_READ 0x2
23#define PAGE_ATTRIB_WRITE 0x4
24#define PAGE_ATTRIB_EXEC 0x8
25#define PAGE_ATTRIB_EXEC_HIDDEN_HOOK 0x10
31#define SIZE_2_MB ((SIZE_T)(512 * PAGE_SIZE))
37#define SIZE_1_GB ((SIZE_T)(512 * SIZE_2_MB))
43#define SIZE_512_GB ((SIZE_T)(512 * SIZE_1_GB))
49#define ADDRMASK_EPT_PML1_OFFSET(_VAR_) ((_VAR_) & 0xFFFULL)
55#define ADDRMASK_EPT_PML1_INDEX(_VAR_) (((_VAR_) & 0x1FF000ULL) >> 12)
61#define ADDRMASK_EPT_PML2_INDEX(_VAR_) (((_VAR_) & 0x3FE00000ULL) >> 21)
67#define ADDRMASK_EPT_PML3_INDEX(_VAR_) (((_VAR_) & 0x7FC0000000ULL) >> 30)
73#define ADDRMASK_EPT_PML4_INDEX(_VAR_) (((_VAR_) & 0xFF8000000000ULL) >> 39)
108#define MAX_VARIABLE_RANGE_MTRRS 255
116#define NUM_FIXED_RANGE_MTRRS ((1 + 2 + 8) * RTL_NUMBER_OF_FIELD(IA32_MTRR_FIXED_RANGE_TYPE, s.Types))
122#define NUM_MTRR_ENTRIES (MAX_VARIABLE_RANGE_MTRRS + NUM_FIXED_RANGE_MTRRS)
180 _In_ VMX_EXIT_QUALIFICATION_EPT_VIOLATION ViolationQualification,
181 _In_ UINT64 GuestPhysicalAddr);
222 SIZE_T PhysicalAddress);
298 _In_ _Strict_type_match_ INVEPT_TYPE InvalidationType);
PEPT_PML2_ENTRY EptGetPml2Entry(PVMM_EPT_PAGE_TABLE EptPageTable, SIZE_T PhysicalAddress)
Split 2MB (LargePage) into 4kb pages.
Definition Ept.c:450
VOID EptSetPML1AndInvalidateTLB(_Inout_ VIRTUAL_MACHINE_STATE *VCpu, _Out_ PEPT_PML1_ENTRY EntryAddress, _In_ EPT_PML1_ENTRY EntryValue, _In_ _Strict_type_match_ INVEPT_TYPE InvalidationType)
This function set the specific PML1 entry in a spinlock protected area then invalidate the TLB ,...
BOOLEAN EptLogicalProcessorInitialize(VOID)
Initialize EPT Table based on Processor Index.
Definition Ept.c:865
struct _VMM_EPT_DYNAMIC_SPLIT * PVMM_EPT_DYNAMIC_SPLIT
struct _MTRR_RANGE_DESCRIPTOR * PMTRR_RANGE_DESCRIPTOR
union _IA32_MTRR_FIXED_RANGE_TYPE IA32_MTRR_FIXED_RANGE_TYPE
Fixed range MTRR.
BOOLEAN EptSetupPML2Entry(PVMM_EPT_PAGE_TABLE EptPageTable, PEPT_PML2_ENTRY NewEntry, SIZE_T PageFrameNumber)
Set up PML2 Entries.
Definition Ept.c:655
BOOLEAN EptHandlePageHookExit(_Inout_ VIRTUAL_MACHINE_STATE *VCpu, _In_ VMX_EXIT_QUALIFICATION_EPT_VIOLATION ViolationQualification, _In_ UINT64 GuestPhysicalAddr)
struct _EPT_STATE * PEPT_STATE
struct _MTRR_RANGE_DESCRIPTOR MTRR_RANGE_DESCRIPTOR
MTRR Descriptor.
BOOLEAN EptBuildMtrrMap(VOID)
Build MTRR Map.
Definition Ept.c:167
BOOLEAN EptCheckFeatures(VOID)
Check for EPT Features.
Definition Ept.c:22
PVMM_EPT_PAGE_TABLE EptAllocateAndCreateIdentityPageTable(VOID)
Allocates page maps and create identity page table.
Definition Ept.c:687
BOOLEAN EptCheckAndHandleBreakpoint(VIRTUAL_MACHINE_STATE *VCpu)
Check if the breakpoint vm-exit relates to EPT hook or not.
Definition Ept.c:1317
BOOLEAN EptHandleEptViolation(VIRTUAL_MACHINE_STATE *VCpu)
Handle EPT Violation.
Definition Ept.c:1108
PVOID EptGetPml1OrPml2Entry(PVMM_EPT_PAGE_TABLE EptPageTable, SIZE_T PhysicalAddress, BOOLEAN *IsLargePage)
Get the PML1 entry for this physical address if the large page is available then large page of Pml2 i...
Definition Ept.c:394
#define NUM_MTRR_ENTRIES
Total number of MTRR descriptors to store.
Definition Ept.h:122
PEPT_PML1_ENTRY EptGetPml1Entry(PVMM_EPT_PAGE_TABLE EptPageTable, SIZE_T PhysicalAddress)
Get the PML1 Entry of a special address.
Definition Ept.c:337
struct _EPT_STATE EPT_STATE
Main structure for saving the state of EPT among the project.
BOOLEAN EptSplitLargePage(PVMM_EPT_PAGE_TABLE EptPageTable, BOOLEAN UsePreAllocatedBuffer, SIZE_T PhysicalAddress)
Convert large pages to 4KB pages.
Definition Ept.c:481
struct _VMM_EPT_DYNAMIC_SPLIT VMM_EPT_DYNAMIC_SPLIT
Split 2MB granularity to 4 KB granularity.
VOID EptHandleMisconfiguration(VOID)
Handle Ept Misconfigurations.
Definition Ept.c:1152
Main structure for saving the state of EPT among the project.
Definition Ept.h:129
UINT32 NumberOfEnabledMemoryRanges
Definition Ept.h:132
UINT8 DefaultMemoryType
Definition Ept.h:133
LIST_ENTRY HookedPagesList
Definition Ept.h:130
MTRR_RANGE_DESCRIPTOR MemoryRanges[NUM_MTRR_ENTRIES]
Definition Ept.h:131
MTRR Descriptor.
Definition Ept.h:84
UCHAR MemoryType
Definition Ept.h:87
BOOLEAN FixedRange
Definition Ept.h:88
SIZE_T PhysicalBaseAddress
Definition Ept.h:85
SIZE_T PhysicalEndAddress
Definition Ept.h:86
Split 2MB granularity to 4 KB granularity.
Definition Ept.h:141
LIST_ENTRY DynamicSplitList
Linked list entries for each dynamic split.
Definition Ept.h:163
PEPT_PML2_POINTER Pointer
Definition Ept.h:156
EPT_PML1_ENTRY PML1[VMM_EPT_PML1E_COUNT]
The 4096 byte page table entries that correspond to the split 2MB table entry.
Definition Ept.h:147
PEPT_PML2_ENTRY Entry
Definition Ept.h:155
union _VMM_EPT_DYNAMIC_SPLIT::@275337017054050120003261225167376117025061264241 Fields
The pointer to the 2MB entry in the page table which this split is servicing.
Fixed range MTRR.
Definition Ept.h:96
UINT8 Types[8]
Definition Ept.h:100
UINT64 AsUInt
Definition Ept.h:97
struct _IA32_MTRR_FIXED_RANGE_TYPE::@170207037044173377154145111113263372336161202124 s