VirtualBox

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


Ignore:
Timestamp:
Aug 22, 2019 2:39:03 PM (5 years ago)
Author:
vboxsync
Message:

VMM/IEM: Nested VMX: bugref:9180 Added trap-like VM-exit handler in IEM for upcoming changes.

Location:
trunk/src/VBox/VMM/VMMAll
Files:
2 edited

Legend:

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

    r80350 r80386  
    1587415874
    1587515875/**
     15876 * Interface for HM and EM to emulate a trap-like VM-exit (MTF, APIC-write,
     15877 * Virtualized-EOI, TPR-below threshold).
     15878 *
     15879 * @returns Strict VBox status code.
     15880 * @param   pVCpu           The cross context virtual CPU structure of the calling EMT.
     15881 * @param   pExitInfo       Pointer to the VM-exit information.
     15882 * @thread  EMT(pVCpu)
     15883 */
     15884VMM_INT_DECL(VBOXSTRICTRC) IEMExecVmxVmexitTrapLike(PVMCPUCC pVCpu, PCVMXVEXITINFO pExitInfo)
     15885{
     15886    Assert(pExitInfo);
     15887    VBOXSTRICTRC rcStrict = iemVmxVmexitTrapLikeWithInfo(pVCpu, pExitInfo);
     15888    Assert(!pVCpu->iem.s.cActiveMappings);
     15889    return iemExecStatusCodeFiddling(pVCpu, rcStrict);
     15890}
     15891
     15892
     15893/**
    1587615894 * Interface for HM and EM to emulate a VM-exit due to a task switch.
    1587715895 *
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImplVmxInstr.cpp.h

    r80364 r80386  
    782782
    783783/**
     784 * Sets the guest pending-debug exceptions field.
     785 *
     786 * @param   pVCpu                   The cross context virtual CPU structure.
     787 * @param   uGuestPendingDbgXcpts   The guest pending-debug exceptions.
     788 */
     789DECL_FORCE_INLINE(void) iemVmxVmcsSetGuestPendingDbgXcpts(PVMCPUCC pVCpu, uint64_t uGuestPendingDbgXcpts)
     790{
     791    PVMXVVMCS pVmcs = pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pVmcs);
     792    Assert(!(uGuestPendingDbgXcpts & VMX_VMCS_GUEST_PENDING_DEBUG_VALID_MASK));
     793    pVmcs->u64GuestPendingDbgXcpt.u = uGuestPendingDbgXcpts;
     794}
     795
     796
     797/**
    784798 * Implements VMSucceed for VMX instruction success.
    785799 *
     
    14841498    /*
    14851499     * Pending debug exceptions.
     1500     *
     1501     * For VM-exits where it is not applicable, we can safely zero out the field.
     1502     * For VM-exits where it is applicable, it's expected to be updated by the caller already.
    14861503     */
    14871504    if (    uExitReason != VMX_EXIT_INIT_SIGNAL
     
    14931510         *        block-by-MovSS is in effect. */
    14941511        pVmcs->u64GuestPendingDbgXcpt.u = 0;
    1495     }
    1496     else
    1497     {
    1498         /*
    1499          * Pending debug exception field is identical to DR6 except the RTM bit (16) which needs to be flipped.
    1500          * The "enabled breakpoint" bit (12) is not present in DR6, so we need to update it here.
    1501          *
    1502          * See Intel spec. 24.4.2 "Guest Non-Register State".
    1503          */
    1504         /** @todo r=ramshankar: NSTVMX: I'm not quite sure if we can simply derive this from
    1505          *        DR6. */
    1506         IEM_CTX_ASSERT(pVCpu, CPUMCTX_EXTRN_DR6);
    1507         uint64_t       fPendingDbgMask = pVCpu->cpum.GstCtx.dr[6];
    1508         uint64_t const fBpHitMask = VMX_VMCS_GUEST_PENDING_DEBUG_XCPT_BP0 | VMX_VMCS_GUEST_PENDING_DEBUG_XCPT_BP1
    1509                                   | VMX_VMCS_GUEST_PENDING_DEBUG_XCPT_BP2 | VMX_VMCS_GUEST_PENDING_DEBUG_XCPT_BP3;
    1510         if (fPendingDbgMask & fBpHitMask)
    1511             fPendingDbgMask |= VMX_VMCS_GUEST_PENDING_DEBUG_XCPT_EN_BP;
    1512         fPendingDbgMask ^= VMX_VMCS_GUEST_PENDING_DEBUG_RTM;
    1513         pVmcs->u64GuestPendingDbgXcpt.u = fPendingDbgMask;
    15141512    }
    15151513
     
    34123410    iemVmxVmcsSetExitInstrLen(pVCpu, cbInstr);
    34133411    return iemVmxVmexit(pVCpu, VMX_EXIT_TASK_SWITCH, u64ExitQual);
     3412}
     3413
     3414
     3415/**
     3416 * VMX VM-exit handler for trap-like VM-exits.
     3417 *
     3418 * @returns VBox strict status code.
     3419 * @param   pVCpu           The cross context virtual CPU structure.
     3420 * @param   pExitInfo       Pointer to the VM-exit information.
     3421 * @param   pExitEventInfo  Pointer to the VM-exit event information.
     3422 */
     3423IEM_STATIC VBOXSTRICTRC iemVmxVmexitTrapLikeWithInfo(PVMCPUCC pVCpu, PCVMXVEXITINFO pExitInfo)
     3424{
     3425    Assert(VMXIsVmexitTrapLike(pExitInfo->uReason));
     3426    iemVmxVmcsSetGuestPendingDbgXcpts(pVCpu, pExitInfo->u64GuestPendingDbgXcpts);
     3427    return iemVmxVmexit(pVCpu, pExitInfo->uReason, pExitInfo->u64Qual);
    34143428}
    34153429
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