hv
hv copied to clipboard
Check for support of cr3 target count before write into
If not doing this, on some cpu vm_launch would failed with VMCS_VM_INSTRUCTION_ERROR = 7, which is invalid vm execution control fileds.
https://github.com/jonomango/hv/blob/main/hv/vmcs.cpp#L99
// 3.24.6.7 // try to trigger the least amount of CR3 exits as possible if (cpu->cached.vmx_misc.cr3_target_count >= 1) { vmx_vmwrite(VMCS_CTRL_CR3_TARGET_COUNT, 1); vmx_vmwrite(VMCS_CTRL_CR3_TARGET_VALUE_0, ghv.system_cr3.flags); } else { vmx_vmwrite(VMCS_CTRL_CR3_TARGET_COUNT, 0); }