VirtualBox

Changeset 74166 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Sep 9, 2018 6:11:30 PM (6 years ago)
Author:
vboxsync
Message:

VMM/IEM: Nested VMX: bugref:9180 vmlaunch/vmresume bits.

Location:
trunk/src/VBox/VMM/VMMAll
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/HMVMXAll.cpp

    r74164 r74166  
    150150    VMXV_DIAG_DESC(kVmxVDiag_Vmentry_ExitCtlsAllowed1         , "ExitCtlsAllowed1"          ),
    151151    VMXV_DIAG_DESC(kVmxVDiag_Vmentry_ExitCtlsDisallowed0      , "ExitCtlsDisallowed0"       ),
     152    VMXV_DIAG_DESC(kVmxVDiag_Vmentry_GuestActStateHlt         , "GuestActStateHlt"          ),
     153    VMXV_DIAG_DESC(kVmxVDiag_Vmentry_GuestActStateRsvd        , "GuestActStateRsvd"         ),
     154    VMXV_DIAG_DESC(kVmxVDiag_Vmentry_GuestActStateShutdown    , "GuestActStateShutdown"     ),
     155    VMXV_DIAG_DESC(kVmxVDiag_Vmentry_GuestActStateSsDpl       , "GuestActStateSsDpl"        ),
     156    VMXV_DIAG_DESC(kVmxVDiag_Vmentry_GuestActStateStiMovSs    , "GuestActStateStiMovSs"     ),
    152157    VMXV_DIAG_DESC(kVmxVDiag_Vmentry_GuestCr0Fixed0           , "GuestCr0Fixed0"            ),
    153158    VMXV_DIAG_DESC(kVmxVDiag_Vmentry_GuestCr0Fixed1           , "GuestCr0Fixed1"            ),
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImplVmxInstr.cpp.h

    r74163 r74166  
    29002900
    29012901/**
     2902 * Checks guest non-register state as part of VM-entry.
     2903 *
     2904 * @param   pVCpu           The cross context virtual CPU structure.
     2905 * @param   pszInstr        The VMX instruction name (for logging purposes).
     2906 */
     2907IEM_STATIC int iemVmxVmentryCheckGuestNonRegState(PVMCPU pVCpu,  const char *pszInstr)
     2908{
     2909    /*
     2910     * Guest non-register state.
     2911     * See Intel spec. 26.3.1.5 "Checks on Guest Non-Register State".
     2912     */
     2913    PCVMXVVMCS pVmcs = pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pVmcs);
     2914    const char *const pszFailure = "VM-exit";
     2915
     2916    /*
     2917     * Activity state.
     2918     */
     2919    if (!(pVmcs->u32GuestActivityState & VMX_V_GUEST_ACTIVITY_STATE_MASK))
     2920    { /* likely */ }
     2921    else
     2922        IEM_VMX_VMENTRY_FAILED_RET(pVCpu, pszInstr, pszFailure, kVmxVDiag_Vmentry_GuestActStateRsvd);
     2923
     2924    X86DESCATTR SsAttr; SsAttr.u = pVmcs->u32GuestSsAttr;
     2925    if (SsAttr.n.u2Dpl != 0)
     2926    {
     2927        if (pVmcs->u32GuestActivityState != VMX_VMCS_GUEST_ACTIVITY_HLT)
     2928        { /* likely */ }
     2929        else
     2930            IEM_VMX_VMENTRY_FAILED_RET(pVCpu, pszInstr, pszFailure, kVmxVDiag_Vmentry_GuestActStateSsDpl);
     2931    }
     2932
     2933    if (   pVmcs->u32GuestIntrState == VMX_VMCS_GUEST_INT_STATE_BLOCK_STI
     2934        || pVmcs->u32GuestIntrState == VMX_VMCS_GUEST_INT_STATE_BLOCK_MOVSS)
     2935    {
     2936        if (pVmcs->u32GuestActivityState == VMX_VMCS_GUEST_ACTIVITY_ACTIVE)
     2937        { /* likely */ }
     2938        else
     2939            IEM_VMX_VMENTRY_FAILED_RET(pVCpu, pszInstr, pszFailure, kVmxVDiag_Vmentry_GuestActStateStiMovSs);
     2940    }
     2941
     2942    if (VMX_ENTRY_INT_INFO_IS_VALID(pVmcs->u32EntryIntInfo))
     2943    {
     2944        uint8_t const uIntType = VMX_ENTRY_INT_INFO_TYPE(pVmcs->u32EntryIntInfo);
     2945        uint8_t const uVector  = VMX_ENTRY_INT_INFO_VECTOR(pVmcs->u32EntryIntInfo);
     2946        switch (pVmcs->u32GuestActivityState)
     2947        {
     2948            case VMX_VMCS_GUEST_ACTIVITY_HLT:
     2949            {
     2950                if (   uIntType == VMX_ENTRY_INT_INFO_TYPE_EXT_INT
     2951                    || uIntType == VMX_ENTRY_INT_INFO_TYPE_NMI
     2952                    || (   uIntType == VMX_ENTRY_INT_INFO_TYPE_HW_XCPT
     2953                        && (   uVector == X86_XCPT_DB
     2954                            || uVector == X86_XCPT_MC))
     2955                    || (   uIntType == VMX_ENTRY_INT_INFO_TYPE_OTHER_EVENT
     2956                        && uVector == 0))
     2957                { /* likely */ }
     2958                else
     2959                    IEM_VMX_VMENTRY_FAILED_RET(pVCpu, pszInstr, pszFailure, kVmxVDiag_Vmentry_GuestActStateHlt);
     2960                break;
     2961            }
     2962
     2963            case VMX_VMCS_GUEST_ACTIVITY_SHUTDOWN:
     2964            {
     2965                if (   uIntType == VMX_ENTRY_INT_INFO_TYPE_NMI
     2966                    || (   uIntType == VMX_ENTRY_INT_INFO_TYPE_HW_XCPT
     2967                        && uVector == X86_XCPT_MC))
     2968                { /* likely */ }
     2969                else
     2970                    IEM_VMX_VMENTRY_FAILED_RET(pVCpu, pszInstr, pszFailure, kVmxVDiag_Vmentry_GuestActStateShutdown);
     2971                break;
     2972            }
     2973
     2974            case VMX_VMCS_GUEST_ACTIVITY_ACTIVE:
     2975            default:
     2976                break;
     2977        }
     2978    }
     2979
     2980    /*
     2981     * Interruptibility state.
     2982     */
     2983    /** @todo NSTVMX: interruptibility-state. */
     2984
     2985    NOREF(pszInstr);
     2986    NOREF(pszFailure);
     2987    return VINF_SUCCESS;
     2988}
     2989
     2990
     2991/**
    29022992 * Checks guest-state as part of VM-entry.
    29032993 *
     
    29273017
    29283018    rc = iemVmxVmentryCheckGuestRipRFlags(pVCpu, pszInstr);
     3019    if (rc == VINF_SUCCESS)
     3020    { /* likely */ }
     3021    else
     3022        return rc;
     3023
     3024    rc = iemVmxVmentryCheckGuestNonRegState(pVCpu, pszInstr);
    29293025    if (rc == VINF_SUCCESS)
    29303026    { /* likely */ }
     
    36533749    }
    36543750
    3655 
    36563751    pVCpu->cpum.GstCtx.hwvirt.vmx.enmDiag = kVmxVDiag_Vmentry_Success;
    36573752    iemVmxVmSucceed(pVCpu);
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