Changeset 43308 in vbox
- Timestamp:
- Sep 12, 2012 11:21:34 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp
r41091 r43308 67 67 68 68 #ifdef VBOX_WITH_HOST_VMX 69 # include <libkern/version.h> 69 70 RT_C_DECLS_BEGIN 70 71 # include <i386/vmx.h> … … 717 718 int VBOXCALL supdrvOSEnableVTx(bool fEnable) 718 719 { 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 728 721 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(); 733 742 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;742 743 } 743 744 } 744 745 else 745 746 { 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; 748 750 } 749 751 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.