50 m_vmcs_region_phys(0),
56 gsl::not_null<vmcs_intel_x64_state *> guest_state)
60 auto ___ = gsl::on_failure([&]
65 auto ___ = gsl::on_failure([&]
72 auto ___ = gsl::on_failure([&]
75 auto ___ = gsl::on_failure([&]
78 if (guest_state->is_guest())
81 throw std::runtime_error(
"vmcs resume failed");
93 throw std::runtime_error(
"vmcs promote failed");
100 throw std::runtime_error(
"vmcs resume failed");
114 auto ___ = gsl::on_failure([&]
120 gsl::span<uint32_t>
id{m_vmcs_region.get(), 1024};
121 id[0] = gsl::narrow<uint32_t>(msrs::ia32_vmx_basic::revision_id::get());
141 gsl::not_null<vmcs_intel_x64_state *> guest_state)
212 auto ia32_vmx_pinbased_ctls_msr = msrs::ia32_vmx_true_pinbased_ctls::get();
213 auto ia32_vmx_procbased_ctls_msr = msrs::ia32_vmx_true_procbased_ctls::get();
214 auto ia32_vmx_exit_ctls_msr = msrs::ia32_vmx_true_exit_ctls::get();
215 auto ia32_vmx_entry_ctls_msr = msrs::ia32_vmx_true_entry_ctls::get();
217 lower = ((ia32_vmx_pinbased_ctls_msr >> 0) & 0x00000000FFFFFFFF);
218 upper = ((ia32_vmx_pinbased_ctls_msr >> 32) & 0x00000000FFFFFFFF);
221 lower = ((ia32_vmx_procbased_ctls_msr >> 0) & 0x00000000FFFFFFFF);
222 upper = ((ia32_vmx_procbased_ctls_msr >> 32) & 0x00000000FFFFFFFF);
225 lower = ((ia32_vmx_exit_ctls_msr >> 0) & 0x00000000FFFFFFFF);
226 upper = ((ia32_vmx_exit_ctls_msr >> 32) & 0x00000000FFFFFFFF);
229 lower = ((ia32_vmx_entry_ctls_msr >> 0) & 0x00000000FFFFFFFF);
230 upper = ((ia32_vmx_entry_ctls_msr >> 32) & 0x00000000FFFFFFFF);
387 auto stack_top = exit_handler_stack + (
STACK_SIZE * 2);
388 stack_top = (stack_top & ~(
STACK_SIZE - 1)) - 1;
virtual void launch(gsl::not_null< vmcs_intel_x64_state *> host_state, gsl::not_null< vmcs_intel_x64_state *> guest_state)
void release_vmcs_region() noexcept
std::unique_ptr< uint32_t[]> m_vmcs_region
void write_32bit_control_state(gsl::not_null< vmcs_intel_x64_state *> state)
void write_natural_guest_state(gsl::not_null< vmcs_intel_x64_state *> state)
void exit_handler_entry(void)
void create_exit_handler_stack()
void release_exit_handler_stack() noexcept
void write_64bit_control_state(gsl::not_null< vmcs_intel_x64_state *> state)
uint64_t thread_context_cpuid(void)
void write_64bit_host_state(gsl::not_null< vmcs_intel_x64_state *> state)
#define SECONDARY_ENABLE_IF_VERBOSE
auto upper(T ptr) noexcept
void vmcs_resume(state_save_intel_x64 *state_save)
void clear(gsl::not_null< void *> ptr)
void uint64_t uint64_t uint64_t *rdx noexcept
void secondary_processor_based_vm_execution_controls()
void write_64bit_guest_state(gsl::not_null< vmcs_intel_x64_state *> state)
void pin_based_vm_execution_controls()
std::unique_ptr< char[]> m_exit_handler_stack
void set_if_exists(T val, bool verbose=false) noexcept
state_save_intel_x64 * m_state_save
void primary_processor_based_vm_execution_controls()
void create_vmcs_region()
void write_16bit_control_state(gsl::not_null< vmcs_intel_x64_state *> state)
virtual void write_fields(gsl::not_null< vmcs_intel_x64_state *> host_state, gsl::not_null< vmcs_intel_x64_state *> guest_state)
void write_32bit_host_state(gsl::not_null< vmcs_intel_x64_state *> state)
void write_16bit_guest_state(gsl::not_null< vmcs_intel_x64_state *> state)
uintptr_t m_vmcs_region_phys
void enable_if_allowed(bool verbose=false) noexcept
uint64_t thread_context_tlsptr(void)
void write_natural_host_state(gsl::not_null< vmcs_intel_x64_state *> state)
auto lower(T ptr) noexcept
void write_16bit_host_state(gsl::not_null< vmcs_intel_x64_state *> state)
void write_natural_control_state(gsl::not_null< vmcs_intel_x64_state *> state)
void write_32bit_guest_state(gsl::not_null< vmcs_intel_x64_state *> state)
void vmcs_launch(state_save_intel_x64 *state_save)