mirror of
https://github.com/momo5502/hypervisor.git
synced 2025-07-03 17:51:52 +00:00
Prepare code watching
This commit is contained in:
@ -23,6 +23,12 @@ namespace vmx
|
||||
ept_split* next_split{nullptr};
|
||||
};
|
||||
|
||||
struct ept_code_watch_point
|
||||
{
|
||||
uint64_t physical_base_address{};
|
||||
pml1* target_page{};
|
||||
ept_code_watch_point* next_watch_point{nullptr};
|
||||
};
|
||||
|
||||
struct ept_hook
|
||||
{
|
||||
@ -68,11 +74,13 @@ namespace vmx
|
||||
|
||||
void initialize();
|
||||
|
||||
void install_code_watch_point(uint64_t physical_page);
|
||||
|
||||
void install_hook(const void* destination, const void* source, size_t length,
|
||||
ept_translation_hint* translation_hint = nullptr);
|
||||
void disable_all_hooks() const;
|
||||
|
||||
void handle_violation(guest_context& guest_context) const;
|
||||
void handle_violation(guest_context& guest_context);
|
||||
void handle_misconfiguration(guest_context& guest_context) const;
|
||||
|
||||
ept_pointer get_ept_pointer() const;
|
||||
@ -81,13 +89,19 @@ namespace vmx
|
||||
static ept_translation_hint* generate_translation_hints(const void* destination, size_t length);
|
||||
static void free_translation_hints(ept_translation_hint* hints);
|
||||
|
||||
uint64_t* get_access_records(size_t* count);
|
||||
|
||||
private:
|
||||
DECLSPEC_PAGE_ALIGN pml4 epml4[EPT_PML4E_ENTRY_COUNT];
|
||||
DECLSPEC_PAGE_ALIGN pml3 epdpt[EPT_PDPTE_ENTRY_COUNT];
|
||||
DECLSPEC_PAGE_ALIGN pml2 epde[EPT_PDPTE_ENTRY_COUNT][EPT_PDE_ENTRY_COUNT];
|
||||
|
||||
uint64_t access_records[1024];
|
||||
volatile long access_records_barrier{0};
|
||||
|
||||
ept_split* ept_splits{nullptr};
|
||||
ept_hook* ept_hooks{nullptr};
|
||||
ept_code_watch_point* ept_code_watch_points{nullptr};
|
||||
|
||||
pml2* get_pml2_entry(uint64_t physical_address);
|
||||
pml1* get_pml1_entry(uint64_t physical_address);
|
||||
@ -97,11 +111,16 @@ namespace vmx
|
||||
ept_hook* allocate_ept_hook(uint64_t physical_address);
|
||||
ept_hook* find_ept_hook(uint64_t physical_address) const;
|
||||
|
||||
ept_code_watch_point* allocate_ept_code_watch_point();
|
||||
ept_code_watch_point* find_ept_code_watch_point(uint64_t physical_address) const;
|
||||
|
||||
ept_hook* get_or_create_ept_hook(void* destination, ept_translation_hint* translation_hint = nullptr);
|
||||
|
||||
void split_large_page(uint64_t physical_address);
|
||||
|
||||
void install_page_hook(void* destination, const void* source, size_t length,
|
||||
ept_translation_hint* translation_hint = nullptr);
|
||||
|
||||
void record_access(uint64_t rip);
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user