VirtualBox

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


Ignore:
Timestamp:
Dec 8, 2017 7:59:16 AM (7 years ago)
Author:
vboxsync
Message:

VMM/HMSVMR0: Nested Hw.virt: Added hmR0SvmExitXcptGeneric to redirect all un-intercepted exceptions by the nested-guest
back to the outer guest.

File:
1 edited

Legend:

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

    r70004 r70005  
    335335static FNSVMEXITHANDLER hmR0SvmExitInvlpga;
    336336static FNSVMEXITHANDLER hmR0SvmExitVmrun;
     337static FNSVMEXITHANDLER hmR0SvmExitXcptGeneric;
    337338static FNSVMEXITHANDLER hmR0SvmNestedExitXcptDB;
    338339static FNSVMEXITHANDLER hmR0SvmNestedExitXcptBP;
     
    48914892
    48924893        case SVM_EXIT_INTR:
     4894        case SVM_EXIT_NMI:
     4895        {
     4896            /* We shouldn't direct physical interrupts, NMIs to the nested-guest. */
     4897            return hmR0SvmExitIntr(pVCpu, pCtx, pSvmTransient);
     4898        }
     4899
    48934900        case SVM_EXIT_FERR_FREEZE:
    4894         case SVM_EXIT_NMI:
    4895         {
    4896             /* We shouldn't direct physical interrupts, NMI, FERR to the nested-guest. */
     4901        {
     4902            if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_VINTR))
     4903                return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
    48974904            return hmR0SvmExitIntr(pVCpu, pCtx, pSvmTransient);
    48984905        }
     
    49684975                    if (HMIsGuestSvmXcptInterceptSet(pVCpu, pCtx, uVector))
    49694976                        return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
    4970                     /** @todo Write hmR0SvmExitXcptGeneric! */
    4971                     return VERR_NOT_IMPLEMENTED;
     4977                    return hmR0SvmExitXcptGeneric(pVCpu, pCtx, pSvmTransient);
    49724978                }
    49734979
     
    49985004                        return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
    49995005                    return hmR0SvmExitShutdown(pVCpu, pCtx, pSvmTransient);
    5000                 }
    5001 
    5002                 case SVM_EXIT_SMI:
    5003                 {
    5004                     if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_SMI))
    5005                         return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
    5006                     return hmR0SvmExitUnexpected(pVCpu, pCtx, pSvmTransient);
    5007                 }
    5008 
    5009                 case SVM_EXIT_INIT:
    5010                 {
    5011                     if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_INIT))
    5012                         return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
    5013                     return hmR0SvmExitUnexpected(pVCpu, pCtx, pSvmTransient);
    50145006                }
    50155007
     
    50795071                }
    50805072
    5081                 case SVM_EXIT_NPF:
     5073                case SVM_EXIT_SMI:
     5074                case SVM_EXIT_INIT:
     5075                case SVM_EXIT_NPF: /* We don't yet support nested-paging for nested-guests, so this should never happen. */
    50825076                {
    5083                     /* We don't yet support nested-paging for nested-guests, so this should never really happen. */
    50845077                    return hmR0SvmExitUnexpected(pVCpu, pCtx, pSvmTransient);
    50855078                }
     
    74927485
    74937486/**
     7487 * \#VMEXIT handler for generic exceptions. Conditional \#VMEXIT.
     7488 */
     7489HMSVM_EXIT_DECL hmR0SvmExitXcptGeneric(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
     7490{
     7491    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     7492
     7493    /** @todo if triple-fault is returned in nested-guest scenario convert to a
     7494     *        shutdown VMEXIT. */
     7495    HMSVM_CHECK_EXIT_DUE_TO_EVENT_DELIVERY();
     7496
     7497    PSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu, pCtx);
     7498    uint8_t const  uVector  = pVmcb->ctrl.u64ExitCode - SVM_EXIT_EXCEPTION_0;
     7499    uint32_t const uErrCode = pVmcb->ctrl.u64ExitInfo1;
     7500    Assert(pSvmTransient->u64ExitCode == pVmcb->ctrl.u64ExitCode);
     7501    Assert(uVector <= X86_XCPT_LAST);
     7502
     7503    SVMEVENT Event;
     7504    Event.u          = 0;
     7505    Event.n.u1Valid  = 1;
     7506    Event.n.u3Type   = SVM_EVENT_EXCEPTION;
     7507    Event.n.u8Vector = uVector;
     7508    switch (uVector)
     7509    {
     7510        case X86_XCPT_PF:
     7511        case X86_XCPT_DF:
     7512        case X86_XCPT_TS:
     7513        case X86_XCPT_NP:
     7514        case X86_XCPT_SS:
     7515        case X86_XCPT_GP:
     7516        case X86_XCPT_AC:
     7517        {
     7518            Event.n.u1ErrorCodeValid = 1;
     7519            Event.n.u32ErrorCode     = uErrCode;
     7520            break;
     7521        }
     7522    }
     7523
     7524    hmR0SvmSetPendingEvent(pVCpu, &Event, 0 /* GCPtrFaultAddress */);
     7525    return VINF_SUCCESS;
     7526}
     7527
     7528
     7529/**
    74947530 * Nested-guest \#VMEXIT handler for debug exceptions (SVM_EXIT_EXCEPTION_1).
    74957531 * Unconditional \#VMEXIT.
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