VirtualBox

Changeset 93199 in vbox for trunk


Ignore:
Timestamp:
Jan 12, 2022 12:35:29 PM (3 years ago)
Author:
vboxsync
Message:

VMM: Nested VMX: bugref:10092 Added INVEPT VM-exit.

File:
1 edited

Legend:

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

    r93133 r93199  
    250250static FNVMXEXITHANDLER            vmxHCExitVmxon;
    251251static FNVMXEXITHANDLER            vmxHCExitInvvpid;
     252# ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT
     253static FNVMXEXITHANDLER            vmxHCExitInvept;
     254# endif
    252255#endif
    253256static FNVMXEXITHANDLER            vmxHCExitRdtsc;
     
    680683    /* 48  VMX_EXIT_EPT_VIOLATION           */  { vmxHCExitEptViolation },
    681684    /* 49  VMX_EXIT_EPT_MISCONFIG           */  { vmxHCExitEptMisconfig },
     685#if defined(VBOX_WITH_NESTED_HWVIRT_VMX) && defined(VBOX_WITH_NESTED_HWVIRT_VMX_EPT)
     686    /* 50  VMX_EXIT_INVEPT                  */  { vmxHCExitInvept },
     687#else
    682688    /* 50  VMX_EXIT_INVEPT                  */  { vmxHCExitSetPendingXcptUD },
     689#endif
    683690    /* 51  VMX_EXIT_RDTSCP                  */  { vmxHCExitRdtscp },
    684691    /* 52  VMX_EXIT_PREEMPT_TIMER           */  { vmxHCExitPreemptTimer },
     
    53375344        case VMX_EXIT_VMXON:                   VMEXIT_CALL_RET(0, vmxHCExitVmxon(pVCpu, pVmxTransient));
    53385345        case VMX_EXIT_INVVPID:                 VMEXIT_CALL_RET(0, vmxHCExitInvvpid(pVCpu, pVmxTransient));
    5339         case VMX_EXIT_INVEPT:                  VMEXIT_CALL_RET(0, vmxHCExitSetPendingXcptUD(pVCpu, pVmxTransient));
    53405346#else
    53415347        case VMX_EXIT_VMCLEAR:
     
    53495355        case VMX_EXIT_VMXON:
    53505356        case VMX_EXIT_INVVPID:
    5351         case VMX_EXIT_INVEPT:
    53525357            return vmxHCExitSetPendingXcptUD(pVCpu, pVmxTransient);
     5358#endif
     5359#if defined(VBOX_WITH_NESTED_HWVIRT_VMX) && defined(VBOX_WITH_NESTED_HWVIRT_VMX_EPT)
     5360        case VMX_EXIT_INVEPT:                  VMEXIT_CALL_RET(0, vmxHCExitInvept(pVCpu, pVmxTransient));
     5361#else
     5362        case VMX_EXIT_INVEPT:                  return vmxHCExitSetPendingXcptUD(pVCpu, pVmxTransient);
    53535363#endif
    53545364
     
    92529262    return rcStrict;
    92539263}
     9264
     9265
     9266# ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT
     9267/**
     9268 * VM-exit handler for INVEPT (VMX_EXIT_INVEPT). Unconditional VM-exit.
     9269 */
     9270HMVMX_EXIT_DECL vmxHCExitInvept(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
     9271{
     9272    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     9273
     9274    vmxHCReadExitInstrLenVmcs(pVCpu, pVmxTransient);
     9275    vmxHCReadExitInstrInfoVmcs(pVCpu, pVmxTransient);
     9276    vmxHCReadExitQualVmcs(pVCpu, pVmxTransient);
     9277    int rc = vmxHCImportGuestState(pVCpu, pVmxTransient->pVmcsInfo, CPUMCTX_EXTRN_RSP | CPUMCTX_EXTRN_SREG_MASK
     9278                                                                    | IEM_CPUMCTX_EXTRN_EXEC_DECODED_MEM_MASK);
     9279    AssertRCReturn(rc, rc);
     9280
     9281    HMVMX_CHECK_EXIT_DUE_TO_VMX_INSTR(pVCpu, pVmxTransient->uExitReason);
     9282
     9283    VMXVEXITINFO ExitInfo;
     9284    RT_ZERO(ExitInfo);
     9285    ExitInfo.uReason     = pVmxTransient->uExitReason;
     9286    ExitInfo.u64Qual     = pVmxTransient->uExitQual;
     9287    ExitInfo.InstrInfo.u = pVmxTransient->ExitInstrInfo.u;
     9288    ExitInfo.cbInstr     = pVmxTransient->cbExitInstr;
     9289    HMVMX_DECODE_MEM_OPERAND(pVCpu, ExitInfo.InstrInfo.u, ExitInfo.u64Qual, VMXMEMACCESS_READ, &ExitInfo.GCPtrEffAddr);
     9290
     9291    VBOXSTRICTRC rcStrict = IEMExecDecodedInvept(pVCpu, &ExitInfo);
     9292    if (RT_LIKELY(rcStrict == VINF_SUCCESS))
     9293        ASMAtomicUoOrU64(&VCPU_2_VMXSTATE(pVCpu).fCtxChanged, HM_CHANGED_GUEST_RIP | HM_CHANGED_GUEST_RFLAGS);
     9294    else if (rcStrict == VINF_IEM_RAISED_XCPT)
     9295    {
     9296        ASMAtomicUoOrU64(&VCPU_2_VMXSTATE(pVCpu).fCtxChanged, HM_CHANGED_RAISED_XCPT_MASK);
     9297        rcStrict = VINF_SUCCESS;
     9298    }
     9299    return rcStrict;
     9300}
     9301# endif /* VBOX_WITH_NESTED_HWVIRT_VMX_EPT */
    92549302#endif /* VBOX_WITH_NESTED_HWVIRT_VMX */
    92559303/** @} */
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