VirtualBox

Changeset 75683 in vbox for trunk/src


Ignore:
Timestamp:
Nov 23, 2018 11:08:15 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
126878
Message:

VMM: Nested VMX: bugref:9180 Implement monitor-trap flag VM-exit.

Location:
trunk/src/VBox/VMM
Files:
3 edited

Legend:

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

    r75631 r75683  
    983983IEM_STATIC VBOXSTRICTRC     iemVmxVmexitInitIpi(PVMCPU pVCpu);
    984984IEM_STATIC VBOXSTRICTRC     iemVmxVmexitIntWindow(PVMCPU pVCpu);
     985IEM_STATIC VBOXSTRICTRC     iemVmxVmexitMtf(PVMCPU pVCpu);
    985986IEM_STATIC VBOXSTRICTRC     iemVmxVirtApicAccessMem(PVMCPU pVCpu, uint16_t offAccess, size_t cbAccess, void *pvData, uint32_t fAccess);
    986987IEM_STATIC VBOXSTRICTRC     iemVmxVmexitApicAccess(PVMCPU pVCpu, uint16_t offAccess, uint32_t fAccess);
     
    1580915810 * @returns Strict VBox status code.
    1581015811 * @param   pVCpu           The cross context virtual CPU structure of the calling EMT.
    15811  * @param   uExitReason     The VM-exit reason.
    15812  * @param   uExitQual       The VM-exit qualification.
    15813  *
    1581415812 * @thread  EMT(pVCpu)
    1581515813 */
     
    1581815816    IEM_CTX_ASSERT(pVCpu, IEM_CPUMCTX_EXTRN_VMX_VMEXIT_MASK);
    1581915817    VBOXSTRICTRC rcStrict = iemVmxVmexitIntWindow(pVCpu);
     15818    if (pVCpu->iem.s.cActiveMappings)
     15819        iemMemRollback(pVCpu);
     15820    return iemExecStatusCodeFiddling(pVCpu, rcStrict);
     15821}
     15822
     15823
     15824/**
     15825 * Interface for HM and EM to emulate VM-exits Monitor-Trap Flag (MTF).
     15826 *
     15827 * @returns Strict VBox status code.
     15828 * @param   pVCpu           The cross context virtual CPU structure of the calling EMT.
     15829 * @thread  EMT(pVCpu)
     15830 */
     15831VMM_INT_DECL(VBOXSTRICTRC)  IEMExecVmxVmexitMtf(PVMCPU pVCpu)
     15832{
     15833    IEM_CTX_ASSERT(pVCpu, IEM_CPUMCTX_EXTRN_VMX_VMEXIT_MASK);
     15834    VBOXSTRICTRC rcStrict = iemVmxVmexitMtf(pVCpu);
    1582015835    if (pVCpu->iem.s.cActiveMappings)
    1582115836        iemMemRollback(pVCpu);
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImplVmxInstr.cpp.h

    r75671 r75683  
    17481748    PVMXVVMCS pVmcs = pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pVmcs);
    17491749
    1750     /* Activity-state: VM-exits occur before changing the activity state, nothing further to do */
     1750    /*
     1751     * Activity state.
     1752     * Most VM-exits will occur in the active state. However, if the first instruction
     1753     * following the VM-entry is a HLT instruction, and the MTF VM-execution control is set,
     1754     * the VM-exit will be from the HLT activity state.
     1755     *
     1756     * See Intel spec. 25.5.2 "Monitor Trap Flag".
     1757     */
     1758    /** @todo NSTVMX: Does triple-fault VM-exit reflect a shutdown activity state or
     1759     *        not? */
     1760    EMSTATE enmActivityState = EMGetState(pVCpu);
     1761    switch (enmActivityState)
     1762    {
     1763        case EMSTATE_HALTED:    pVmcs->u32GuestActivityState = VMX_VMCS_GUEST_ACTIVITY_HLT;     break;
     1764        default:                pVmcs->u32GuestActivityState = VMX_VMCS_GUEST_ACTIVITY_ACTIVE;  break;
     1765    }
    17511766
    17521767    /* Interruptibility-state. */
     
    30023017
    30033018/**
     3019 * VMX VM-exit handler for VM-exits due to Monitor-Trap Flag (MTF).
     3020 *
     3021 * @returns Strict VBox status code.
     3022 * @param   pVCpu   The cross context virtual CPU structure.
     3023 */
     3024IEM_STATIC VBOXSTRICTRC iemVmxVmexitMtf(PVMCPU pVCpu)
     3025{
     3026    /*
     3027     * The MTF VM-exit can occur even when the MTF VM-execution control is
     3028     * not set (e.g. when VM-entry injects an MTF pending event), so do not
     3029     * check for it here.
     3030     */
     3031    iemVmxVmcsSetExitQual(pVCpu, 0);
     3032    return iemVmxVmexit(pVCpu, VMX_EXIT_MTF);
     3033}
     3034
     3035
     3036/**
    30043037 * VMX VM-exit handler for VM-exits due to INVLPG.
    30053038 *
     3039 * @returns Strict VBox status code.
    30063040 * @param   pVCpu           The cross context virtual CPU structure.
    30073041 * @param   GCPtrPage       The guest-linear address of the page being invalidated.
  • trunk/src/VBox/VMM/VMMR3/EM.cpp

    r75681 r75683  
    22612261
    22622262        /*
     2263         * VMX Nested-guest monitor-trap flag (MTF) VM-exit.
     2264         */
     2265#ifdef VBOX_WITH_NESTED_HWVIRT_VMX
     2266        if (VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_VMX_MTF))
     2267        {
     2268            rc2 = VBOXSTRICTRC_VAL(IEMExecVmxVmexitMtf(pVCpu));
     2269            UPDATE_RC();
     2270        }
     2271#endif
     2272
     2273        /*
    22632274         * Allocate handy pages.
    22642275         */
     
    23632374        /* check that we got them all  */
    23642375        AssertCompile(VM_FF_HIGH_PRIORITY_PRE_MASK == (VM_FF_TM_VIRTUAL_SYNC | VM_FF_DBGF | VM_FF_CHECK_VM_STATE | VM_FF_DEBUG_SUSPEND | VM_FF_PGM_NEED_HANDY_PAGES | VM_FF_PGM_NO_MEMORY | VM_FF_EMT_RENDEZVOUS));
    2365         AssertCompile(VMCPU_FF_HIGH_PRIORITY_PRE_MASK == (VMCPU_FF_TIMER | VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_UPDATE_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL | VMCPU_FF_INHIBIT_INTERRUPTS | VMCPU_FF_DBGF | VMCPU_FF_INTERRUPT_NESTED_GUEST | VM_WHEN_RAW_MODE(VMCPU_FF_SELM_SYNC_TSS | VMCPU_FF_TRPM_SYNC_IDT | VMCPU_FF_SELM_SYNC_GDT | VMCPU_FF_SELM_SYNC_LDT, 0)));
     2376        AssertCompile(VMCPU_FF_HIGH_PRIORITY_PRE_MASK == (VMCPU_FF_TIMER | VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_UPDATE_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL | VMCPU_FF_INHIBIT_INTERRUPTS | VMCPU_FF_DBGF | VMCPU_FF_INTERRUPT_NESTED_GUEST | VMCPU_FF_VMX_MTF | VM_WHEN_RAW_MODE(VMCPU_FF_SELM_SYNC_TSS | VMCPU_FF_TRPM_SYNC_IDT | VMCPU_FF_SELM_SYNC_GDT | VMCPU_FF_SELM_SYNC_LDT, 0)));
    23662377    }
    23672378
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