VirtualBox

Changeset 68311 in vbox for trunk


Ignore:
Timestamp:
Aug 7, 2017 8:15:17 AM (7 years ago)
Author:
vboxsync
Message:

VMM/HMSVMR0: Nested Hw.virt interrupt logic bits.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp

    r68305 r68311  
    314314static FNSVMEXITHANDLER hmR0SvmExitInvlpga;
    315315static FNSVMEXITHANDLER hmR0SvmExitVmrun;
     316static FNSVMEXITHANDLER hmR0SvmNestedExitIret;
     317static FNSVMEXITHANDLER hmR0SvmNestedExitVIntr;
    316318#endif
    317319/** @} */
     
    30263028            hmR0SvmSetIretIntercept(pVmcbNstGst);
    30273029        else if (fIntShadow)
     3030        {
     3031            /** @todo Figure this out, how we shall manage virt. intercept if the
     3032             *        nested-guest already has one set and/or if we really need it? */
     3033#if 0
    30283034            hmR0SvmSetVirtIntrIntercept(pVmcbNstGst);
     3035#endif
     3036        }
    30293037        else
    30303038        {
     
    30793087        }
    30803088        else
     3089        {
     3090            /** @todo Figure this out, how we shall manage virt. intercept if the
     3091             *        nested-guest already has one set and/or if we really need it? */
     3092#if 0
    30813093            hmR0SvmSetVirtIntrIntercept(pVmcbNstGst);
     3094#endif
     3095        }
    30823096    }
    30833097    /*
     
    31403154            hmR0SvmSetIretIntercept(pVmcb);
    31413155            VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_NMI);
     3156            return;
    31423157        }
    31433158    }
     
    46284643            if (pVmcbNstGstCache->u64InterceptCtrl & SVM_CTRL_INTERCEPT_VINTR)
    46294644                return hmR0SvmExecVmexit(pVCpu, pCtx);
    4630             return hmR0SvmExitVIntr(pVCpu, pCtx, pSvmTransient);
     4645            return hmR0SvmNestedExitVIntr(pVCpu, pCtx, pSvmTransient);
    46314646        }
    46324647
     
    47414756                    if (pVmcbNstGstCache->u64InterceptCtrl & SVM_CTRL_INTERCEPT_IRET)
    47424757                        return hmR0SvmExecVmexit(pVCpu, pCtx);
    4743                     return hmR0SvmExitIret(pVCpu, pCtx, pSvmTransient);
     4758                    return hmR0SvmNestedExitIret(pVCpu, pCtx, pSvmTransient);
    47444759                }
    47454760
     
    74617476    return VBOXSTRICTRC_VAL(rcStrict);
    74627477}
     7478
     7479/**
     7480 * Nested-guest \#VMEXIT handler for IRET (SVM_EXIT_VMRUN). Conditional \#VMEXIT.
     7481 */
     7482HMSVM_EXIT_DECL hmR0SvmNestedExitIret(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
     7483{
     7484    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     7485
     7486    /* Clear NMI blocking. */
     7487    VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_BLOCK_NMIS);
     7488
     7489    /* Indicate that we no longer need to #VMEXIT when the guest is ready to receive NMIs, it is now ready. */
     7490    PSVMVMCB pVmcbNstGst = pCtx->hwvirt.svm.CTX_SUFF(pVmcb);
     7491    hmR0SvmClearIretIntercept(pVmcbNstGst);
     7492
     7493    /* Deliver the pending NMI via hmR0SvmEvaluatePendingEventNested() and resume guest execution. */
     7494    return VINF_SUCCESS;
     7495}
     7496
     7497
     7498/**
     7499 * \#VMEXIT handler for virtual interrupt (SVM_EXIT_VINTR). Conditional
     7500 * \#VMEXIT.
     7501 */
     7502HMSVM_EXIT_DECL hmR0SvmNestedExitVIntr(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
     7503{
     7504    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     7505
     7506    /* No virtual interrupts pending, we'll inject the current one/NMI before reentry. */
     7507    PSVMVMCB pVmcbNstGst = pCtx->hwvirt.svm.CTX_SUFF(pVmcb);
     7508    pVmcbNstGst->ctrl.IntCtrl.n.u1VIrqPending = 0;
     7509    pVmcbNstGst->ctrl.IntCtrl.n.u8VIntrVector = 0;
     7510
     7511    /* Indicate that we no longer need to #VMEXIT when the nested-guest is ready to receive interrupts/NMIs, it is now ready. */
     7512    pVmcbNstGst->ctrl.u64InterceptCtrl &= ~SVM_CTRL_INTERCEPT_VINTR;
     7513    pVmcbNstGst->ctrl.u64VmcbCleanBits &= ~(HMSVM_VMCB_CLEAN_INTERCEPTS | HMSVM_VMCB_CLEAN_TPR);
     7514
     7515    /* Deliver the pending interrupt/NMI via hmR0SvmEvaluatePendingEventNested() and resume guest execution. */
     7516    STAM_COUNTER_INC(&pVCpu->hm.s.StatExitIntWindow);
     7517    return VINF_SUCCESS;
     7518}
     7519
    74637520#endif /* VBOX_WITH_NESTED_HWVIRT */
    74647521
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