HyperPlatform Programmer's Reference
ept.h
Go to the documentation of this file.
1 // Copyright (c) 2015-2017, Satoshi Tanda. All rights reserved.
2 // Use of this source code is governed by a MIT-style license that can be
3 // found in the LICENSE file.
4 
7 
8 #ifndef HYPERPLATFORM_EPT_H_
9 #define HYPERPLATFORM_EPT_H_
10 
11 #include <fltKernel.h>
12 
13 extern "C" {
15 //
16 // macro utilities
17 //
18 
20 //
21 // constants and macros
22 //
23 
25 //
26 // types
27 //
28 
29 struct EptData;
30 
33  ULONG64 all;
34  struct {
35  ULONG64 read_access : 1;
36  ULONG64 write_access : 1;
37  ULONG64 execute_access : 1;
38  ULONG64 memory_type : 3;
39  ULONG64 reserved1 : 6;
40  ULONG64 physial_address : 36;
41  ULONG64 reserved2 : 16;
42  } fields;
43 };
44 static_assert(sizeof(EptCommonEntry) == 8, "Size check");
45 
47 //
48 // prototypes
49 //
50 
53 _IRQL_requires_max_(PASSIVE_LEVEL) bool EptIsEptAvailable();
54 
58 ULONG64 EptGetEptPointer(_In_ EptData* ept_data);
59 
61 _IRQL_requires_max_(PASSIVE_LEVEL) void EptInitializeMtrrEntries();
62 
68 _IRQL_requires_max_(PASSIVE_LEVEL) EptData* EptInitialization();
69 
72 void EptTermination(_In_ EptData* ept_data);
73 
76 _IRQL_requires_min_(DISPATCH_LEVEL) void EptHandleEptViolation(
77  _In_ EptData* ept_data);
78 
84  _In_ ULONG64 physical_address);
85 
87 //
88 // variables
89 //
90 
92 //
93 // implementations
94 //
95 
96 } // extern "C"
97 
98 #endif // HYPERPLATFORM_EPT_H_
bool EptIsEptAvailable()
Checks if the system supports EPT technology sufficient enough.
Definition: ept.cpp:163
void EptHandleEptViolation(_In_ EptData *ept_data)
Handles VM-exit triggered by EPT violation.
ULONG64 physial_address
[12:48-1]
Definition: ept.h:40
struct EptCommonEntry::@0 fields
ULONG64 reserved1
[6:11]
Definition: ept.h:39
ULONG64 memory_type
[3:5]
Definition: ept.h:38
void EptInitializeMtrrEntries()
Reads and stores all MTRRs to set a correct memory type for EPT.
Definition: ept.cpp:193
EptCommonEntry * EptGetEptPtEntry(_In_ EptData *ept_data, _In_ ULONG64 physical_address)
Returns an EPT entry corresponds to physical_address.
void EptTermination(_In_ EptData *ept_data)
De-allocates ept_data and all resources referenced in it.
ULONG64 read_access
[0]
Definition: ept.h:35
ULONG64 execute_access
[2]
Definition: ept.h:37
ULONG64 write_access
[1]
Definition: ept.h:36
EptData * EptInitialization()
Builds EPT, allocates pre-allocated entires, initializes and returns EptData.
Definition: ept.cpp:399
Definition: ept.cpp:86
ULONG64 reserved2
[48:63]
Definition: ept.h:41
ULONG64 all
Definition: ept.h:33
A structure made up of mutual fields across all EPT entry types.
Definition: ept.h:32
ULONG64 EptGetEptPointer(_In_ EptData *ept_data)
Returns an EPT pointer from ept_data.