VirtualBox

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


Ignore:
Timestamp:
Jan 12, 2017 7:30:01 AM (8 years ago)
Author:
vboxsync
Message:

VMM/HMVMXR0: Adjustments to fix in r112756 and comment update.

File:
1 edited

Legend:

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

    r65241 r65251  
    34043404 *                      before using them.
    34053405 *
    3406  * @remarks Can cause longjumps!!!
     3406 * @remarks No-long-jump zone!!!
    34073407 */
    34083408DECLINLINE(int) hmR0VmxLoadGuestApicState(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     
    83738373    HMVMX_ASSERT_PREEMPT_SAFE();
    83748374
    8375     VMMRZCallRing3Disable(pVCpu);
    8376     Assert(VMMR0IsLogFlushDisabled(pVCpu));
    8377 
    83788375    LogFlowFunc(("pVM=%p pVCpu=%p\n", pVM, pVCpu));
    83798376
     
    84428439    HMCPU_CF_CLEAR(pVCpu, HM_CHANGED_GUEST_CR2);
    84438440
    8444     VMMRZCallRing3Enable(pVCpu);
    8445 
    84468441    STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatLoadGuestState, x);
    84478442    return rc;
     
    85248519{
    85258520    HMVMX_ASSERT_PREEMPT_SAFE();
     8521    Assert(!VMMRZCallRing3IsEnabled(pVCpu));
     8522    Assert(VMMR0IsLogFlushDisabled(pVCpu));
    85268523
    85278524    Log5(("LoadFlags=%#RX32\n", HMCPU_CF_VALUE(pVCpu)));
     
    85308527#endif
    85318528
     8529    /*
     8530     * RIP is what changes the most often and hence if it's the only bit needing to be
     8531     * updated, we shall handle it early for performance reasons.
     8532     */
    85328533    VBOXSTRICTRC rcStrict = VINF_SUCCESS;
    85338534    if (HMCPU_CF_IS_SET_ONLY(pVCpu, HM_CHANGED_GUEST_RIP))
     
    86268627        && PDMHasApic(pVM))
    86278628    {
    8628         uint64_t u64MsrApicBase = APICGetBaseMsrNoCheck(pVCpu);
     8629        uint64_t const u64MsrApicBase = APICGetBaseMsrNoCheck(pVCpu);
    86298630        Assert(u64MsrApicBase);
    86308631        Assert(pVM->hm.s.vmx.HCPhysApicAccess);
    86318632
    8632         /* We only care about the APIC base MSR address and not the other bits. */
    8633         RTGCPHYS GCPhysApicBase;
    8634         GCPhysApicBase  = u64MsrApicBase;
    8635         GCPhysApicBase &= PAGE_BASE_GC_MASK;
     8633        RTGCPHYS const GCPhysApicBase = u64MsrApicBase & PAGE_BASE_GC_MASK;
    86368634
    86378635        /* Unalias any existing mapping. */
     
    86408638
    86418639        /* Map the HC APIC-access page in place of the MMIO page, also updates the shadow page tables if necessary. */
    8642         LogRel(("HM: VCPU%u: Mapped HC APIC-access page GCPhysApicBase=%#RGp\n", pVCpu->idCpu, GCPhysApicBase));
     8640        LogRel(("hmR0VmxPreRunGuest: VCPU%u: Mapped HC APIC-access page at %#RGp\n", pVCpu->idCpu, GCPhysApicBase));
    86438641        rc = IOMMMIOMapMMIOHCPage(pVM, pVCpu, GCPhysApicBase, pVM->hm.s.vmx.HCPhysApicAccess, X86_PTE_RW | X86_PTE_P);
    86448642        AssertRCReturn(rc, rc);
     
    86688666
    86698667    /*
    8670      * Load the guest state bits, we can handle longjmps/getting preempted here.
     8668     * No longjmps to ring-3 from this point on!!!
     8669     * Asserts() will still longjmp to ring-3 (but won't return), which is intentional, better than a kernel panic.
     8670     * This also disables flushing of the R0-logger instance (if any).
     8671     */
     8672    VMMRZCallRing3Disable(pVCpu);
     8673
     8674    /*
     8675     * Load the guest state bits.
     8676     *
     8677     * We cannot perform longjmps while loading the guest state because we do not preserve the
     8678     * host/guest state (although the VMCS will be preserved) across longjmps which can cause
     8679     * CPU migration.
    86718680     *
    86728681     * If we are injecting events to a real-on-v86 mode guest, we will have to update
    86738682     * RIP and some segment registers, i.e. hmR0VmxInjectPendingEvent()->hmR0VmxInjectEventVmcs().
    8674      * Hence, this needs to be done -after- injection of events.
     8683     * Hence, loading of the guest state needs to be done -after- injection of events.
    86758684     */
    86768685    rcStrict = hmR0VmxLoadGuestStateOptimal(pVM, pVCpu, pMixedCtx);
     
    86788687    { /* likely */ }
    86798688    else
     8689    {
     8690        VMMRZCallRing3Enable(pVCpu);
    86808691        return rcStrict;
    8681 
    8682     /*
    8683      * No longjmps to ring-3 from this point on!!!
    8684      * Asserts() will still longjmp to ring-3 (but won't return), which is intentional, better than a kernel panic.
    8685      * This also disables flushing of the R0-logger instance (if any).
    8686      */
    8687     VMMRZCallRing3Disable(pVCpu);
     8692    }
    86888693
    86898694    /*
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