23 #ifndef VMCS_INTEL_X64_HELPERS_H 24 #define VMCS_INTEL_X64_HELPERS_H 26 #include <type_traits> 40 template<class T, class = typename std::enable_if<std::is_integral<T>::value>
::type>
44 throw std::logic_error(
"get_vmcs_field failed: "_s + name +
" field doesn't exist");
49 template<class T, class = typename std::enable_if<std::is_integral<T>::value>
::type>
55 if (!exists && verbose)
56 bfwarning <<
"get_vmcs_field_if_exists failed: " << name <<
" field doesn't exist" << bfendl;
61 template <
class V,
class A,
62 class =
typename std::enable_if<std::is_integral<V>::value>
::type,
63 class = typename
std::enable_if<std::is_integral<A>::value>::type>
67 throw std::logic_error(
"set_vmcs_field failed: "_s +
name +
" field doesn't exist");
72 template <
class V,
class A,
73 class =
typename std::enable_if<std::is_integral<V>::value>
::type,
74 class = typename
std::enable_if<std::is_integral<A>::value>::type>
81 bfwarning <<
"set_vmcs_field failed: " <<
name <<
" field doesn't exist" << bfendl;
84 template <
class MA,
class CA,
class M,
85 class =
typename std::enable_if<std::is_integral<MA>::value>
::type,
86 class = typename
std::enable_if<std::is_integral<CA>::value>::type,
87 class = typename std::enable_if<std::is_integral<M>::value>::type>
88 auto
set_vm_control(bool val, MA msr_addr, CA ctls_addr, const char *name, M mask, bool field_exists)
91 throw std::logic_error(
"set_vm_control failed: "_s +
name +
" control doesn't exist");
98 throw std::logic_error(
"set_vm_control failed: "_s +
name +
" control is not allowed to be cleared to 0");
107 throw std::logic_error(
"set_vm_control failed: "_s +
name +
" control is not allowed to be set to 1");
113 template <
class MA,
class CA,
class M,
114 class =
typename std::enable_if<std::is_integral<MA>::value>
::type,
115 class = typename
std::enable_if<std::is_integral<CA>::value>::type,
116 class = typename std::enable_if<std::is_integral<M>::value>::type>
118 M mask, bool verbose, bool field_exists)
noexcept 122 bfwarning <<
"set_vm_control_if_allowed failed: " <<
name <<
" control doesn't exist" << bfendl;
138 bfwarning <<
"set_vm_control_if_allowed failed: " <<
name 139 <<
"control is not allowed to be cleared to 0" << bfendl;
155 bfwarning <<
"set_vm_control_if_allowed failed: " <<
name 156 <<
"control is not allowed to be set to 1" << bfendl;
auto set_vm_control_if_allowed(bool val, MA msr_addr, CA ctls_addr, const char *name, M mask, bool verbose, bool field_exists) noexcept
auto get_vmcs_field_if_exists(T addr, const char *name, bool verbose, bool exists)
constexpr const auto mask
auto is_allowed0() noexcept
auto set_vmcs_field_if_exists(V val, A addr, const char *name, bool verbose, bool exists) noexcept
void uint64_t uint64_t uint64_t *rdx noexcept
constexpr const auto addr
void write(field_type field, value_type value, name_type name="")
auto get(A addr) noexcept
auto set_vmcs_field(V val, A addr, const char *name, bool exists)
auto is_allowed1() noexcept
auto read(field_type field, name_type name="")
constexpr const auto name
auto get_vmcs_field(T addr, const char *name, bool exists)
constexpr const auto msr_addr
auto set_vm_control(bool val, MA msr_addr, CA ctls_addr, const char *name, M mask, bool field_exists)