Changeset 37228 in vbox
- Timestamp:
- May 26, 2011 7:25:54 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Config.kmk
r37199 r37228 147 147 endif 148 148 149 # 150 # Detect the darwin host version number so we can disable stuff that doesn't 149 # 150 # Detect the darwin host version number so we can disable stuff that doesn't 151 151 # currently build on Lion. 152 152 # … … 578 578 # Set this to skip installing the redistributable compiler runtime. 579 579 #VBOX_WITHOUT_COMPILER_REDIST = 1 580 # Enables VMMR0.r0 (++) loading using the native loader on solaris. 581 # Good for debugging and analysis. Experimental. 582 #VBOX_WITH_NATIVE_SOLARIS_LOADING = 1 580 583 # Set this to enable user mode dtrace probes (darwin & solaris only). 581 584 if1of ($(KBUILD_TARGET), darwin) … … 2695 2698 ifeq ($(KBUILD_TARGET),solaris) 2696 2699 TEMPLATE_VBoxR0_LDFLAGS = -r 2700 TEMPLATE_VBoxR0_LDFLAGS.solaris = -u _init -u _info 2701 TEMPLATE_VBoxR0_LIBS.solaris = \ 2702 $(PATH_LIB)/RuntimeR0Stub$(VBOX_SUFF_LIB) 2697 2703 else 2698 2704 TEMPLATE_VBoxR0_LDFLAGS = -nostdlib -Bsymbolic … … 2964 2970 endif 2965 2971 2966 ifn1of (darwin os2 win, $(KBUILD_TARGET)) 2972 ifn1of ($(KBUILD_TARGET), darwin os2 win solaris) 2973 # This doesn't work if supdrv is natively loading VMMR0.r0 et al, but 2974 # fortunately it isn't really necessary. 2967 2975 TEMPLATE_VBOXR0DRV_CFLAGS += -include $(PATH_ROOT)/include/VBox/SUPDrvMangling.h 2968 2976 TEMPLATE_VBOXR0DRV_CXXFLAGS += -include $(PATH_ROOT)/include/VBox/SUPDrvMangling.h -
trunk/include/VBox/sup.h
r36263 r37228 270 270 extern DECLEXPORT(PSUPGLOBALINFOPAGE) g_pSUPGlobalInfoPage; 271 271 272 #elif !defined(IN_RING0) || defined(RT_OS_WINDOWS) 272 #elif !defined(IN_RING0) || defined(RT_OS_WINDOWS) || defined(RT_OS_SOLARIS) 273 273 extern DECLIMPORT(PSUPGLOBALINFOPAGE) g_pSUPGlobalInfoPage; 274 274 -
trunk/src/VBox/Devices/Makefile.kmk
r37198 r37228 649 649 VBoxDDR0_INCS = build 650 650 VBoxDDR0_SOURCES = \ 651 build/VBoxDDR0.cpp \ 651 652 Bus/DevPCI.cpp \ 652 653 Bus/DevPciIch9.cpp \ … … 755 756 VBoxDD2GC_INCS = build 756 757 VBoxDD2GC_SOURCES = \ 757 PC/DevAPIC.cpp\758 PC/DevSMC.cpp758 PC/DevAPIC.cpp \ 759 PC/DevSMC.cpp 759 760 if1of ($(VBOX_LDR_FMT32), pe lx) 760 VBoxDD2GC_LIBS= \761 $(PATH_LIB)/VMMRCBuiltin$(VBOX_SUFF_LIB) \762 $(PATH_LIB)/VMMRCImp$(VBOX_SUFF_LIB)761 VBoxDD2GC_LIBS = \ 762 $(PATH_LIB)/VMMRCBuiltin$(VBOX_SUFF_LIB) \ 763 $(PATH_LIB)/VMMRCImp$(VBOX_SUFF_LIB) 763 764 endif 764 765 endif … … 771 772 VBoxDD2R0_INCS = build 772 773 VBoxDD2R0_SOURCES = \ 773 PC/DevAPIC.cpp \ 774 PC/DevSMC.cpp 774 build/VBoxDD2R0.cpp \ 775 PC/DevAPIC.cpp \ 776 PC/DevSMC.cpp 775 777 776 778 if1of ($(VBOX_LDR_FMT), pe lx) 777 VBoxDD2R0_LIBS= \778 $(PATH_LIB)/VMMR0Imp$(VBOX_SUFF_LIB) \779 $(PATH_LIB)/SUPR0$(VBOX_SUFF_LIB)779 VBoxDD2R0_LIBS = \ 780 $(PATH_LIB)/VMMR0Imp$(VBOX_SUFF_LIB) \ 781 $(PATH_LIB)/SUPR0$(VBOX_SUFF_LIB) 780 782 endif 781 783 -
trunk/src/VBox/HostDrivers/Support/Makefile.kmk
r36062 r37228 446 446 vboxdrv_DEFS += VBOX_WITH_NETFLT 447 447 endif 448 ifdef VBOX_WITH_NATIVE_SOLARIS_LOADING 449 vboxdrv_DEFS += VBOX_WITH_NATIVE_SOLARIS_LOADING 450 endif 448 451 vboxdrv_DEPS += $(VBOX_SVN_REV_KMK) 449 452 vboxdrv_INCS := $(PATH_SUB_CURRENT) -
trunk/src/VBox/HostDrivers/Support/SUPDrv.c
r37211 r37228 4277 4277 /* 4278 4278 * Search the symbol strings. 4279 * 4280 * Note! The int32_t is for native loading on solaris where the data 4281 * and text segments are in very different places. 4279 4282 */ 4280 4283 pchStrings = pImage->pachStrTab; … … 4282 4285 for (i = 0; i < pImage->cSymbols; i++) 4283 4286 { 4284 if ( paSyms[i].offSymbol < pImage->cbImageBits /* paranoia */ 4285 && paSyms[i].offName + cbSymbol <= pImage->cbStrTab 4287 if ( paSyms[i].offName + cbSymbol <= pImage->cbStrTab 4286 4288 && !memcmp(pchStrings + paSyms[i].offName, pReq->u.In.szSymbol, cbSymbol)) 4287 4289 { 4288 pvSymbol = (uint8_t *)pImage->pvImage + paSyms[i].offSymbol;4290 pvSymbol = (uint8_t *)pImage->pvImage + (int32_t)paSyms[i].offSymbol; 4289 4291 rc = VINF_SUCCESS; 4290 4292 break; … … 4366 4368 for (i = 0; i < pImage->cSymbols; i++) 4367 4369 { 4368 if ( paSyms[i].offSymbol < pImage->cbImageBits /* paranoia */ 4369 && paSyms[i].offName + cbSymbol <= pImage->cbStrTab 4370 if ( paSyms[i].offName + cbSymbol <= pImage->cbStrTab 4370 4371 && !memcmp(pchStrings + paSyms[i].offName, pszSymbol, cbSymbol)) 4371 4372 { … … 4373 4374 * Found it! Calc the symbol address and add a reference to the module. 4374 4375 */ 4375 pReq->u.Out.pfnSymbol = (PFNRT)((uint8_t *)pImage->pvImage + paSyms[i].offSymbol);4376 pReq->u.Out.pfnSymbol = (PFNRT)((uint8_t *)pImage->pvImage + (int32_t)paSyms[i].offSymbol); 4376 4377 rc = supdrvLdrAddUsage(pSession, pImage); 4377 4378 break; -
trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h
r36191 r37228 299 299 RTR0MEMOBJ hMemLock; 300 300 #endif 301 #if defined(RT_OS_SOLARIS) && defined(VBOX_WITH_NATIVE_SOLARIS_LOADING) 302 /** The Solaris module ID. */ 303 int idSolMod; 304 /** Pointer to the module control structure. */ 305 struct modctl *pSolModCtl; 306 #endif 301 307 /** Whether it's loaded by the native loader or not. */ 302 308 bool fNative; -
trunk/src/VBox/HostDrivers/Support/SUPLib.cpp
r36262 r37228 1689 1689 1690 1690 /* 1691 * Symbols that are undefined by convention. 1692 */ 1693 #ifdef RT_OS_SOLARIS 1694 static const char * const s_apszConvSyms[] = 1695 { 1696 "", "mod_getctl", 1697 "", "mod_install", 1698 "", "mod_remove", 1699 "", "mod_info", 1700 "", "mod_miscops", 1701 }; 1702 for (unsigned i = 0; i < RT_ELEMENTS(s_apszConvSyms); i += 2) 1703 { 1704 if ( !RTStrCmp(s_apszConvSyms[i], pszModule) 1705 && !RTStrCmp(s_apszConvSyms[i + 1], pszSymbol)) 1706 { 1707 *pValue = ~(uintptr_t)0; 1708 return VINF_SUCCESS; 1709 } 1710 } 1711 #endif 1712 1713 /* 1691 1714 * Despair. 1692 1715 */ -
trunk/src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c
r37219 r37228 35 35 #include <sys/buf.h> 36 36 #include <sys/modctl.h> 37 #include <sys/kobj.h> 37 38 #include <sys/open.h> 38 39 #include <sys/conf.h> … … 51 52 #include <iprt/spinlock.h> 52 53 #include <iprt/mp.h> 54 #include <iprt/path.h> 53 55 #include <iprt/power.h> 54 56 #include <iprt/process.h> … … 893 895 } 894 896 897 #if defined(VBOX_WITH_NATIVE_SOLARIS_LOADING) \ 898 && !defined(VBOX_WITHOUT_NATIVE_R0_LOADER) 895 899 896 900 int VBOXCALL supdrvOSLdrOpen(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const char *pszFilename) 897 901 { 898 /** @todo This is something that shouldn't be impossible to implement 899 * here and would make a few people happy. */ 902 pImage->idSolMod = -1; 903 pImage->pSolModCtl = NULL; 904 905 # if 1 /* This approach requires _init/_fini/_info stubs. */ 906 /* 907 * Construct a filename that escapes the module search path and let us 908 * specify a root path. 909 */ 910 const char *pszName = RTPathFilename(pszFilename); 911 AssertReturn(pszName, VERR_INVALID_PARAMETER); 912 char *pszSubDir = RTStrAPrintf2("../../../../../../../../../../../%.*s", pszName - pszFilename, pszFilename); 913 if (!pszSubDir) 914 return VERR_NO_STR_MEMORY; 915 916 int idMod = modload(pszSubDir, pszName); 917 RTStrFree(pszSubDir); 918 if (idMod == -1) 919 { 920 LogRel(("modload(,%s): failed, could be anything...\n", pszFilename)); 921 return VERR_LDR_GENERAL_FAILURE; 922 } 923 924 modctl_t *pModCtl = mod_hold_by_id(idMod); 925 if (!pModCtl) 926 { 927 LogRel(("mod_hold_by_id(,%s): failed, weird.\n", pszFilename)); 928 /* No point in calling modunload. */ 929 return VERR_LDR_GENERAL_FAILURE; 930 } 931 pModCtl->mod_loadflags |= MOD_NOAUTOUNLOAD | MOD_NOUNLOAD; /* paranoia */ 932 933 # else 934 935 const int idMod = -1; 936 modctl_t *pModCtl = mod_hold_by_name(pszFilename); 937 if (!pModCtl) 938 { 939 LogRel(("mod_hold_by_name failed for '%s'\n", pszFilename)); 940 return VERR_LDR_GENERAL_FAILURE; 941 } 942 943 int rc = kobj_load_module(pModCtl, 0 /*use_path*/); 944 if (rc != 0) 945 { 946 LogRel(("kobj_load_module failed with rc=%d for '%s'\n", rc, pszFilename)); 947 mod_release_mod(pModCtl); 948 return RTErrConvertFromErrno(rc); 949 } 950 # endif 951 952 /* 953 * Get the module info. 954 */ 955 struct modinfo ModInfo; 956 kobj_getmodinfo(pModCtl->mod_mp, &ModInfo); 957 pImage->pvImage = ModInfo.mi_base; 958 pImage->idSolMod = idMod; 959 pImage->pSolModCtl = pModCtl; 960 961 mod_release_mod(pImage->pSolModCtl); 962 LogRel(("supdrvOSLdrOpen: succeeded for '%s' (mi_base=%p mi_base=%#x), id=%d ctl=%p\n", 963 pszFilename, ModInfo.mi_base, ModInfo.mi_size, idMod, pModCtl)); 964 return VINF_SUCCESS; 965 } 966 967 968 int VBOXCALL supdrvOSLdrValidatePointer(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, void *pv, const uint8_t *pbImageBits) 969 { 970 NOREF(pDevExt); NOREF(pImage); NOREF(pv); NOREF(pbImageBits); 971 if (kobj_addrcheck(pImage->pSolModCtl->mod_mp, pv)) 972 return VERR_INVALID_PARAMETER; 973 return VINF_SUCCESS; 974 } 975 976 977 int VBOXCALL supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits) 978 { 979 /* 980 * Comparing is very very difficult since text and data may be allocated 981 * separately. 982 */ 983 size_t cbCompare = RT_MIN(pImage->cbImageBits, 64); 984 if (memcmp(pImage->pvImage, pbImageBits, cbCompare)) 985 { 986 LogRel(("Image mismatch: %s\n", pImage->szName)); 987 LogRel(("Native: %.*Rhxs\n", cbCompare, pImage->pvImage)); 988 LogRel(("SUPLib: %.*Rhxs\n", cbCompare, pbImageBits)); 989 return VERR_LDR_MISMATCH_NATIVE; 990 } 991 992 993 /* 994 * Get the symbol addresses. 995 */ 996 int rc; 997 modctl_t *pModCtl = mod_hold_by_id(pImage->idSolMod); 998 if (pModCtl && pModCtl == pImage->pSolModCtl) 999 { 1000 uint32_t iSym = pImage->cSymbols; 1001 while (iSym-- > 0) 1002 { 1003 const char *pszSymbol = &pImage->pachStrTab[pImage->paSymbols[iSym].offName]; 1004 uintptr_t uValue = modlookup_by_modctl(pImage->pSolModCtl, pszSymbol); 1005 if (!uValue) 1006 { 1007 LogRel(("supdrvOSLdrLoad on %s failed to resolve the exported symbol: '%s'\n", pImage->szName, pszSymbol)); 1008 break; 1009 } 1010 uintptr_t offSymbol = uValue - (uintptr_t)pImage->pvImage; 1011 pImage->paSymbols[iSym].offSymbol = offSymbol; 1012 if (pImage->paSymbols[iSym].offSymbol != (int32_t)offSymbol) 1013 { 1014 LogRel(("supdrvOSLdrLoad on %s symbol out of range: %p (%s) \n", pImage->szName, offSymbol, pszSymbol)); 1015 break; 1016 } 1017 } 1018 1019 rc = iSym == UINT32_MAX ? VINF_SUCCESS : VERR_LDR_GENERAL_FAILURE; 1020 mod_release_mod(pImage->pSolModCtl); 1021 } 1022 else 1023 { 1024 LogRel(("mod_hold_by_id failed in supdrvOSLdrLoad on %s: %p\n", pImage->szName, pModCtl)); 1025 rc = VERR_LDR_MISMATCH_NATIVE; 1026 } 1027 return rc; 1028 } 1029 1030 1031 void VBOXCALL supdrvOSLdrUnload(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage) 1032 { 1033 # if 1 1034 pImage->pSolModCtl->mod_loadflags &= ~MOD_NOUNLOAD; 1035 int rc = modunload(pImage->idSolMod); 1036 if (rc) 1037 LogRel(("modunload(%u (%s)) failed: %d\n", pImage->idSolMod, pImage->szName, rc)); 1038 # else 1039 kobj_unload_module(pImage->pSolModCtl); 1040 # endif 1041 pImage->pSolModCtl = NULL; 1042 pImage->idSolMod = NULL; 1043 } 1044 1045 #else /* !VBOX_WITH_NATIVE_SOLARIS_LOADING */ 1046 1047 int VBOXCALL supdrvOSLdrOpen(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const char *pszFilename) 1048 { 900 1049 NOREF(pDevExt); NOREF(pImage); NOREF(pszFilename); 901 1050 return VERR_NOT_SUPPORTED; … … 921 1070 NOREF(pDevExt); NOREF(pImage); 922 1071 } 1072 1073 #endif /* !VBOX_WITH_NATIVE_SOLARIS_LOADING */ 923 1074 924 1075 -
trunk/src/VBox/Runtime/Makefile.kmk
r37196 r37228 45 45 # 46 46 LIBRARIES += RuntimeGuestR3 RuntimeGuestR3Shared RuntimeR3 RuntimeR0 47 LIBRARIES.solaris += RuntimeR0Stub 47 48 LIBRARIES.win += RuntimeR0Stub 48 49 … … 59 60 # 60 61 LIBRARIES += RuntimeBldProg 62 LIBRARIES.solaris += RuntimeR0Stub RuntimeRCStub 61 63 LIBRARIES.win += RuntimeR0Stub RuntimeRCStub 62 64 include $(PATH_SUB_CURRENT)/tools/Makefile.kmk … … 74 76 BLDPROGS += uniread 75 77 LIBRARIES += RuntimeR3 RuntimeBldProg RuntimeR0 RuntimeEFCPP RuntimeR3NoCRTGCC 78 LIBRARIES.solaris += RuntimeR0Stub 76 79 LIBRARIES.win += RuntimeR0Stub 77 80 ifdef VBOX_WITH_RAW_MODE … … 1519 1522 1520 1523 # 1521 # RuntimeR0Stub - Ring-0 context startup stub for Windows .1522 # 1523 RuntimeR0Stub_TEMPLATE = VBoxR01524 # RuntimeR0Stub - Ring-0 context startup stub for Windows and Solaris. 1525 # 1526 RuntimeR0Stub_TEMPLATE = $(if-expr "$(KBUILD_TARGET)" == "solaris",VBOXR0DRV,VBoxR0) 1524 1527 RuntimeR0Stub_SOURCES.win = \ 1525 1528 nt/NtProcessStartup-stub.cpp 1529 RuntimeR0Stub_SOURCES.solaris = \ 1530 r0drv/solaris/modulestub-r0drv-solaris.c 1526 1531 1527 1532 … … 1605 1610 common/string/RTStrNLen.cpp \ 1606 1611 common/string/RTStrNLenEx.cpp \ 1612 common/string/straprintf.cpp \ 1607 1613 common/string/strformat.cpp \ 1608 1614 common/string/strformatnum.cpp \ -
trunk/src/VBox/VMM/VMMR0/VMMR0.cpp
r36441 r37228 87 87 NULL 88 88 }; 89 90 #ifdef RT_OS_SOLARIS 91 /* Dependency information for the native solaris loader. */ 92 extern "C" { char _depends_on[] = "vboxdrv"; } 93 #endif 94 89 95 90 96 … … 1573 1579 RTAssertMsg2V(pszFormat, va); 1574 1580 } 1581
Note:
See TracChangeset
for help on using the changeset viewer.