mirror of
https://github.com/momo5502/hypervisor.git
synced 2025-07-01 08:41:55 +00:00
Extract into library
This commit is contained in:
@ -37,13 +37,16 @@ target_link_options(driver PRIVATE
|
||||
"/IGNORE:4210"
|
||||
)
|
||||
|
||||
set_target_properties(driver PROPERTIES OUTPUT_NAME "hyperhook")
|
||||
|
||||
################################################
|
||||
|
||||
set(DRIVER_FILE "$<TARGET_FILE:driver>")
|
||||
set(DRIVER_NAME "$<TARGET_FILE_NAME:driver>")
|
||||
|
||||
file (GENERATE
|
||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/$<LOWER_CASE:$<CONFIG>>/driver_file.h"
|
||||
CONTENT "#define DRIVER_FILE \"${DRIVER_FILE}\"\n"
|
||||
CONTENT "#define DRIVER_FILE \"${DRIVER_FILE}\"\n#define DRIVER_NAME \"${DRIVER_NAME}\"\n"
|
||||
)
|
||||
|
||||
add_library(driver_file INTERFACE)
|
||||
|
@ -70,7 +70,10 @@ private:
|
||||
{
|
||||
if (type == process_callback::type::destroy)
|
||||
{
|
||||
this->hypervisor_.handle_process_termination(process_id);
|
||||
if (this->hypervisor_.cleanup_process(process_id))
|
||||
{
|
||||
debug_log("Handled termination of %X\n", process_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -635,7 +635,7 @@ namespace vmx
|
||||
return this->access_records;
|
||||
}
|
||||
|
||||
bool ept::handle_process_termination(const process_id process)
|
||||
bool ept::cleanup_process(const process_id process)
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
|
@ -90,7 +90,7 @@ namespace vmx
|
||||
|
||||
uint64_t* get_access_records(size_t* count);
|
||||
|
||||
bool handle_process_termination(process_id process);
|
||||
bool cleanup_process(process_id process);
|
||||
|
||||
private:
|
||||
DECLSPEC_PAGE_ALIGN pml4 epml4[EPT_PML4E_ENTRY_COUNT];
|
||||
|
@ -261,15 +261,15 @@ hypervisor* hypervisor::get_instance()
|
||||
return instance;
|
||||
}
|
||||
|
||||
void hypervisor::handle_process_termination(const process_id process)
|
||||
bool hypervisor::cleanup_process(const process_id process)
|
||||
{
|
||||
if (!this->ept_->handle_process_termination(process))
|
||||
if (!this->ept_->cleanup_process(process))
|
||||
{
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
debug_log("Handled termination of %X\n", process);
|
||||
this->invalidate_cores();
|
||||
return true;
|
||||
}
|
||||
|
||||
void hypervisor::enable()
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
|
||||
static hypervisor* get_instance();
|
||||
|
||||
void handle_process_termination(process_id process);
|
||||
bool cleanup_process(process_id process);
|
||||
|
||||
private:
|
||||
uint32_t vm_state_count_{0};
|
||||
|
Reference in New Issue
Block a user