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 ADDRMASK_EPT_PML1_OFFSET(_VAR_) ((_VAR_) & 0xFFFULL)
43#define ADDRMASK_EPT_PML1_INDEX(_VAR_) (((_VAR_) & 0x1FF000ULL) >> 12)
49#define ADDRMASK_EPT_PML2_INDEX(_VAR_) (((_VAR_) & 0x3FE00000ULL) >> 21)
55#define ADDRMASK_EPT_PML3_INDEX(_VAR_) (((_VAR_) & 0x7FC0000000ULL) >> 30)
61#define ADDRMASK_EPT_PML4_INDEX(_VAR_) (((_VAR_) & 0xFF8000000000ULL) >> 39)
96#define MAX_VARIABLE_RANGE_MTRRS 255
104#define NUM_FIXED_RANGE_MTRRS ((1 + 2 + 8) * RTL_NUMBER_OF_FIELD(IA32_MTRR_FIXED_RANGE_TYPE, s.Types))
110#define NUM_MTRR_ENTRIES (MAX_VARIABLE_RANGE_MTRRS + NUM_FIXED_RANGE_MTRRS)
174 _In_ VMX_EXIT_QUALIFICATION_EPT_VIOLATION ViolationQualification,
175 _In_
UINT64 GuestPhysicalAddr);
215 PVOID PreAllocatedBuffer,
216 SIZE_T PhysicalAddress);
292 _In_ _Strict_type_match_ INVEPT_TYPE InvalidationType);
UCHAR BOOLEAN
Definition BasicTypes.h:39
unsigned char UCHAR
Definition BasicTypes.h:35
#define VOID
Definition BasicTypes.h:33
unsigned __int64 UINT64
Definition BasicTypes.h:21
unsigned char UINT8
Definition BasicTypes.h:46
unsigned int UINT32
Definition BasicTypes.h:48
PEPT_PML2_ENTRY EptGetPml2Entry(PVMM_EPT_PAGE_TABLE EptPageTable, SIZE_T PhysicalAddress)
Split 2MB (LargePage) into 4kb pages.
Definition Ept.c:431
BOOLEAN EptSplitLargePage(PVMM_EPT_PAGE_TABLE EptPageTable, PVOID PreAllocatedBuffer, SIZE_T PhysicalAddress)
Convert 2MB pages to 4KB pages.
Definition Ept.c:462
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:759
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:603
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:156
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:642
BOOLEAN EptCheckAndHandleBreakpoint(VIRTUAL_MACHINE_STATE *VCpu)
Check if the breakpoint vm-exit relates to EPT hook or not.
Definition Ept.c:1211
BOOLEAN EptHandleEptViolation(VIRTUAL_MACHINE_STATE *VCpu)
Handle EPT Violation.
Definition Ept.c:1002
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:368
#define NUM_MTRR_ENTRIES
Total number of MTRR descriptors to store.
Definition Ept.h:110
PEPT_PML1_ENTRY EptGetPml1Entry(PVMM_EPT_PAGE_TABLE EptPageTable, SIZE_T PhysicalAddress)
Get the PML1 Entry of a special address.
Definition Ept.c:304
struct _EPT_STATE EPT_STATE
Main structure for saving the state of EPT among the project.
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:1046
Main structure for saving the state of EPT among the project.
Definition Ept.h:117
UINT32 NumberOfEnabledMemoryRanges
Definition Ept.h:120
PVMM_EPT_PAGE_TABLE ModeBasedKernelDisabledEptPageTable
Definition Ept.h:123
EPT_POINTER ModeBasedKernelDisabledEptPointer
Definition Ept.h:125
UINT8 DefaultMemoryType
Definition Ept.h:127
LIST_ENTRY HookedPagesList
Definition Ept.h:118
EPT_POINTER ModeBasedUserDisabledEptPointer
Definition Ept.h:124
PVMM_EPT_PAGE_TABLE EptPageTable
Definition Ept.h:121
PVMM_EPT_PAGE_TABLE ModeBasedUserDisabledEptPageTable
Definition Ept.h:122
MTRR_RANGE_DESCRIPTOR MemoryRanges[NUM_MTRR_ENTRIES]
Definition Ept.h:119
EPT_POINTER ExecuteOnlyEptPointer
Definition Ept.h:126
MTRR Descriptor.
Definition Ept.h:72
UCHAR MemoryType
Definition Ept.h:75
BOOLEAN FixedRange
Definition Ept.h:76
SIZE_T PhysicalBaseAddress
Definition Ept.h:73
SIZE_T PhysicalEndAddress
Definition Ept.h:74
The status of each core after and before VMX.
Definition State.h:290
Split 2MB granularity to 4 KB granularity.
Definition Ept.h:135
LIST_ENTRY DynamicSplitList
Linked list entries for each dynamic split.
Definition Ept.h:157
PEPT_PML2_POINTER Pointer
Definition Ept.h:150
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:141
PEPT_PML2_ENTRY Entry
Definition Ept.h:149
union _VMM_EPT_DYNAMIC_SPLIT::@6 u
The pointer to the 2MB entry in the page table which this split is servicing.
Structure for saving EPT Table.
Definition State.h:105
Fixed range MTRR.
Definition Ept.h:84
UINT8 Types[8]
Definition Ept.h:88
struct _IA32_MTRR_FIXED_RANGE_TYPE::@5 s
UINT64 AsUInt
Definition Ept.h:85