VirtualBox

Changeset 78834 in vbox for trunk


Ignore:
Timestamp:
May 29, 2019 3:47:44 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
130934
Message:

VMM/HMVMXR0: Nested VMX: bugref:9180 VM-exit cleanup.

File:
1 edited

Legend:

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

    r78808 r78834  
    403403static FNVMXEXITHANDLERNSRC        hmR0VmxExitWbinvd;
    404404static FNVMXEXITHANDLER            hmR0VmxExitXsetbv;
    405 static FNVMXEXITHANDLER            hmR0VmxExitRdrand;
    406405static FNVMXEXITHANDLER            hmR0VmxExitInvpcid;
    407406static FNVMXEXITHANDLERNSRC        hmR0VmxExitSetPendingXcptUD;
     
    456455static FNVMXEXITHANDLERNSRC        hmR0VmxExitWbinvdNested;
    457456//static FNVMXEXITHANDLER            hmR0VmxExitXsetbv;
    458 //static FNVMXEXITHANDLER            hmR0VmxExitRdrand;
     457//static FNVMXEXITHANDLER            hmR0VmxExitErrUnexpected;
    459458static FNVMXEXITHANDLER            hmR0VmxExitInvpcidNested;
    460459//static FNVMXEXITHANDLERNSRC        hmR0VmxExitSetPendingXcptUD;
     
    562561    /* 15  VMX_EXIT_RDPMC                   */  hmR0VmxExitRdpmc,
    563562    /* 16  VMX_EXIT_RDTSC                   */  hmR0VmxExitRdtsc,
    564     /* 17  VMX_EXIT_RSM                     */  hmR0VmxExitSetPendingXcptUD,
     563    /* 17  VMX_EXIT_RSM                     */  hmR0VmxExitErrUnexpected,
    565564    /* 18  VMX_EXIT_VMCALL                  */  hmR0VmxExitVmcall,
    566565#ifdef VBOX_WITH_NESTED_HWVIRT_VMX
     
    618617    /* 55  VMX_EXIT_XSETBV                  */  hmR0VmxExitXsetbv,
    619618    /* 56  VMX_EXIT_APIC_WRITE              */  hmR0VmxExitErrUnexpected,
    620     /* 57  VMX_EXIT_RDRAND                  */  hmR0VmxExitRdrand,
     619    /* 57  VMX_EXIT_RDRAND                  */  hmR0VmxExitErrUnexpected,
    621620    /* 58  VMX_EXIT_INVPCID                 */  hmR0VmxExitInvpcid,
    622     /* 59  VMX_EXIT_VMFUNC                  */  hmR0VmxExitSetPendingXcptUD,
    623     /* 60  VMX_EXIT_ENCLS                   */  hmR0VmxExitSetPendingXcptUD,
    624     /* 61  VMX_EXIT_RDSEED                  */  hmR0VmxExitSetPendingXcptUD,
     621    /* 59  VMX_EXIT_VMFUNC                  */  hmR0VmxExitErrUnexpected,
     622    /* 60  VMX_EXIT_ENCLS                   */  hmR0VmxExitErrUnexpected,
     623    /* 61  VMX_EXIT_RDSEED                  */  hmR0VmxExitErrUnexpected,
    625624    /* 62  VMX_EXIT_PML_FULL                */  hmR0VmxExitErrUnexpected,
    626     /* 63  VMX_EXIT_XSAVES                  */  hmR0VmxExitSetPendingXcptUD,
    627     /* 64  VMX_EXIT_XRSTORS                 */  hmR0VmxExitSetPendingXcptUD,
     625    /* 63  VMX_EXIT_XSAVES                  */  hmR0VmxExitErrUnexpected,
     626    /* 64  VMX_EXIT_XRSTORS                 */  hmR0VmxExitErrUnexpected,
    628627    /* 65  UNDEFINED                        */  hmR0VmxExitErrUnexpected,
    629628    /* 66  VMX_EXIT_SPP_EVENT               */  hmR0VmxExitErrUnexpected,
    630     /* 67  VMX_EXIT_UMWAIT                  */  hmR0VmxExitSetPendingXcptUD,
    631     /* 68  VMX_EXIT_TPAUSE                  */  hmR0VmxExitSetPendingXcptUD,
     629    /* 67  VMX_EXIT_UMWAIT                  */  hmR0VmxExitErrUnexpected,
     630    /* 68  VMX_EXIT_TPAUSE                  */  hmR0VmxExitErrUnexpected,
    632631};
    633632#endif /* HMVMX_USE_FUNCTION_TABLE */
     
    1253912538        case VMX_EXIT_WBINVD:                  VMEXIT_CALL_RET(0, hmR0VmxExitWbinvd(pVCpu, pVmxTransient));
    1254012539        case VMX_EXIT_XSETBV:                  VMEXIT_CALL_RET(0, hmR0VmxExitXsetbv(pVCpu, pVmxTransient));
    12541         case VMX_EXIT_RDRAND:                  VMEXIT_CALL_RET(0, hmR0VmxExitRdrand(pVCpu, pVmxTransient));
    1254212540        case VMX_EXIT_INVPCID:                 VMEXIT_CALL_RET(0, hmR0VmxExitInvpcid(pVCpu, pVmxTransient));
    1254312541        case VMX_EXIT_GETSEC:                  VMEXIT_CALL_RET(0, hmR0VmxExitGetsec(pVCpu, pVmxTransient));
     
    1255412552        case VMX_EXIT_VMXON:                   VMEXIT_CALL_RET(0, hmR0VmxExitVmxon(pVCpu, pVmxTransient));
    1255512553        case VMX_EXIT_INVVPID:                 VMEXIT_CALL_RET(0, hmR0VmxExitInvvpid(pVCpu, pVmxTransient));
     12554        case VMX_EXIT_INVEPT:                  VMEXIT_CALL_RET(0, hmR0VmxExitSetPendingXcptUD(pVCpu, pVmxTransient));
    1255612555#else
    1255712556        case VMX_EXIT_VMCLEAR:
     
    1256512564        case VMX_EXIT_VMXON:
    1256612565        case VMX_EXIT_INVVPID:
     12566        case VMX_EXIT_INVEPT:
    1256712567            return hmR0VmxExitSetPendingXcptUD(pVCpu, pVmxTransient);
    1256812568#endif
     
    1257112571        case VMX_EXIT_NMI_WINDOW:              return hmR0VmxExitNmiWindow(pVCpu, pVmxTransient);
    1257212572        case VMX_EXIT_ERR_INVALID_GUEST_STATE: return hmR0VmxExitErrInvalidGuestState(pVCpu, pVmxTransient);
    12573 
    12574         case VMX_EXIT_RSM:
    12575         case VMX_EXIT_RDSEED:
    12576         case VMX_EXIT_ENCLS:
    12577         case VMX_EXIT_INVEPT:
    12578         case VMX_EXIT_VMFUNC:
    12579         case VMX_EXIT_XSAVES:
    12580         case VMX_EXIT_XRSTORS:
    12581             return hmR0VmxExitSetPendingXcptUD(pVCpu, pVmxTransient);
    1258212573
    1258312574        case VMX_EXIT_INIT_SIGNAL:
     
    1259012581        case VMX_EXIT_VIRTUALIZED_EOI:
    1259112582        case VMX_EXIT_APIC_WRITE:
     12583        case VMX_EXIT_RDRAND:
     12584        case VMX_EXIT_RSM:
     12585        case VMX_EXIT_VMFUNC:
     12586        case VMX_EXIT_ENCLS:
     12587        case VMX_EXIT_RDSEED:
     12588        case VMX_EXIT_XSAVES:
     12589        case VMX_EXIT_XRSTORS:
     12590        case VMX_EXIT_UMWAIT:
     12591        case VMX_EXIT_TPAUSE:
    1259212592        default:
    1259312593            return hmR0VmxExitErrUnexpected(pVCpu, pVmxTransient);
     
    1269612696        case VMX_EXIT_LDTR_TR_ACCESS:   return hmR0VmxExitXdtrAccessNested(pVCpu, pVmxTransient);
    1269712697
    12698         case VMX_EXIT_RDRAND:
    1269912698        case VMX_EXIT_RDPMC:
    1270012699        case VMX_EXIT_VMREAD:
    1270112700        case VMX_EXIT_VMWRITE:
    12702         case VMX_EXIT_RSM:
    12703         case VMX_EXIT_RDSEED:
    12704         case VMX_EXIT_ENCLS:
    12705         case VMX_EXIT_VMFUNC:
    12706         case VMX_EXIT_XSAVES:
    12707         case VMX_EXIT_XRSTORS:
    1270812701
    1270912702        case VMX_EXIT_TRIPLE_FAULT:
     
    1272012713        case VMX_EXIT_VIRTUALIZED_EOI:
    1272112714        case VMX_EXIT_APIC_WRITE:
     12715        case VMX_EXIT_RDRAND:
     12716        case VMX_EXIT_RSM:
     12717        case VMX_EXIT_VMFUNC:
     12718        case VMX_EXIT_ENCLS:
     12719        case VMX_EXIT_RDSEED:
     12720        case VMX_EXIT_XSAVES:
     12721        case VMX_EXIT_XRSTORS:
     12722        case VMX_EXIT_UMWAIT:
     12723        case VMX_EXIT_TPAUSE:
    1272212724        default:
    1272312725        {
     
    1370813710    /*
    1370913711     * Cummulative notes of all recognized but unexpected VM-exits.
    13710      * This does -not- cover those VM-exits like a page-fault occurring when say nested-paging
    13711      * is used.
     13712     *
     13713     * 1. This does -not- cover scenarios like like a page-fault VM-exit occurring when
     13714     *    nested-paging is used.
     13715     *
     13716     * 2. Any instruction that causes a VM-exit unconditionally (for e.g. VMXON) must be
     13717     *    emulated or a #UD must be raised in the guest. Therefore, we should -not- be using
     13718     *    this function (and thereby stop VM execution) for handling such instructions.
     13719     *
    1371213720     *
    1371313721     * VMX_EXIT_INIT_SIGNAL:
     
    1373713745     *    See Intel spec. 25.3 "Other Causes of VM-Exits"
    1373813746     *
     13747     * VMX_EXIT_ERR_MSR_LOAD:
     13748     *    Failures while loading MSRs are part of the VM-entry MSR-load area are unexpected
     13749     *    and typically indicates a bug in the hypervisor code. We thus cannot not resume
     13750     *    execution.
     13751     *
     13752     *    See Intel spec. 26.7 "VM-Entry Failures During Or After Loading Guest State".
     13753     *
    1373913754     * VMX_EXIT_ERR_MACHINE_CHECK:
    1374013755     *    Machine check exceptions indicates a fatal/unrecoverable hardware condition
     
    1374613761     *    See Intel spec. 27.1 "Architectural State Before A VM Exit".
    1374713762     *
    13748      * VMX_EXIT_ERR_MSR_LOAD:
    13749      *    Failures while loading MSRs are part of the VM-entry MSR-load area are unexpected
    13750      *    and typically indicates a bug in the hypervisor code. We thus cannot not resume
    13751      *    execution.
    13752      *
    13753      *    See Intel spec. 26.7 "VM-Entry Failures During Or After Loading Guest State".
    13754      *
    1375513763     * VMX_EXIT_PML_FULL:
    1375613764     * VMX_EXIT_VIRTUALIZED_EOI:
     
    1375813766     *    We do not currently support any of these features and thus they are all unexpected
    1375913767     *    VM-exits.
     13768     *
     13769     * VMX_EXIT_RDRAND:
     13770     * VMX_EXIT_RSM:
     13771     * VMX_EXIT_VMFUNC:
     13772     * VMX_EXIT_ENCLS:
     13773     * VMX_EXIT_RDSEED:
     13774     * VMX_EXIT_XSAVES:
     13775     * VMX_EXIT_XRSTORS:
     13776     * VMX_EXIT_UMWAIT:
     13777     * VMX_EXIT_TPAUSE:
     13778     *    These VM-exits are -not- caused unconditionally by execution of the corresponding
     13779     *    instruction. Any VM-exit for these instructions indicate a hardware problem,
     13780     *    unsupported CPU modes (like SMM) or potentially corrupt VMCS controls.
     13781     *
     13782     *    See Intel spec. 25.1.3 "Instructions That Cause VM Exits Conditionally".
    1376013783     */
    1376113784    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1378013803        return VERR_EM_INTERPRETER;
    1378113804    AssertMsgFailed(("Unexpected XDTR access\n"));
    13782     HMVMX_UNEXPECTED_EXIT_RET(pVCpu, pVmxTransient->uExitReason);
    13783 }
    13784 
    13785 
    13786 /**
    13787  * VM-exit handler for RDRAND (VMX_EXIT_RDRAND). Conditional VM-exit.
    13788  */
    13789 HMVMX_EXIT_DECL hmR0VmxExitRdrand(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
    13790 {
    13791     HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
    13792 
    13793     /* By default, we don't enable VMX_PROC_CTLS2_RDRAND_EXIT. */
    13794     PCVMXVMCSINFO pVmcsInfo = pVmxTransient->pVmcsInfo;
    13795     if (pVmcsInfo->u32ProcCtls2 & VMX_PROC_CTLS2_RDRAND_EXIT)
    13796         return VERR_EM_INTERPRETER;
    13797     AssertMsgFailed(("Unexpected RDRAND exit\n"));
    1379813805    HMVMX_UNEXPECTED_EXIT_RET(pVCpu, pVmxTransient->uExitReason);
    1379913806}
Note: See TracChangeset for help on using the changeset viewer.

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