VirtualBox

Changeset 57051 in vbox for trunk/src/VBox/HostDrivers


Ignore:
Timestamp:
Jul 22, 2015 9:44:48 AM (10 years ago)
Author:
vboxsync
Message:

VMM, SUPDrv: More fine-grained error codes and checking, corrected typo in a couple of existing error codes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/SUPDrv.cpp

    r57041 r57051  
    37943794    fMaybeSmxMode       = RT_BOOL(ASMGetCR4() & X86_CR4_SMXE);
    37953795    fMsrLocked          = RT_BOOL(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_LOCK);
    3796     fSmxVmxAllowed      = RT_BOOL(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_SMX_VMXON);
    3797     fVmxAllowed         = RT_BOOL(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_VMXON);
     3796    fSmxVmxAllowed      = RT_BOOL(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_SMX_VMX);
     3797    fVmxAllowed         = RT_BOOL(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_VMX);
    37983798    fIsSmxModeAmbiguous = false;
    37993799    rc                  = VERR_INTERNAL_ERROR_5;
     
    38053805            rc = VINF_SUCCESS;
    38063806        else if (!fVmxAllowed && !fSmxVmxAllowed)
    3807             rc = VERR_VMX_MSR_ALL_VMXON_DISABLED;
     3807            rc = VERR_VMX_MSR_ALL_VMX_DISABLED;
    38083808        else if (!fMaybeSmxMode)
    38093809        {
     
    38113811                rc = VINF_SUCCESS;
    38123812            else
    3813                 rc = VERR_VMX_MSR_VMXON_DISABLED;
     3813                rc = VERR_VMX_MSR_VMX_DISABLED;
    38143814        }
    38153815        else
     
    38313831         * this MSR can no longer be modified.
    38323832         *
    3833          * Set both the VMXON and SMX_VMXON bits (if supported) as we can't determine SMX mode
     3833         * Set both the VMX and SMX_VMX bits (if supported) as we can't determine SMX mode
    38343834         * accurately. See @bugref{6873}.
    38353835         *
    3836          * We need to check for VMX-in-SMX hardware support here, before writing the MSR as
     3836         * We need to check for SMX hardware support here, before writing the MSR as
    38373837         * otherwise we will #GP fault on CPUs that do not support it. Callers do not check
    38383838         * for it.
     
    38553855
    38563856        u64FeatMsr |= MSR_IA32_FEATURE_CONTROL_LOCK
    3857                     | MSR_IA32_FEATURE_CONTROL_VMXON;
     3857                    | MSR_IA32_FEATURE_CONTROL_VMX;
    38583858        if (fSmxVmxHwSupport)
    3859             u64FeatMsr |= MSR_IA32_FEATURE_CONTROL_SMX_VMXON;
     3859            u64FeatMsr |= MSR_IA32_FEATURE_CONTROL_SMX_VMX;
    38603860
    38613861        /*
     
    38803880        else
    38813881            fMsrLocked = RT_BOOL(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_LOCK);
    3882         fSmxVmxAllowed = fMsrLocked && RT_BOOL(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_SMX_VMXON);
    3883         fVmxAllowed    = fMsrLocked && RT_BOOL(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_VMXON);
    3884         if (   fVmxAllowed
    3885             && (   !fSmxVmxHwSupport
    3886                 || fSmxVmxAllowed))
    3887             rc = VINF_SUCCESS;
     3882
     3883        if (fMsrLocked)
     3884        {
     3885            fSmxVmxAllowed = RT_BOOL(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_SMX_VMX);
     3886            fVmxAllowed    = RT_BOOL(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_VMX);
     3887            if (   fVmxAllowed
     3888                && (   !fSmxVmxHwSupport
     3889                    || fSmxVmxAllowed))
     3890            {
     3891                rc = VINF_SUCCESS;
     3892            }
     3893            else
     3894                rc = !fSmxVmxHwSupport ? VERR_VMX_MSR_VMX_ENABLE_FAILED : VERR_VMX_MSR_SMX_VMX_ENABLE_FAILED;
     3895        }
    38883896        else
    38893897            rc = VERR_VMX_MSR_LOCKING_FAILED;
     
    39493957 * @returns VBox status code.
    39503958 * @retval  VERR_VMX_NO_VMX
    3951  * @retval  VERR_VMX_MSR_ALL_VMXON_DISABLED
    3952  * @retval  VERR_VMX_MSR_VMXON_DISABLED
     3959 * @retval  VERR_VMX_MSR_ALL_VMX_DISABLED
     3960 * @retval  VERR_VMX_MSR_VMX_DISABLED
    39533961 * @retval  VERR_VMX_MSR_LOCKING_FAILED
     3962 * @retval  VERR_VMX_MSR_VMX_ENABLE_FAILED
     3963 * @retval  VERR_VMX_MSR_SMX_VMX_ENABLE_FAILED
    39543964 * @retval  VERR_SVM_NO_SVM
    39553965 * @retval  VERR_SVM_DISABLED
     
    40554065 * @returns VBox status code.
    40564066 * @retval  VERR_VMX_NO_VMX
    4057  * @retval  VERR_VMX_MSR_ALL_VMXON_DISABLED
    4058  * @retval  VERR_VMX_MSR_VMXON_DISABLED
     4067 * @retval  VERR_VMX_MSR_ALL_VMX_DISABLED
     4068 * @retval  VERR_VMX_MSR_VMX_DISABLED
    40594069 * @retval  VERR_VMX_MSR_LOCKING_FAILED
     4070 * @retval  VERR_VMX_MSR_VMX_ENABLE_FAILED
     4071 * @retval  VERR_VMX_MSR_SMX_VMX_ENABLE_FAILED
    40604072 * @retval  VERR_SVM_NO_SVM
    40614073 * @retval  VERR_SVM_DISABLED
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette