VirtualBox

Changeset 78932 in vbox


Ignore:
Timestamp:
Jun 3, 2019 11:43:29 AM (6 years ago)
Author:
vboxsync
Message:

VMM/HMVMXR0: Nested VMX: bugref:9180 VM-exit handling for more instructions (rdseed, rdrand, encls, xdtr access instrs., xsaves, xrstors, umwait, tpause)

File:
1 edited

Legend:

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

    r78928 r78932  
    447447static FNVMXEXITHANDLERNSRC        hmR0VmxExitTprBelowThresholdNested;
    448448static FNVMXEXITHANDLER            hmR0VmxExitApicAccessNested;
    449 static FNVMXEXITHANDLER            hmR0VmxExitXdtrAccessNested;
    450449//static FNVMXEXITHANDLER            hmR0VmxExitEptViolation;
    451450//static FNVMXEXITHANDLER            hmR0VmxExitEptMisconfig;
     
    1263612635
    1263712636        /*
    12638          * Instructions that cause VM-exits unconditionally.
     12637         * Instructions that cause VM-exits unconditionally or the condition is
     12638         * always is taken solely from the guest hypervisor (meaning if the VM-exit
     12639         * happens, it's guaranteed to be a nested-guest VM-exit).
     12640         *
    1263912641         *   - Provides VM-exit instruction length ONLY.
    1264012642         */
    12641         case VMX_EXIT_CPUID:
     12643        case VMX_EXIT_CPUID:              /* Unconditional. */
    1264212644        case VMX_EXIT_VMCALL:
    1264312645        case VMX_EXIT_GETSEC:
     
    1264712649        case VMX_EXIT_VMRESUME:
    1264812650        case VMX_EXIT_VMXOFF:
     12651        case VMX_EXIT_ENCLS:              /* Condition specified solely by guest hypervisor. */
     12652        case VMX_EXIT_VMFUNC:
    1264912653            return hmR0VmxExitInstrNested(pVCpu, pVmxTransient);
    1265012654
    1265112655        /*
    12652          * Instructions that cause VM-exits unconditionally.
     12656         * Instructions that cause VM-exits unconditionally or the condition is
     12657         * always is taken solely from the guest hypervisor (meaning if the VM-exit
     12658         * happens, it's guaranteed to be a nested-guest VM-exit).
     12659         *
    1265312660         *   - Provides VM-exit instruction length.
    1265412661         *   - Provides VM-exit information.
     
    1266112668         * See Intel spec. 27.2.1 "Basic VM-Exit Information".
    1266212669         */
    12663         case VMX_EXIT_INVEPT:
     12670        case VMX_EXIT_INVEPT:             /* Unconditional. */
    1266412671        case VMX_EXIT_INVVPID:
    1266512672        case VMX_EXIT_VMCLEAR:
     
    1266712674        case VMX_EXIT_VMPTRST:
    1266812675        case VMX_EXIT_VMXON:
     12676        case VMX_EXIT_GDTR_IDTR_ACCESS:   /* Condition specified solely by guest hypervisor. */
     12677        case VMX_EXIT_LDTR_TR_ACCESS:
     12678        case VMX_EXIT_RDRAND:
     12679        case VMX_EXIT_RDSEED:
     12680        case VMX_EXIT_XSAVES:
     12681        case VMX_EXIT_XRSTORS:
     12682        case VMX_EXIT_UMWAIT:
     12683        case VMX_EXIT_TPAUSE:
    1266912684            return hmR0VmxExitInstrWithInfoNested(pVCpu, pVmxTransient);
    1267012685
     
    1269512710        case VMX_EXIT_RDPMC:                    return hmR0VmxExitRdpmcNested(pVCpu, pVmxTransient);
    1269612711
    12697         case VMX_EXIT_GDTR_IDTR_ACCESS:
    12698         case VMX_EXIT_LDTR_TR_ACCESS:           return hmR0VmxExitXdtrAccessNested(pVCpu, pVmxTransient);
    1269912712
    1270012713        case VMX_EXIT_VMREAD:
     
    1271912732        case VMX_EXIT_VIRTUALIZED_EOI:
    1272012733        case VMX_EXIT_APIC_WRITE:
    12721         case VMX_EXIT_RDRAND:
    1272212734        case VMX_EXIT_RSM:
    12723         case VMX_EXIT_VMFUNC:
    12724         case VMX_EXIT_ENCLS:
    12725         case VMX_EXIT_RDSEED:
    12726         case VMX_EXIT_XSAVES:
    12727         case VMX_EXIT_XRSTORS:
    12728         case VMX_EXIT_UMWAIT:
    12729         case VMX_EXIT_TPAUSE:
    1273012735        default:
    1273112736        {
     
    1640016405
    1640116406/**
    16402  * Nested-guest VM-exit handler for XDTR (LGDT, SGDT, LIDT, SIDT) accesses
    16403  * (VMX_EXIT_GDTR_IDTR_ACCESS) and LDT and TR access (LLDT, LTR, SLDT, STR).
    16404  * Conditional VM-exit.
    16405  */
    16406 HMVMX_EXIT_DECL hmR0VmxExitXdtrAccessNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
    16407 {
    16408     HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
    16409 
    16410     Assert(CPUMIsGuestVmxProcCtls2Set(pVCpu, &pVCpu->cpum.GstCtx, VMX_PROC_CTLS2_DESC_TABLE_EXIT));
    16411     int rc = hmR0VmxReadExitQualVmcs(pVCpu, pVmxTransient);
    16412     rc    |= hmR0VmxReadExitInstrLenVmcs(pVmxTransient);
    16413     rc    |= hmR0VmxReadExitInstrInfoVmcs(pVmxTransient);
    16414     AssertRCReturn(rc, rc);
    16415 
    16416     VMXVEXITINFO ExitInfo;
    16417     RT_ZERO(ExitInfo);
    16418     ExitInfo.cbInstr   = pVmxTransient->cbInstr;
    16419     ExitInfo.u64Qual   = pVmxTransient->uExitQual;
    16420     ExitInfo.InstrInfo = pVmxTransient->ExitInstrInfo;
    16421     return IEMExecVmxVmexitInstrWithInfo(pVCpu, &ExitInfo);
    16422 }
    16423 
    16424 
    16425 /**
    1642616407 * Nested-guest VM-exit handler for RDTSCP (VMX_EXIT_RDTSCP). Conditional VM-exit.
    1642716408 */
     
    1649516476    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
    1649616477
     16478#ifdef VBOX_STRICT
     16479    PCCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
     16480    switch (pVmxTransient->uExitReason)
     16481    {
     16482        case VMX_EXIT_ENCLS:
     16483            Assert(CPUMIsGuestVmxProcCtls2Set(pVCpu, pCtx, VMX_PROC_CTLS2_ENCLS_EXIT));
     16484            break;
     16485
     16486        case VMX_EXIT_VMFUNC:
     16487            Assert(CPUMIsGuestVmxProcCtls2Set(pVCpu, pCtx, VMX_PROC_CTLS2_VMFUNC));
     16488            break;
     16489    }
     16490#endif
     16491
    1649716492    int rc = hmR0VmxReadExitInstrLenVmcs(pVmxTransient);
    1649816493    AssertRCReturn(rc, rc);
     
    1650216497
    1650316498/**
    16504  * Nested-guest VM-exit handler for instructions that cause VM-exits uncondtionally
    16505  * but provide instruction length as well as more information.
     16499 * Nested-guest VM-exit handler for instructions that provide instruction length as
     16500 * well as more information.
    1650616501 *
    1650716502 * Unconditional VM-exit.
     
    1651016505{
    1651116506    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     16507
     16508#ifdef VBOX_STRICT
     16509    PCCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
     16510    switch (pVmxTransient->uExitReason)
     16511    {
     16512        case VMX_EXIT_GDTR_IDTR_ACCESS:
     16513        case VMX_EXIT_LDTR_TR_ACCESS:
     16514            Assert(CPUMIsGuestVmxProcCtls2Set(pVCpu, pCtx, VMX_PROC_CTLS2_DESC_TABLE_EXIT));
     16515            break;
     16516
     16517        case VMX_EXIT_RDRAND:
     16518            Assert(CPUMIsGuestVmxProcCtls2Set(pVCpu, pCtx, VMX_PROC_CTLS2_RDRAND_EXIT));
     16519            break;
     16520
     16521        case VMX_EXIT_RDSEED:
     16522            Assert(CPUMIsGuestVmxProcCtls2Set(pVCpu, pCtx, VMX_PROC_CTLS2_RDSEED_EXIT));
     16523            break;
     16524
     16525        case VMX_EXIT_XSAVES:
     16526        case VMX_EXIT_XRSTORS:
     16527            /** @todo NSTVMX: Verify XSS-bitmap. */
     16528            Assert(CPUMIsGuestVmxProcCtls2Set(pVCpu, pCtx, VMX_PROC_CTLS2_XSAVES_XRSTORS));
     16529            break;
     16530
     16531        case VMX_EXIT_UMWAIT:
     16532        case VMX_EXIT_TPAUSE:
     16533            Assert(CPUMIsGuestVmxProcCtlsSet(pVCpu, pCtx, VMX_PROC_CTLS_RDTSC_EXIT));
     16534            Assert(CPUMIsGuestVmxProcCtls2Set(pVCpu, pCtx, VMX_PROC_CTLS2_USER_WAIT_PAUSE));
     16535            break;
     16536    }
     16537#endif
    1651216538
    1651316539    int rc  = hmR0VmxReadExitInstrLenVmcs(pVmxTransient);
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