Changeset 14901 in vbox for trunk/src/VBox
- Timestamp:
- Dec 2, 2008 2:23:22 PM (16 years ago)
- Location:
- trunk/src/VBox/HostDrivers/Support
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPDrv.c
r14836 r14901 311 311 { "SUPR0Printf", (void *)SUPR0Printf }, /** @todo needs wrapping? */ 312 312 { "SUPR0GetPagingMode", (void *)UNWIND_WRAP(SUPR0GetPagingMode) }, 313 { "SUPR0 NativeEnableHwVirtExt", (void *)SUPR0NativeEnableHwVirtExt},313 { "SUPR0EnableVTx", (void *)SUPR0EnableVTx }, 314 314 { "RTMemAlloc", (void *)UNWIND_WRAP(RTMemAlloc) }, 315 315 { "RTMemAllocZ", (void *)UNWIND_WRAP(RTMemAllocZ) }, … … 4059 4059 * @retval VERR_NOT_SUPPORTED if not supported by the native OS. 4060 4060 * 4061 * @param pSession The calling session.4062 4061 * @param fEnable Whether to enable or disable. 4063 4062 */ 4064 SUPR0DECL(int) SUPR0NativeEnableHwVirtExt(PSUPDRVSESSION pSession, bool fEnable) 4065 { 4063 SUPR0DECL(int) SUPR0EnableVTx(bool fEnable) 4064 { 4065 #ifdef RT_OS_DARWIN 4066 return supdrvOSEnableVTx(fEnable); 4067 #else 4066 4068 return VERR_NOT_SUPPORTED; 4069 #endif 4067 4070 } 4068 4071 -
trunk/src/VBox/HostDrivers/Support/SUPDrvIOC.h
r14825 r14901 188 188 * and renaming the related IOCtls too. 189 189 */ 190 #define SUPDRV_IOC_VERSION 0x000a000 6190 #define SUPDRV_IOC_VERSION 0x000a0007 191 191 192 192 /** SUP_IOCTL_COOKIE. */ -
trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h
r14575 r14901 599 599 bool VBOXCALL supdrvOSObjCanAccess(PSUPDRVOBJ pObj, PSUPDRVSESSION pSession, const char *pszObjName, int *prc); 600 600 bool VBOXCALL supdrvOSGetForcedAsyncTscMode(PSUPDRVDEVEXT pDevExt); 601 int VBOXCALL supdrvOSEnableVTx(bool fEnabled); 601 602 602 603 /******************************************************************************* -
trunk/src/VBox/HostDrivers/Support/SUPLib.cpp
r14825 r14901 261 261 CookieReq.u.In.u32ReqVersion = SUPDRV_IOC_VERSION; 262 262 const uint32_t MinVersion = (SUPDRV_IOC_VERSION & 0xffff0000) == 0x000a0000 263 ? 0x000a000 6263 ? 0x000a0007 264 264 : SUPDRV_IOC_VERSION & 0xffff0000; 265 265 CookieReq.u.In.u32MinVersion = MinVersion; … … 400 400 { "SUPR0Printf", 0xefef000b }, 401 401 { "SUPR0GetPagingMode", 0xefef000c }, 402 { "SUPR0 NativeEnableHwVirtExt",0xefef000c },402 { "SUPR0EnableVTx", 0xefef000c }, 403 403 { "RTMemAlloc", 0xefef000d }, 404 404 { "RTMemAllocZ", 0xefef000e }, -
trunk/src/VBox/HostDrivers/Support/SUPR0.def
r14801 r14901 54 54 SUPR0Printf 55 55 SUPR0GetPagingMode 56 SUPR0 NativeEnableHwVirtExt56 SUPR0EnableVTx 57 57 RTMemAlloc 58 58 RTMemAllocZ -
trunk/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp
r13866 r14901 54 54 #include <iprt/process.h> 55 55 #include <iprt/alloc.h> 56 #include < iprt/err.h>56 #include <VBox/err.h> 57 57 #include <VBox/log.h> 58 58 … … 240 240 if (g_iMajorDeviceNo >= 0) 241 241 { 242 /** @todo the UID, GID and mode mask should be configurable! This isn't very secure... */243 242 #ifdef VBOX_WITH_HARDENING 244 243 g_hDevFsDevice = devfs_make_node(makedev(g_iMajorDeviceNo, 0), DEVFS_CHAR, … … 662 661 663 662 664 bool VBOXCALL supdrvOSGetForcedAsyncTscMode(PSUPDRVDEVEXT pDevExt) 663 /* 664 * The following is a weak symbol hack to deal with the lack of 665 * host_vmxon & host_vmxoff in Tiger. 666 */ 667 static int g_fWeakHostVmxOnOff = false; 668 669 __BEGIN_DECLS 670 int host_vmxon(int exclusive) __attribute__((weak)); 671 void host_vmxoff(void) __attribute__((weak)); 672 __END_DECLS 673 674 /* weak version for Tiger. */ 675 int host_vmxon(int exclusive) 676 { 677 NOREF(exclusive); 678 g_fWeakHostVmxOnOff = true; 679 return 42; 680 } 681 682 /* weak version for Tiger. */ 683 void host_vmxoff(void) 684 { 685 g_fWeakHostVmxOnOff = true; 686 } 687 688 689 /** 690 * Enables or disables VT-x using kernel functions. 691 * 692 * @returns VBox status code. VERR_NOT_SUPPORTED has a special meaning. 693 * @param fEnable Whether to enable or disable. 694 */ 695 int VBOXCALL supdrvOSEnableVTx(bool fEnable) 696 { 697 if (g_fWeakHostVmxOnOff) 698 return VERR_NOT_SUPPORTED; 699 700 int rc; 701 if (fEnable) 702 { 703 printf("calling host_vmxon\n"); 704 rc = host_vmxon(false /* exclusive */); 705 printf("host_vmxon: %d\n", rc); 706 if (rc == 42) 707 rc = VERR_NOT_SUPPORTED; 708 else 709 { 710 AssertReturn(!g_fWeakHostVmxOnOff, VERR_NOT_SUPPORTED); 711 if (rc == 0 /* all ok */) 712 rc = VINF_SUCCESS; 713 else if (rc == 1 /* unsupported */) 714 rc = VERR_VMX_NO_VMX; 715 else if (rc == 2 /* exclusive user */) 716 rc = VERR_VMX_IN_VMX_ROOT_MODE; 717 else 718 rc = VERR_UNRESOLVED_ERROR; 719 } 720 } 721 else 722 { 723 printf("calling host_vmxoff\n"); 724 host_vmxoff(); 725 printf("host_vmxoff returned\n"); 726 AssertReturn(!g_fWeakHostVmxOnOff, VERR_NOT_SUPPORTED); 727 rc = VINF_SUCCESS; 728 } 729 return rc; 730 } 731 732 733 bool VBOXCALL supdrvOSGetForcedAsyncTscMode(PSUPDRVDEVEXT pDevExt) 665 734 { 666 735 NOREF(pDevExt);
Note:
See TracChangeset
for help on using the changeset viewer.