VirtualBox

Ignore:
Timestamp:
Sep 10, 2018 7:48:40 AM (6 years ago)
Author:
vboxsync
Message:

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

File:
1 edited

Legend:

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

    r74167 r74171  
    29172917     * Activity state.
    29182918     */
    2919     if (!(pVmcs->u32GuestActivityState & VMX_V_GUEST_ACTIVITY_STATE_MASK))
     2919    uint64_t const u64GuestVmxMiscMsr = CPUMGetGuestIa32VmxMisc(pVCpu);
     2920    uint32_t const fActivityStateMask = RT_BF_GET(u64GuestVmxMiscMsr, VMX_BF_MISC_ACTIVITY_STATES);
     2921    if (!(pVmcs->u32GuestActivityState & fActivityStateMask))
    29202922    { /* likely */ }
    29212923    else
     
    29232925
    29242926    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     }
     2927
     2928    if (   !SsAttr.n.u2Dpl
     2929        || pVmcs->u32GuestActivityState != VMX_VMCS_GUEST_ACTIVITY_HLT)
     2930    { /* likely */ }
     2931    else
     2932        IEM_VMX_VMENTRY_FAILED_RET(pVCpu, pszInstr, pszFailure, kVmxVDiag_Vmentry_GuestActStateSsDpl);
    29322933
    29332934    if (   pVmcs->u32GuestIntrState == VMX_VMCS_GUEST_INT_STATE_BLOCK_STI
     
    29442945        uint8_t const uIntType = VMX_ENTRY_INT_INFO_TYPE(pVmcs->u32EntryIntInfo);
    29452946        uint8_t const uVector  = VMX_ENTRY_INT_INFO_VECTOR(pVmcs->u32EntryIntInfo);
     2947        AssertCompile(VMX_V_GUEST_ACTIVITY_STATE_MASK == (VMX_VMCS_GUEST_ACTIVITY_HLT | VMX_VMCS_GUEST_ACTIVITY_SHUTDOWN));
    29462948        switch (pVmcs->u32GuestActivityState)
    29472949        {
     
    29812983     * Interruptibility state.
    29822984     */
    2983     /** @todo NSTVMX: interruptibility-state. */
     2985    if (!(pVmcs->u32GuestIntrState & ~VMX_VMCS_GUEST_INT_STATE_MASK))
     2986    { /* likely */ }
     2987    else
     2988        IEM_VMX_VMENTRY_FAILED_RET(pVCpu, pszInstr, pszFailure, kVmxVDiag_Vmentry_GuestIntStateRsvd);
     2989
     2990    if ((pVmcs->u32GuestIntrState & (VMX_VMCS_GUEST_INT_STATE_BLOCK_MOVSS | VMX_VMCS_GUEST_INT_STATE_BLOCK_STI))
     2991                                 != (VMX_VMCS_GUEST_INT_STATE_BLOCK_MOVSS | VMX_VMCS_GUEST_INT_STATE_BLOCK_STI))
     2992    { /* likely */ }
     2993    else
     2994        IEM_VMX_VMENTRY_FAILED_RET(pVCpu, pszInstr, pszFailure, kVmxVDiag_Vmentry_GuestIntStateStiMovSs);
     2995
     2996    if (    (pVmcs->u64GuestRFlags.u & X86_EFL_IF)
     2997        || !(pVmcs->u32GuestIntrState & VMX_VMCS_GUEST_INT_STATE_BLOCK_STI))
     2998    { /* likely */ }
     2999    else
     3000        IEM_VMX_VMENTRY_FAILED_RET(pVCpu, pszInstr, pszFailure, kVmxVDiag_Vmentry_GuestIntStateRFlagsSti);
     3001
     3002    if (VMX_ENTRY_INT_INFO_IS_VALID(pVmcs->u32EntryIntInfo))
     3003    {
     3004        uint8_t const uIntType = VMX_ENTRY_INT_INFO_TYPE(pVmcs->u32EntryIntInfo);
     3005        if (uIntType == VMX_ENTRY_INT_INFO_TYPE_EXT_INT)
     3006        {
     3007            if (!(pVmcs->u32GuestIntrState & (VMX_VMCS_GUEST_INT_STATE_BLOCK_MOVSS | VMX_VMCS_GUEST_INT_STATE_BLOCK_STI)))
     3008            { /* likely */ }
     3009            else
     3010                IEM_VMX_VMENTRY_FAILED_RET(pVCpu, pszInstr, pszFailure, kVmxVDiag_Vmentry_GuestIntStateExtInt);
     3011        }
     3012        else if (uIntType == VMX_ENTRY_INT_INFO_TYPE_NMI)
     3013        {
     3014            if (!(pVmcs->u32GuestIntrState & (VMX_VMCS_GUEST_INT_STATE_BLOCK_MOVSS | VMX_VMCS_GUEST_INT_STATE_BLOCK_STI)))
     3015            { /* likely */ }
     3016            else
     3017                IEM_VMX_VMENTRY_FAILED_RET(pVCpu, pszInstr, pszFailure, kVmxVDiag_Vmentry_GuestIntStateNmi);
     3018
     3019            if (   !(pVmcs->u32PinCtls & VMX_PIN_CTLS_VIRT_NMI)
     3020                || !(pVmcs->u32GuestIntrState & VMX_VMCS_GUEST_INT_STATE_BLOCK_NMI))
     3021            { /* likely */ }
     3022            else
     3023               IEM_VMX_VMENTRY_FAILED_RET(pVCpu, pszInstr, pszFailure, kVmxVDiag_Vmentry_GuestIntStateVirtNmi);
     3024        }
     3025    }
     3026
     3027    /* We don't support SMM yet. So blocking-by-SMIs must not be set. */
     3028    if (!(pVmcs->u32GuestIntrState & VMX_VMCS_GUEST_INT_STATE_BLOCK_SMI))
     3029    { /* likely */ }
     3030    else
     3031        IEM_VMX_VMENTRY_FAILED_RET(pVCpu, pszInstr, pszFailure, kVmxVDiag_Vmentry_GuestIntStateSmi);
     3032
     3033    /* We don't support SGX yet. So enclave-interruption must not be set. */
     3034    if (!(pVmcs->u32GuestIntrState & VMX_VMCS_GUEST_INT_STATE_ENCLAVE))
     3035    { /* likely */ }
     3036    else
     3037        IEM_VMX_VMENTRY_FAILED_RET(pVCpu, pszInstr, pszFailure, kVmxVDiag_Vmentry_GuestIntStateEnclave);
     3038
     3039    /** @todo NSTVMX: Pending debug exceptions, VMCS link pointer. */
    29843040
    29853041    NOREF(pszInstr);
     
    34803536        /* TPR threshold without virtual-interrupt delivery. */
    34813537        if (   !(pVmcs->u32ProcCtls2 & VMX_PROC_CTLS2_VIRT_INT_DELIVERY)
    3482             &&  (pVmcs->u32TprThreshold & VMX_TPR_THRESHOLD_MASK))
    3483             IEM_VMX_VMENTRY_FAILED_RET(pVCpu, pszInstr, pszFailure, kVmxVDiag_Vmentry_TprThreshold);
     3538            &&  (pVmcs->u32TprThreshold & ~VMX_TPR_THRESHOLD_MASK))
     3539            IEM_VMX_VMENTRY_FAILED_RET(pVCpu, pszInstr, pszFailure, kVmxVDiag_Vmentry_TprThresholdRsvd);
    34843540
    34853541        /* TPR threshold and VTPR. */
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