VirtualBox

Changeset 43308 in vbox


Ignore:
Timestamp:
Sep 12, 2012 11:21:34 AM (12 years ago)
Author:
vboxsync
Message:

SUPDrv-darwin.cpp: Re-enabled the SUPR0EnableVTx code since it seems to be good in Snow Leopard and later.

File:
1 edited

Legend:

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

    r41091 r43308  
    6767
    6868#ifdef VBOX_WITH_HOST_VMX
     69# include <libkern/version.h>
    6970RT_C_DECLS_BEGIN
    7071# include <i386/vmx.h>
     
    717718int VBOXCALL supdrvOSEnableVTx(bool fEnable)
    718719{
    719 /* Zarking amateurish Apple engineering!
    720    host_vmxon is actually buggy and may panic multicore machines. Reason, it
    721    uses a simple lock which will disable preemption of the cpu/thread trying
    722    to acquire it.  Then it allocate wired memory in the kernel map for each
    723    of the cpus in the system. If anyone else tries to mess around in the
    724    kernel map on another CPU while this is going on, there is a fair chance
    725    that it might cause the host_vmxon thread to block and hence panic since
    726    preemption is disabled. Argh! */
    727 #if 0 /*def VBOX_WITH_HOST_VMX*/
     720#ifdef VBOX_WITH_HOST_VMX
    728721    int rc;
    729     if (fEnable)
    730     {
    731         rc = host_vmxon(false /* exclusive */);
    732         if (rc == 0 /* all ok */)
     722    if (version_major >= 10 /* 10 = 10.6.x = Snow Leopard */)
     723    {
     724        if (fEnable)
     725        {
     726            rc = host_vmxon(false /* exclusive */);
     727            if (rc == VMX_OK)
     728                rc = VINF_SUCCESS;
     729            else if (rc == VMX_UNSUPPORTED)
     730                rc = VERR_VMX_NO_VMX;
     731            else if (rc == VMX_INUSE)
     732                rc = VERR_VMX_IN_VMX_ROOT_MODE;
     733            else /* shouldn't happen, but just in case. */
     734            {
     735                LogRel(("host_vmxon returned %d\n", rc));
     736                rc = VERR_UNRESOLVED_ERROR;
     737            }
     738        }
     739        else
     740        {
     741            host_vmxoff();
    733742            rc = VINF_SUCCESS;
    734         else if (rc == 1 /* unsupported */)
    735             rc = VERR_VMX_NO_VMX;
    736         else if (rc == 2 /* exclusive user */)
    737             rc = VERR_VMX_IN_VMX_ROOT_MODE;
    738         else /* shouldn't happen, but just in case. */
    739         {
    740             LogRel(("host_vmxon returned %d\n", rc));
    741             rc = VERR_UNRESOLVED_ERROR;
    742743        }
    743744    }
    744745    else
    745746    {
    746         host_vmxoff();
    747         rc = VINF_SUCCESS;
     747        /* In 10.5.x the host_vmxon is severely broken!  Don't use it, it will
     748           frequnetly panic the host. */
     749        rc = VERR_NOT_SUPPORTED;
    748750    }
    749751    return rc;
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