VirtualBox

Ignore:
Timestamp:
Jun 19, 2015 12:05:26 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
101182
Message:

SUPDrv-darwin.cpp: CR4.VMXE fix after host_vmxon issue.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp

    r56375 r56558  
    902902
    903903
     904#ifdef VBOX_WITH_HOST_VMX
     905/**
     906 * For cleaning up the mess we left behind on Yosemite with 4.3.28 and earlier.
     907 *
     908 * We ASSUME VT-x is supported by the CPU.
     909 *
     910 * @param   idCpu       Unused.
     911 * @param   pvUser1     Unused.
     912 * @param   pvUser2     Unused.
     913 */
     914static DECLCALLBACK(void) vboxdrvDarwinVmxEnableFix(RTCPUID idCpu, void *pvUser1, void *pvUser2)
     915{
     916    RTCCUINTREG uCr4 = ASMGetCR4();
     917    if (!(uCr4 & X86_CR4_VMXE))
     918    {
     919        uCr4 |= X86_CR4_VMXE;
     920        ASMSetCR4(uCr4);
     921    }
     922}
     923#endif
     924
     925
    904926/**
    905927 * @copydoc SUPR0EnableVTx
     
    919941        if (fEnable)
    920942        {
     943            /*
     944             * We screwed up on Yosemite and didn't notice that we weren't
     945             * calling host_vmxon.  CR4.VMXE may therefor have been disabled
     946             * by us.  So, first time around we make sure it's set so we won't
     947             * crash in the pre-4.3.28/5.0RC1 upgrade scenario.
     948             */
     949            static bool volatile g_fDoneCleanup = false;
     950            if (!g_fDoneCleanup)
     951            {
     952                if (version_major == 14 /* 14 = 10.10 = yosemite */)
     953                {
     954                    uint32_t fCaps;
     955                    int rc = supdrvQueryVTCapsInternal(&fCaps);
     956                    if (RT_SUCCESS(rc))
     957                    {
     958                        if (fCaps & SUPVTCAPS_VT_X)
     959                            rc = RTMpOnAll(vboxdrvDarwinVmxEnableFix, NULL, NULL);
     960                        else
     961                            rc = VERR_VMX_NO_VMX;
     962                    }
     963                    if (RT_FAILURE(rc))
     964                        return rc;
     965                }
     966                g_fDoneCleanup = true;
     967            }
     968
     969            /*
     970             * Call the kernel.
     971             */
    921972            rc = host_vmxon(false /* exclusive */);
    922973            if (rc == VMX_OK)
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