22 #ifndef VMX_INTEL_X64_H 23 #define VMX_INTEL_X64_H 49 inline void on(gsl::not_null<void *> ptr)
52 throw std::runtime_error(
"vmx::on failed");
58 throw std::runtime_error(
"vmx::off failed");
63 uint64_t descriptor[2] = { eptp, 0 };
64 if (!
__invept(1, static_cast<void *>(descriptor)))
65 throw std::runtime_error(
"vm::invept_singal_context failed");
70 uint64_t descriptor[2] = { 0, 0 };
71 if (!
__invept(2, static_cast<void *>(descriptor)))
72 throw std::runtime_error(
"vm::invept_global failed");
77 uint64_t descriptor[2] = { vpid, addr };
78 if (!
__invvpid(0, static_cast<void *>(descriptor)))
79 throw std::runtime_error(
"vm::invvpid_individual_address failed");
84 uint64_t descriptor[2] = { vpid, 0 };
85 if (!
__invvpid(1, static_cast<void *>(descriptor)))
86 throw std::runtime_error(
"vm::invvpid_single_context failed");
91 uint64_t descriptor[2] = { 0, 0 };
92 if (!
__invvpid(2, static_cast<void *>(descriptor)))
93 throw std::runtime_error(
"vm::invvpid_all_contexts failed");
98 uint64_t descriptor[2] = { vpid, 0 };
99 if (!
__invvpid(3, static_cast<void *>(descriptor)))
100 throw std::runtime_error(
"vm::invvpid_single_context_global failed");
111 inline void clear(gsl::not_null<void *> ptr)
114 throw std::runtime_error(
"vm::clear failed");
117 inline void load(gsl::not_null<void *> ptr)
120 throw std::runtime_error(
"vm::load failed");
123 inline void reset(gsl::not_null<void *> ptr)
126 throw std::runtime_error(
"vm::reset failed");
135 bferror <<
"vm::read failed:" << bfendl;
136 bferror <<
" - field: " <<
name << bfendl;
138 throw std::runtime_error(
"vm::read failed");
148 bferror <<
"vm::write failed:" << bfendl;
149 bferror <<
" - field: " <<
name << bfendl;
152 throw std::runtime_error(
"vm::write failed");
159 throw std::runtime_error(
"vm::launch_demote failed");
void load(gsl::not_null< void *> ptr)
void invvpid_all_contexts()
bool __invvpid(uint64_t type, void *ptr) noexcept
bool __vmwrite(uint64_t field, uint64_t val) noexcept
bool __vmptrld(void *ptr) noexcept
void reset(gsl::not_null< void *> ptr)
void clear(gsl::not_null< void *> ptr)
bool __vmxoff(void) noexcept
void uint64_t uint64_t uint64_t *rdx noexcept
constexpr const auto addr
bool __invept(uint64_t type, void *ptr) noexcept
bool __vmlaunch_demote(void) noexcept
bool __vmptrst(void *ptr) noexcept
void invvpid_single_context_global(vpid_type vpid)
void write(field_type field, value_type value, name_type name="")
uintptr_t integer_pointer
const void * view_as_pointer(const T val)
auto read(field_type field, name_type name="")
constexpr const auto name
void invvpid_individual_address(vpid_type vpid, integer_pointer addr)
bool __vmread(uint64_t field, uint64_t *val) noexcept
void on(gsl::not_null< void *> ptr)
uintptr_t integer_pointer
bool __vmclear(void *ptr) noexcept
void invept_single_context(eptp_type eptp)
bool __vmxon(void *ptr) noexcept
void invvpid_single_context(vpid_type vpid)