VirtualBox

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


Ignore:
Timestamp:
Jun 15, 2016 9:24:43 AM (9 years ago)
Author:
vboxsync
Message:

VMX: Keep using 64-bit switcher to preserve guest CPU state on 32-bit hosts, bugref:8432 (undoing r108051).

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HMR0A.asm

    r61692 r61703  
    12071207    dec     xCX
    12081208    mov     eax, [ss:xDX + VMCSCACHE.Read.aField + xCX * 4]
     1209    ; Note! This leaves the high 32 bits of the cache entry unmodified!!
    12091210    vmread  [ss:xDX + VMCSCACHE.Read.aFieldVal + xCX * 8], xAX
    1210     mov     dword [ss:xDX + VMCSCACHE.Read.aFieldVal + xCX * 8 + 4], 0
    12111211    cmp     xCX, 0
    12121212    jnz     %%cached_read32
  • trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp

    r61648 r61703  
    33153315        Log4(("Load[%RU32]: VMX_VMCS_CTRL_EXIT_HOST_ADDR_SPACE_SIZE\n", pVCpu->idCpu));
    33163316#else
    3317         if (CPUMIsGuestInLongModeEx(pMixedCtx))
     3317        Assert(   pVCpu->hm.s.vmx.pfnStartVM == VMXR0SwitcherStartVM64
     3318               || pVCpu->hm.s.vmx.pfnStartVM == VMXR0StartVM32);
     3319        /* Set the host address-space size based on the switcher, not guest state. See @bugref{8432}. */
     3320        if (pVCpu->hm.s.vmx.pfnStartVM == VMXR0SwitcherStartVM64)
    33183321        {
    33193322            /* The switcher returns to long mode, EFER is managed by the switcher. */
     
    48464849            }
    48474850            pVCpu->hm.s.vmx.pfnStartVM = VMXR0SwitcherStartVM64;
     4851
     4852            /* Mark that we've switched to 64-bit handler, we can't safely switch back to 32-bit for
     4853               the rest of the VM run (until VM reset). See @bugref{8432#c7}. */
     4854            pVCpu->hm.s.vmx.fSwitchedTo64on32 = true;
    48484855        }
    48494856#else
     
    48564863        /* Guest is not in long mode, use the 32-bit handler. */
    48574864#if HC_ARCH_BITS == 32
    4858         if (   pVCpu->hm.s.vmx.pfnStartVM != VMXR0StartVM32
    4859             && pVCpu->hm.s.vmx.pfnStartVM != NULL) /* Very first entry would have saved host-state already, ignore it. */
     4865        if (    pVCpu->hm.s.vmx.pfnStartVM != VMXR0StartVM32
     4866            && !pVCpu->hm.s.vmx.fSwitchedTo64on32   /* If set, guest mode change does not imply switcher change. */
     4867            &&  pVCpu->hm.s.vmx.pfnStartVM != NULL) /* Very first entry would have saved host-state already, ignore it. */
    48604868        {
    48614869            /* Currently, all mode changes sends us back to ring-3, so these should be set. See @bugref{6944}. */
     
    48644872                                             | HM_CHANGED_GUEST_EFER_MSR), ("flags=%#x\n", HMCPU_CF_VALUE(pVCpu)));
    48654873        }
     4874# ifdef VBOX_ENABLE_64_BITS_GUESTS
     4875        /* Keep using the 64-bit switcher even though we're in 32-bit because of bad Intel design. See @bugref{8432#c7}. */
     4876        if (!pVCpu->hm.s.vmx.fSwitchedTo64on32)
     4877            pVCpu->hm.s.vmx.pfnStartVM = VMXR0StartVM32;
     4878        else
     4879            Assert(pVCpu->hm.s.vmx.pfnStartVM == VMXR0SwitcherStartVM64);
     4880# else
     4881        pVCpu->hm.s.vmx.pfnStartVM = VMXR0StartVM32;
     4882# endif
     4883#else
     4884        pVCpu->hm.s.vmx.pfnStartVM = VMXR0StartVM32;
    48664885#endif
    4867         pVCpu->hm.s.vmx.pfnStartVM = VMXR0StartVM32;
    48684886    }
    48694887    Assert(pVCpu->hm.s.vmx.pfnStartVM);
  • trunk/src/VBox/VMM/VMMR3/HM.cpp

    r61648 r61703  
    18611861    HMCPU_CF_RESET_TO(pVCpu, HM_CHANGED_HOST_CONTEXT | HM_CHANGED_ALL_GUEST);
    18621862
    1863     pVCpu->hm.s.vmx.u32CR0Mask     = 0;
    1864     pVCpu->hm.s.vmx.u32CR4Mask     = 0;
    1865     pVCpu->hm.s.fActive            = false;
    1866     pVCpu->hm.s.Event.fPending     = false;
    1867     pVCpu->hm.s.vmx.fWasInRealMode = true;
    1868     pVCpu->hm.s.vmx.u64MsrApicBase = 0;
     1863    pVCpu->hm.s.vmx.u32CR0Mask        = 0;
     1864    pVCpu->hm.s.vmx.u32CR4Mask        = 0;
     1865    pVCpu->hm.s.fActive               = false;
     1866    pVCpu->hm.s.Event.fPending        = false;
     1867    pVCpu->hm.s.vmx.fWasInRealMode    = true;
     1868    pVCpu->hm.s.vmx.u64MsrApicBase    = 0;
     1869    pVCpu->hm.s.vmx.fSwitchedTo64on32 = false;
     1870
     1871
    18691872
    18701873    /* Reset the contents of the read cache. */
  • trunk/src/VBox/VMM/include/HMInternal.h

    r61648 r61703  
    809809        /** Set if guest was executing in real mode (extra checks). */
    810810        bool                        fWasInRealMode;
    811         uint8_t                     u8Alignment1[7];
     811        /** Set if guest switched to 64-bit mode on a 32-bit host. */
     812        bool                        fSwitchedTo64on32;
     813
     814        uint8_t                     u8Alignment1[6];
    812815    } vmx;
    813816
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