VirtualBox

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


Ignore:
Timestamp:
Sep 6, 2013 2:29:56 PM (11 years ago)
Author:
vboxsync
Message:

HMVMXR0.cpp: Made hmR0VmxSetupVMRunHandler trigger the necessary host (and guest) field updates, and moved it up so the HM_CHANGED_VMX_EXIT_CTLS/HM_CHANGED_VMX_ENTRY_CTLS would take affect before executing guest code again.

File:
1 edited

Legend:

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

    r48347 r48360  
    40604060#if HC_ARCH_BITS == 32 && !defined(VBOX_WITH_HYBRID_32BIT_KERNEL)
    40614061        /* 32-bit host. We need to switch to 64-bit before running the 64-bit guest. */
    4062         pVCpu->hm.s.vmx.pfnStartVM = VMXR0SwitcherStartVM64;
     4062        if (pVCpu->hm.s.vmx.pfnStartVM != VMXR0SwitcherStartVM64)
     4063        {
     4064            pVCpu->hm.s.vmx.pfnStartVM = VMXR0SwitcherStartVM64;
     4065            pVCpu->hm.s.fContextUseFlags |= HM_CHANGED_HOST_CONTEXT | HM_CHANGED_VMX_EXIT_CTLS | HM_CHANGED_VMX_ENTRY_CTLS;
     4066        }
    40634067#else
    40644068        /* 64-bit host or hybrid host. */
     
    40734077        {
    40744078            pVCpu->hm.s.vmx.pfnStartVM = VMXR0StartVM32;
    4075             /** @todo r=bird: Don't we need to set up the host resume (after
    4076              *        vmlaunch/vmresume) state here??  I'm forcing a trip to ring-3 now
    4077              *        in the hope that it will prevent crashing the host.  A better
    4078              *        fix should be found as the guest may be going back and forth
    4079              *        between 16/32-bit and long mode frequently at times. */
    4080             VMCPU_FF_SET(pVCpu, VMCPU_FF_TO_R3);
     4079            pVCpu->hm.s.fContextUseFlags |= HM_CHANGED_HOST_CONTEXT | HM_CHANGED_VMX_EXIT_CTLS | HM_CHANGED_VMX_ENTRY_CTLS;
    40814080        }
    40824081#else
     
    71717170     * Ideally, assert that the cross-dependent bits are up to date at the point of using it.
    71727171     */
    7173     int rc = hmR0VmxLoadGuestEntryCtls(pVCpu, pMixedCtx);
     7172    int rc = hmR0VmxSetupVMRunHandler(pVCpu, pMixedCtx);
     7173    AssertLogRelMsgRCReturn(rc, ("hmR0VmxSetupVMRunHandler! rc=%Rrc (pVM=%p pVCpu=%p)\n", rc, pVM, pVCpu), rc);
     7174
     7175    rc = hmR0VmxLoadGuestEntryCtls(pVCpu, pMixedCtx);
    71747176    AssertLogRelMsgRCReturn(rc, ("hmR0VmxLoadGuestEntryCtls! rc=%Rrc (pVM=%p pVCpu=%p)\n", rc, pVM, pVCpu), rc);
    71757177
     7178    /* This needs to be done after pfnStartVM is set as it may require exit guest controls changes. */
    71767179    rc = hmR0VmxLoadGuestExitCtls(pVCpu, pMixedCtx);
    71777180    AssertLogRelMsgRCReturn(rc, ("hmR0VmxSetupExitCtls failed! rc=%Rrc (pVM=%p pVCpu=%p)\n", rc, pVM, pVCpu), rc);
     
    71997202    rc = hmR0VmxLoadGuestRipRspRflags(pVCpu, pMixedCtx);
    72007203    AssertLogRelMsgRCReturn(rc, ("hmR0VmxLoadGuestRipRspRflags! rc=%Rrc (pVM=%p pVCpu=%p)\n", rc, pVM, pVCpu), rc);
    7201 
    7202     rc = hmR0VmxSetupVMRunHandler(pVCpu, pMixedCtx);
    7203     AssertLogRelMsgRCReturn(rc, ("hmR0VmxSetupVMRunHandler! rc=%Rrc (pVM=%p pVCpu=%p)\n", rc, pVM, pVCpu), rc);
    72047204
    72057205    /* Clear any unused and reserved bits. */
     
    74727472    if (pVCpu->hm.s.fContextUseFlags & HM_CHANGED_HOST_CONTEXT)
    74737473    {
     7474        /* This ASSUMES that pfnStartVM has been set up already. */
    74747475        Assert(VMMR0ThreadCtxHooksAreRegistered(pVCpu));
    74757476        int rc = hmR0VmxSaveHostState(pVM, pVCpu);
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