Changeset 22615 in vbox
- Timestamp:
- Aug 31, 2009 3:59:02 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 51675
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/sup.h
r22609 r22615 926 926 SUPR3DECL(int) SUPR3HardenedLdrLoadAppPriv(const char *pszFilename, PRTLDRMOD phLdrMod); 927 927 928 929 /** 930 * Check if the host kernel can run in VMX root mode. 931 * 932 * @returns VINF_SUCCESS if supported, error code indicating why if not. 933 */ 934 SUPR3DECL(int) SUPR3QueryVTxSupported(void); 935 936 928 937 /** @} */ 929 938 #endif /* IN_RING3 */ … … 995 1004 SUPR0DECL(SUPPAGINGMODE) SUPR0GetPagingMode(void); 996 1005 SUPR0DECL(int) SUPR0EnableVTx(bool fEnable); 997 SUPR0DECL(int) SUPR0QueryVTxSupport(void);998 1006 999 1007 /** @name Absolute symbols -
trunk/src/VBox/HostDrivers/Support/SUPDrv.c
r22609 r22615 352 352 { "SUPR0GetPagingMode", (void *)UNWIND_WRAP(SUPR0GetPagingMode) }, 353 353 { "SUPR0EnableVTx", (void *)SUPR0EnableVTx }, 354 { "SUPR0QueryVTxSupport", (void *)SUPR0QueryVTxSupport },355 354 { "RTMemAlloc", (void *)UNWIND_WRAP(RTMemAlloc) }, 356 355 { "RTMemAllocZ", (void *)UNWIND_WRAP(RTMemAllocZ) }, … … 4795 4794 4796 4795 /** 4797 * Check if the host kernel can run in VMX root mode.4798 *4799 * @returns VINF_SUCCESS if supported, error code indicating why if not.4800 */4801 SUPR0DECL(int) SUPR0QueryVTxSupport(void)4802 {4803 #ifdef RT_OS_LINUX4804 return supdrvOSQueryVTxSupport();4805 #else4806 return VINF_SUCCESS;4807 #endif4808 }4809 4810 4811 /**4812 4796 * Creates the GIP. 4813 4797 * -
trunk/src/VBox/HostDrivers/Support/SUPDrvIOC.h
r22609 r22615 197 197 * - Nothing. 198 198 */ 199 #define SUPDRV_IOC_VERSION 0x000f000 1199 #define SUPDRV_IOC_VERSION 0x000f0000 200 200 201 201 /** SUP_IOCTL_COOKIE. */ -
trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h
r22609 r22615 632 632 bool VBOXCALL supdrvOSGetForcedAsyncTscMode(PSUPDRVDEVEXT pDevExt); 633 633 int VBOXCALL supdrvOSEnableVTx(bool fEnabled); 634 int VBOXCALL supdrvOSQueryVTxSupport(void);635 634 636 635 /******************************************************************************* -
trunk/src/VBox/HostDrivers/Support/SUPLib.cpp
r22609 r22615 273 273 CookieReq.u.In.u32ReqVersion = SUPDRV_IOC_VERSION; 274 274 const uint32_t MinVersion = (SUPDRV_IOC_VERSION & 0xffff0000) == 0x000f0000 275 ? 0x000f000 1275 ? 0x000f0000 276 276 : SUPDRV_IOC_VERSION & 0xffff0000; 277 277 CookieReq.u.In.u32MinVersion = MinVersion; … … 413 413 { "SUPR0Printf", 0xefef000b }, 414 414 { "SUPR0GetPagingMode", 0xefef000c }, 415 { "SUPR0QueryVTxSupport", 0xefef000d },416 415 { "SUPR0EnableVTx", 0xefef000e }, 417 416 { "RTMemAlloc", 0xefef000f }, … … 2057 2056 } 2058 2057 2058 2059 SUPR3DECL(int) SUPR3QueryVTxSupported(void) 2060 { 2061 #ifdef RT_OS_LINUX 2062 return suplibOsQueryVTxSupported(); 2063 #else 2064 return VINF_SUCCESS; 2065 #endif 2066 } -
trunk/src/VBox/HostDrivers/Support/SUPLibInternal.h
r20864 r22615 251 251 int suplibOsPageAlloc(PSUPLIBDATA pThis, size_t cPages, void **ppvPages); 252 252 int suplibOsPageFree(PSUPLIBDATA pThis, void *pvPages, size_t cPages); 253 int suplibOsQueryVTxSupported(void); 253 254 254 255 -
trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
r22609 r22615 1006 1006 1007 1007 /** 1008 * Check if the host kernel supports VT-x or not.1009 *1010 * Older Linux kernels clear the VMXE bit in the CR4 register (function1011 * tlb_flush_all()) leading to a host kernel panic.1012 *1013 * @returns VBox error code1014 */1015 int VBOXCALL supdrvOSQueryVTxSupport(void)1016 {1017 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)1018 return VINF_SUCCESS;1019 #else1020 return VERR_SUPDRV_KERNEL_TOO_OLD_FOR_VTX;1021 #endif1022 }1023 1024 1025 /**1026 1008 * Converts a supdrv error code to an linux error code. 1027 1009 * -
trunk/src/VBox/HostDrivers/Support/linux/SUPLib-linux.cpp
r16446 r22615 56 56 #include <VBox/types.h> 57 57 #include <iprt/string.h> 58 #include <iprt/system.h> 58 59 #include <VBox/err.h> 59 60 #include <VBox/param.h> … … 254 255 #endif /* !IN_SUP_HARDENED_R3 */ 255 256 257 258 /** Check if the host kernel supports VT-x or not. 259 * 260 * Older Linux kernels clear the VMXE bit in the CR4 register (function 261 * tlb_flush_all()) leading to a host kernel panic. 262 */ 263 int suplibOsQueryVTxSupported(void) 264 { 265 char szBuf[256]; 266 int rc = RTSystemQueryOSInfo(RTSYSOSINFO_RELEASE, szBuf, sizeof(szBuf)); 267 268 if (RT_SUCCESS(rc)) 269 { 270 char *pszNext; 271 uint32_t uA, uB, uC; 272 273 rc = RTStrToUInt32Ex(szBuf, &pszNext, 10, &uA); 274 if ( RT_SUCCESS(rc) 275 && *pszNext == '.') 276 { 277 rc = RTStrToUInt32Ex(pszNext+1, &pszNext, 10, &uB); 278 if ( RT_SUCCESS(rc) 279 && *pszNext == '.') 280 { 281 rc = RTStrToUInt32Ex(pszNext+1, &pszNext, 10, &uC); 282 if (RT_SUCCESS(rc)) 283 { 284 uint32_t uLinuxVersion = (uA << 16) + (uB << 8) + uC; 285 if (uLinuxVersion >= (2 << 16) + (6 << 8) + 32) 286 return VINF_SUCCESS; 287 } 288 } 289 } 290 } 291 292 return VERR_SUPDRV_KERNEL_TOO_OLD_FOR_VTX; 293 } -
trunk/src/VBox/Main/HostImpl.cpp
r22609 r22615 135 135 #include <VBox/err.h> 136 136 #include <VBox/settings.h> 137 #include <VBox/sup.h> 137 138 138 139 #include <stdio.h> … … 236 237 ) 237 238 { 238 #ifdef RT_OS_LINUX 239 /* Linux: VT-x is not supported on Linux < 2.6.13 because older kernels 240 * unconditionally disable the VMXE flag */ 241 char szBuf[64]; 242 int rc = RTSystemQueryOSInfo(RTSYSOSINFO_RELEASE, szBuf, sizeof(szBuf)); 243 239 int rc = SUPR3QueryVTxSupported(); 244 240 if (RT_SUCCESS(rc)) 245 { 246 char *pszNext; 247 uint32_t uA, uB, uC; 248 249 rc = RTStrToUInt32Ex(szBuf, &pszNext, 10, &uA); 250 if ( RT_SUCCESS(rc) 251 && *pszNext == '.') 252 { 253 rc = RTStrToUInt32Ex(pszNext+1, &pszNext, 10, &uB); 254 if ( RT_SUCCESS(rc) 255 && *pszNext == '.') 256 { 257 rc = RTStrToUInt32Ex(pszNext+1, &pszNext, 10, &uC); 258 if (RT_SUCCESS(rc)) 259 { 260 uint32_t uLinuxVersion = (uA << 16) + (uB << 8) + uC; 261 if (uLinuxVersion >= (2 << 16) + (6 << 8) + 13) 262 fVTxAMDVSupported = true; 263 } 264 } 265 } 266 } 267 #else 268 fVTxAMDVSupported = true; 269 #endif 241 fVTxAMDVSupported = true; 270 242 } 271 243 } -
trunk/src/VBox/VMM/HWACCM.cpp
r22493 r22615 638 638 } 639 639 640 if (pVM->hwaccm.s.vmx.fSupported) 641 { 642 rc = SUPR3QueryVTxSupported(); 643 if (RT_FAILURE(rc)) 644 { 645 #ifdef RT_OS_LINUX 646 LogRel(("HWACCM: The host kernel does not support VT-x -- Linux 2.6.13 or newer required!\n")); 647 #else 648 LogRel(("HWACCM: The host kernel does not support VT-x!\n")); 649 #endif 650 return VINF_SUCCESS; 651 } 652 } 653 640 654 if (!pVM->hwaccm.s.fAllowed) 641 655 return VINF_SUCCESS; /* nothing to do */ -
trunk/src/VBox/VMM/VMMR0/HWACCMR0.cpp
r22609 r22615 603 603 int aRc[RTCPUSET_MAX_CPUS]; 604 604 RTCPUID idCpu = 0; 605 606 rc = SUPR0QueryVTxSupport();607 if (RT_FAILURE(rc))608 return rc;609 605 610 606 memset(aRc, 0, sizeof(aRc));
Note:
See TracChangeset
for help on using the changeset viewer.