MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vmx_enable

Function vmx_enable

freebsd/amd64/vmm/intel/vmx.c:632–652  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

630}
631
632static void
633vmx_enable(void *arg __unused)
634{
635 int error;
636 uint64_t feature_control;
637
638 feature_control = rdmsr(MSR_IA32_FEATURE_CONTROL);
639 if ((feature_control & IA32_FEATURE_CONTROL_LOCK) == 0 ||
640 (feature_control & IA32_FEATURE_CONTROL_VMX_EN) == 0) {
641 wrmsr(MSR_IA32_FEATURE_CONTROL,
642 feature_control | IA32_FEATURE_CONTROL_VMX_EN |
643 IA32_FEATURE_CONTROL_LOCK);
644 }
645
646 load_cr4(rcr4() | CR4_VMXE);
647
648 *(uint32_t *)vmxon_region[curcpu] = vmx_revision();
649 error = vmxon(vmxon_region[curcpu]);
650 if (error == 0)
651 vmxon_enabled[curcpu] = 1;
652}
653
654static void
655vmx_modresume(void)

Callers

nothing calls this directly

Calls 5

vmx_revisionFunction · 0.85
rdmsrFunction · 0.50
wrmsrFunction · 0.50
load_cr4Function · 0.50
rcr4Function · 0.50

Tested by

no test coverage detected