VirtualBox

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


Ignore:
Timestamp:
May 31, 2019 9:00:08 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
131007
Message:

VMM/IEM: Nested VMX: bugref:9180 Get the IDT-vectoring info. from IEM during VM-exit rather than recording it in the VMCS directly during event injection and then trying to clear it on VM-exit when its not applicable.
This is so that hardware-assisted VMX execution can pass on the IDT-vectoring info. as part of the VM-exit without the IEM VM-exit code overwriting it.

File:
1 edited

Legend:

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

    r78886 r78889  
    27372737    Assert(!VMX_ENTRY_INT_INFO_IS_VALID(pVmcs->u32EntryIntInfo));
    27382738
    2739     /* Update the VM-exit reason, the other relevant data fields are expected to be updated by the caller already. */
     2739    /*
     2740     * Update the VM-exit reason. Other VMCS data fields are expected to be updated by the caller already.
     2741     */
    27402742    pVmcs->u32RoExitReason = uExitReason;
    27412743    Log3(("vmexit: uExitReason=%#RX32 uExitQual=%#RX64 cs:rip=%04x:%#RX64\n", uExitReason, pVmcs->u64RoExitQual,
     
    27432745
    27442746    /*
    2745      * Clear IDT-vectoring information fields if the VM-exit was not triggered during delivery of an event.
     2747     * Update the IDT-vectoring information fields if the VM-exit is triggered during delivery of an event.
    27462748     * See Intel spec. 27.2.3 "Information for VM Exits During Event Delivery".
    27472749     */
     
    27512753        uint32_t   uErrCode;
    27522754        bool const fInEventDelivery = IEMGetCurrentXcpt(pVCpu, &uVector, &fFlags,  &uErrCode, NULL /* uCr2 */);
    2753         if (!fInEventDelivery)
    2754         {
    2755             iemVmxVmcsSetIdtVectoringInfo(pVCpu, 0);
    2756             iemVmxVmcsSetIdtVectoringErrCode(pVCpu, 0);  /* Not strictly needed but do it for consistency. */
    2757         }
    2758         /* else: Caller would have updated IDT-vectoring information already, see iemVmxVmexitEvent(). */
     2755        if (fInEventDelivery)
     2756        {
     2757            uint8_t  const uIdtVectoringType = iemVmxGetEventType(uVector, fFlags);
     2758            uint8_t  const fErrCodeValid     = RT_BOOL(fFlags & IEM_XCPT_FLAGS_ERR);
     2759            uint32_t const uIdtVectoringInfo = RT_BF_MAKE(VMX_BF_IDT_VECTORING_INFO_VECTOR,         uVector)
     2760                                             | RT_BF_MAKE(VMX_BF_IDT_VECTORING_INFO_TYPE,           uIdtVectoringType)
     2761                                             | RT_BF_MAKE(VMX_BF_IDT_VECTORING_INFO_ERR_CODE_VALID, fErrCodeValid)
     2762                                             | RT_BF_MAKE(VMX_BF_IDT_VECTORING_INFO_VALID,          1);
     2763            iemVmxVmcsSetIdtVectoringInfo(pVCpu, uIdtVectoringInfo);
     2764            iemVmxVmcsSetIdtVectoringErrCode(pVCpu, uErrCode);
     2765        }
    27592766    }
    27602767
     
    39413948    if (!pVCpu->cpum.GstCtx.hwvirt.vmx.fInterceptEvents)
    39423949    {
    3943         /* Update the IDT-vectoring event in the VMCS as the source of the upcoming event. */
    3944         uint8_t  const uIdtVectoringType = iemVmxGetEventType(uVector, fFlags);
    3945         bool     const fErrCodeValid     = RT_BOOL(fFlags & IEM_XCPT_FLAGS_ERR);
    3946         uint32_t const uIdtVectoringInfo = RT_BF_MAKE(VMX_BF_IDT_VECTORING_INFO_VECTOR,         uVector)
    3947                                          | RT_BF_MAKE(VMX_BF_IDT_VECTORING_INFO_TYPE,           uIdtVectoringType)
    3948                                          | RT_BF_MAKE(VMX_BF_IDT_VECTORING_INFO_ERR_CODE_VALID, fErrCodeValid)
    3949                                          | RT_BF_MAKE(VMX_BF_IDT_VECTORING_INFO_VALID,          1);
    3950         iemVmxVmcsSetIdtVectoringInfo(pVCpu, uIdtVectoringInfo);
    3951         iemVmxVmcsSetIdtVectoringErrCode(pVCpu, uErrCode);
    3952 
    39533950        /*
    39543951         * If the event is a virtual-NMI (which is an NMI being inject during VM-entry)
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