VirtualBox

Changeset 62334 in vbox


Ignore:
Timestamp:
Jul 19, 2016 4:03:23 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
108871
Message:

VMX: Force host state VMCS updates when moving away from magic 64-on-32 switcher.

File:
1 edited

Legend:

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

    r62321 r62334  
    49034903               the rest of the VM run (until VM reset). See @bugref{8432#c7}. */
    49044904            pVCpu->hm.s.vmx.fSwitchedTo64on32 = true;
     4905            Log4(("Load[%RU32]: hmR0VmxSetupVMRunHandler: selected 64-bit switcher\n", pVCpu->idCpu));
    49054906        }
    49064907#else
     
    49244925# ifdef VBOX_ENABLE_64_BITS_GUESTS
    49254926        /* Keep using the 64-bit switcher even though we're in 32-bit because of bad Intel design. See @bugref{8432#c7}.
    4926          * Except if Real-on-V86 is active, clear the 64-bit switcher flag because now we know the guest is in a sane
    4927          * state where it's safe to use the 32-bit switcher again.
     4927         * If Real-on-V86 is active, clear the 64-bit switcher flag because now we know the guest is in a sane
     4928         * state where it's safe to use the 32-bit switcher. Otherwise check the guest state if it's safe to use
     4929         * the much faster 32-bit switcher again.
    49284930         */
    4929         if (pVCpu->hm.s.vmx.RealMode.fRealOnV86Active)
    4930             pVCpu->hm.s.vmx.fSwitchedTo64on32 = false;
    4931 
    49324931        if (!pVCpu->hm.s.vmx.fSwitchedTo64on32)
     4932        {
     4933            if (pVCpu->hm.s.vmx.pfnStartVM != VMXR0StartVM32)
     4934                Log4(("Load[%RU32]: hmR0VmxSetupVMRunHandler: selected 32-bit switcher\n", pVCpu->idCpu));
    49334935            pVCpu->hm.s.vmx.pfnStartVM = VMXR0StartVM32;
     4936        }
    49344937        else
    49354938        {
    4936             Assert(!pVCpu->hm.s.vmx.RealMode.fRealOnV86Active);
    49374939            Assert(pVCpu->hm.s.vmx.pfnStartVM == VMXR0SwitcherStartVM64);
    4938             if (hmR0VmxIs32BitSwitcherSafe(pVCpu, pMixedCtx))
     4940            if (pVCpu->hm.s.vmx.RealMode.fRealOnV86Active || hmR0VmxIs32BitSwitcherSafe(pVCpu, pMixedCtx))
    49394941            {
    49404942                pVCpu->hm.s.vmx.fSwitchedTo64on32 = false;
    49414943                pVCpu->hm.s.vmx.pfnStartVM = VMXR0StartVM32;
    4942             }
     4944                HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_EFER_MSR | HM_CHANGED_VMX_ENTRY_CTLS | HM_CHANGED_VMX_EXIT_CTLS | HM_CHANGED_HOST_CONTEXT);
     4945                Log4(("Load[%RU32]: hmR0VmxSetupVMRunHandler: selected 32-bit switcher (safe)\n", pVCpu->idCpu));
     4946            }
    49434947        }
    49444948# else
     
    87508754     * Load the host state bits as we may've been preempted (only happens when
    87518755     * thread-context hooks are used or when hmR0VmxSetupVMRunHandler() changes pfnStartVM).
     8756     * Note that the 64-on-32 switcher saves the (64-bit) host state into the VMCS and
     8757     * if we change the switcher back to 32-bit, we *must* save the 32-bit host state here.
     8758     * See @bugref{8432}.
    87528759     */
    8753     /** @todo Why should hmR0VmxSetupVMRunHandler() changing pfnStartVM have
    8754      *        any effect to the host state needing to be saved? */
    87558760    if (HMCPU_CF_IS_PENDING(pVCpu, HM_CHANGED_HOST_CONTEXT))
    87568761    {
    8757         /* This ASSUMES that pfnStartVM has been set up already. */
    87588762        int rc = hmR0VmxSaveHostState(pVM, pVCpu);
    87598763        AssertRC(rc);
     
    88988902    pVCpu->hm.s.vmx.fRestoreHostFlags |= VMX_RESTORE_HOST_REQUIRED;   /* Host state messed up by VT-x, we must restore. */
    88998903#endif
     8904#if HC_ARCH_BITS == 32 && defined(VBOX_ENABLE_64_BITS_GUESTS)
     8905    /* The 64-on-32 switcher maintains uVmcsState on its own and we need to leave it alone here. */
     8906    if (pVCpu->hm.s.vmx.pfnStartVM != VMXR0SwitcherStartVM64)
     8907        pVCpu->hm.s.vmx.uVmcsState |= HMVMX_VMCS_STATE_LAUNCHED;      /* Use VMRESUME instead of VMLAUNCH in the next run. */
     8908#else
    89008909    pVCpu->hm.s.vmx.uVmcsState |= HMVMX_VMCS_STATE_LAUNCHED;          /* Use VMRESUME instead of VMLAUNCH in the next run. */
     8910#endif
    89018911#ifdef VBOX_STRICT
    89028912    hmR0VmxCheckHostEferMsr(pVCpu);                                   /* Verify that VMRUN/VMLAUNCH didn't modify host EFER. */
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