mirror of
https://github.com/momo5502/hypervisor.git
synced 2025-04-20 05:55:44 +00:00
More cleanup
This commit is contained in:
parent
d317a308c5
commit
7645ffa4b4
@ -1016,15 +1016,18 @@ void ShvVmxSetupVmcsForVp(vmx::state* VpData)
|
|||||||
__vmx_vmwrite(VMCS_HOST_RIP, reinterpret_cast<uintptr_t>(vm_exit));
|
__vmx_vmwrite(VMCS_HOST_RIP, reinterpret_cast<uintptr_t>(vm_exit));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void initialize_msrs(vmx::launch_context& launch_context)
|
||||||
|
{
|
||||||
|
constexpr auto msr_count = sizeof(launch_context.msr_data) / sizeof(launch_context.msr_data[0]);
|
||||||
|
for (auto i = 0u; i < msr_count; ++i)
|
||||||
|
{
|
||||||
|
launch_context.msr_data[i].QuadPart = __readmsr(IA32_VMX_BASIC + i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
INT32 ShvVmxLaunchOnVp(vmx::state* VpData)
|
INT32 ShvVmxLaunchOnVp(vmx::state* VpData)
|
||||||
{
|
{
|
||||||
//
|
initialize_msrs(VpData->launch_context);
|
||||||
// Initialize all the VMX-related MSRs by reading their value
|
|
||||||
//
|
|
||||||
for (UINT32 i = 0; i < sizeof(VpData->launch_context.msr_data) / sizeof(VpData->launch_context.msr_data[0]); i++)
|
|
||||||
{
|
|
||||||
VpData->launch_context.msr_data[i].QuadPart = __readmsr(IA32_VMX_BASIC + i);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize all the MTRR-related MSRs by reading their value and build
|
// Initialize all the MTRR-related MSRs by reading their value and build
|
||||||
@ -1063,7 +1066,7 @@ INT32 ShvVmxLaunchOnVp(vmx::state* VpData)
|
|||||||
|
|
||||||
void hypervisor::enable_core(const uint64_t system_directory_table_base)
|
void hypervisor::enable_core(const uint64_t system_directory_table_base)
|
||||||
{
|
{
|
||||||
debug_log("Enabling hypervisor on core %d\n", thread::get_processor_index(), thread::get_processor_index());
|
debug_log("Enabling hypervisor on core %d\n", thread::get_processor_index());
|
||||||
auto* vm_state = this->get_current_vm_state();
|
auto* vm_state = this->get_current_vm_state();
|
||||||
|
|
||||||
vm_state->launch_context.system_directory_table_base = system_directory_table_base;
|
vm_state->launch_context.system_directory_table_base = system_directory_table_base;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user