Changeset 40857 in vbox
- Timestamp:
- Apr 10, 2012 6:52:33 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
include/VBox/VBoxTpG.h (modified) (1 diff)
-
src/VBox/HostDrivers/Support/Makefile.kmk (modified) (2 diffs)
-
src/VBox/HostDrivers/Support/SUPDrv-dtrace.cpp (modified) (6 diffs)
-
src/bldprogs/VBoxTpG.cpp (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/VBoxTpG.h
r40851 r40857 72 72 # ifdef __GNUC__ 73 73 # define VTG_DECL_VTGPROBELOC(a_VarName) \ 74 static VTGPROBELOC __attribute__((section(VTG_LOC_SE CT))) a_VarName74 static VTGPROBELOC __attribute__((section(VTG_LOC_SEG "," VTG_LOC_SECT ",regular")/*, aligned(16)*/)) a_VarName 75 75 # else 76 76 # error "Unsupported Darwin compiler!" -
trunk/src/VBox/HostDrivers/Support/Makefile.kmk
r40851 r40857 303 303 VBoxDrv_SOURCES.darwin = darwin/SUPDrv-darwin.cpp 304 304 VBoxDrv_SOURCES.solaris = \ 305 solaris/SUPDrv-solaris.c 305 solaris/SUPDrv-solaris.c 306 306 VBoxDrv_SOURCES.win = \ 307 307 win/SUPDrv-win.cpp \ … … 316 316 VBoxDrv_SOURCES += \ 317 317 SUPDrv-dtrace.cpp 318 VBoxDrv_DTRACE_OBJ_FLAGS = -v -v -v 319 SUPDrv-dtrace.cpp_DEFS.darwin += VBOX_PATH_MACOSX_DTRACE_H=\"$(VBOX_PATH_MACOSX_SDK)/usr/include/sys/dtrace.h\" 318 320 endif 319 321 ifn1of ($(KBUILD_TARGET), linux freebsd) -
trunk/src/VBox/HostDrivers/Support/SUPDrv-dtrace.cpp
r40851 r40857 39 39 #include <iprt/ctype.h> 40 40 #include <iprt/mem.h> 41 42 #ifdef RT_OS_DARWIN /** @todo figure this! */ 43 # include "/Developer/SDKs/MacOSX10.6.sdk/usr/include/sys/dtrace.h" 41 #include <iprt/errno.h> 42 #ifdef RT_OS_DARWIN 43 # include <iprt/dbg.h> 44 #endif 45 46 #ifdef RT_OS_DARWIN 47 # include VBOX_PATH_MACOSX_DTRACE_H 44 48 #else 45 49 # include <sys/dtrace.h> … … 112 116 #ifdef RT_OS_DARWIN 113 117 /** @name DTrace kernel interface used on Darwin 114 * @{ */ 115 static void (* dtrace_probe)(dtrace_id_t, uint64_t, uint64_t, uint64_t, uint64_t, uint64_t); 116 static dtrace_id_t (* dtrace_probe_create)(dtrace_provider_id_t, const char *, const char *, const char *, int, void *); 117 static dtrace_id_t (* dtrace_probe_lookup)(dtrace_provider_id_t, const char *, const char *, const char *); 118 static int (* dtrace_register)(const char *, const dtrace_pattr_t *, uint32_t, /*cred_t*/ void *, 119 const dtrace_pops_t *, void *, dtrace_provider_id_t *); 120 static void (* dtrace_invalidate)(dtrace_provider_id_t); 121 static int (* dtrace_unregister)(dtrace_provider_id_t); 118 * @{ */ 119 static void (* g_pfnDTraceProbeFire)(dtrace_id_t, uint64_t, uint64_t, uint64_t, uint64_t, uint64_t); 120 static dtrace_id_t (* g_pfnDTraceProbeCreate)(dtrace_provider_id_t, const char *, const char *, const char *, int, void *); 121 static dtrace_id_t (* g_pfnDTraceProbeLookup)(dtrace_provider_id_t, const char *, const char *, const char *); 122 static int (* g_pfnDTraceProviderRegister)(const char *, const dtrace_pattr_t *, uint32_t, /*cred_t*/ void *, 123 const dtrace_pops_t *, void *, dtrace_provider_id_t *); 124 static void (* g_pfnDTraceProviderInvalidate)(dtrace_provider_id_t); 125 static int (* g_pfnDTraceProviderUnregister)(dtrace_provider_id_t); 126 127 #define dtrace_probe g_pfnDTraceProbeFire 128 #define dtrace_probe_create g_pfnDTraceProbeCreate 129 #define dtrace_probe_lookup g_pfnDTraceProbeLookup 130 #define dtrace_register g_pfnDTraceProviderRegister 131 #define dtrace_invalidate g_pfnDTraceProviderInvalidate 132 #define dtrace_unregister g_pfnDTraceProviderUnregister 133 122 134 /** @} */ 123 135 #endif … … 358 370 359 371 /** 360 * @callback_method_impl{dtrace_pops_t,dtps_getargval} 361 * 362 * 363 * We just cook our own stuff here, using a stack marker for finding the 364 * required information. That's more reliable than subjecting oneself to the 365 * solaris bugs and 32-bit apple peculiarities. 366 * 367 * 372 * @callback_method_impl{dtrace_pops_t,dtps_getargval} 373 * 374 * 375 * We just cook our own stuff here, using a stack marker for finding the 376 * required information. That's more reliable than subjecting oneself to the 377 * solaris bugs and 32-bit apple peculiarities. 378 * 379 * 368 380 * @remarks Solaris Bug 369 * 370 * dtrace_getarg on AMD64 has a different opinion about how to use the cFrames 371 * argument than dtrace_caller() and/or dtrace_getpcstack(), at least when the 372 * probe is fired by dtrace_probe() the way we do. 373 * 381 * 382 * dtrace_getarg on AMD64 has a different opinion about how to use the cFrames 383 * argument than dtrace_caller() and/or dtrace_getpcstack(), at least when the 384 * probe is fired by dtrace_probe() the way we do. 385 * 374 386 * Setting aframes to 1 when calling dtrace_probe_create gives me the right 375 387 * arguments, but the wrong 'caller'. Since I cannot do anything about 376 388 * 'caller', the only solution is this hack. 377 * 389 * 378 390 * Not sure why the Solaris guys hasn't seen this issue before, but maybe there 379 * isn't anyone using the default argument getter path for ring-0 dtrace_probe() 380 * calls, SDT surely isn't. 381 * 391 * isn't anyone using the default argument getter path for ring-0 dtrace_probe() 392 * calls, SDT surely isn't. 393 * 382 394 * @todo File a solaris bug on dtrace_probe() + dtrace_getarg(). 383 * 384 * 385 * @remarks 32-bit XNU (Apple) 386 * 387 * The dtrace_probe arguments are 64-bit unsigned integers instead of uintptr_t, 388 * so we need to make an extra call. 389 * 395 * 396 * 397 * @remarks 32-bit XNU (Apple) 398 * 399 * The dtrace_probe arguments are 64-bit unsigned integers instead of uintptr_t, 400 * so we need to make an extra call. 401 * 390 402 */ 391 403 static uint64_t supdrvDtPOps_GetArgVal(void *pvProv, dtrace_id_t idProbe, void *pvProbe, … … 488 500 * interface_method_impl{SUPDRVTRACERREG,pfnTracerOpen} 489 501 */ 490 static DECLCALLBACK(int) supdrvDtTOps_TracerOpen(PCSUPDRVTRACERREG pThis, PSUPDRVSESSION pSession, uint32_t uCookie, 502 static DECLCALLBACK(int) supdrvDtTOps_TracerOpen(PCSUPDRVTRACERREG pThis, PSUPDRVSESSION pSession, uint32_t uCookie, 491 503 uintptr_t uArg, uintptr_t *puSessionData) 492 504 { … … 653 665 PFNRT *ppfn; 654 666 } s_aDTraceFunctions[] = 655 { 667 { 656 668 { "dtrace_probe", (PFNRT*)&dtrace_probe }, 657 669 { "dtrace_probe_create", (PFNRT*)&dtrace_probe_create }, … … 663 675 for (unsigned i = 0; i < RT_ELEMENTS(s_aDTraceFunctions); i++) 664 676 { 665 rc = RTR0DbgKrnlInfoQuerySymbol(hKrnlInfo, NULL, s_aDTraceFunctions[i].pszName, 677 rc = RTR0DbgKrnlInfoQuerySymbol(hKrnlInfo, NULL, s_aDTraceFunctions[i].pszName, 666 678 (void **)s_aDTraceFunctions[i].ppfn); 667 679 if (RT_FAILURE(rc)) -
trunk/src/bldprogs/VBoxTpG.cpp
r40851 r40857 136 136 static const char g_szAssemblerFmtVal32[] = "macho32"; 137 137 static const char g_szAssemblerFmtVal64[] = "macho64"; 138 static const char g_szAssemblerOsDef[] = "RT_OS_DARWIN"; 138 139 #elif defined(RT_OS_OS2) 139 140 static const char *pszAssembler = "nasm.exe"; … … 141 142 static const char g_szAssemblerFmtVal32[] = "obj"; 142 143 static const char g_szAssemblerFmtVal64[] = "elf64"; 144 static const char g_szAssemblerOsDef[] = "RT_OS_OS2"; 143 145 #elif defined(RT_OS_WINDOWS) 144 146 static const char *g_pszAssembler = "yasm.exe"; … … 146 148 static const char g_szAssemblerFmtVal32[] = "win32"; 147 149 static const char g_szAssemblerFmtVal64[] = "win64"; 150 static const char g_szAssemblerOsDef[] = "RT_OS_WINDOWS"; 148 151 #else 149 152 static const char *g_pszAssembler = "yasm"; … … 151 154 static const char g_szAssemblerFmtVal32[] = "elf32"; 152 155 static const char g_szAssemblerFmtVal64[] = "elf64"; 156 # ifdef RT_OS_FREEBSD 157 static const char g_szAssemblerOsDef[] = "RT_OS_FREEBSD"; 158 # elif defined(RT_OS_NETBSD) 159 static const char g_szAssemblerOsDef[] = "RT_OS_NETBSD"; 160 # elif defined(RT_OS_OPENBSD) 161 static const char g_szAssemblerOsDef[] = "RT_OS_OPENBSD"; 162 # elif defined(RT_OS_LINUX) 163 static const char g_szAssemblerOsDef[] = "RT_OS_LINUX"; 164 # elif defined(RT_OS_SOLARIS) 165 static const char g_szAssemblerOsDef[] = "RT_OS_SOLARIS"; 166 # else 167 # error "Port me!" 168 # endif 153 169 #endif 154 170 static const char *g_pszAssemblerFmtVal = RT_CONCAT(g_szAssemblerFmtVal, ARCH_BITS); … … 253 269 else 254 270 apszArgs[iArg++] = "RT_ARCH_AMD64"; 271 if (g_szAssemblerOsDef[0]) 272 { 273 apszArgs[iArg++] = g_pszAssemblerDefOpt; 274 apszArgs[iArg++] = g_szAssemblerOsDef; 275 } 255 276 apszArgs[iArg++] = g_pszAssemblerIncOpt; 256 277 apszArgs[iArg++] = g_pszAssemblerIncVal; … … 452 473 " NAME(%%1):\n" 453 474 " %%endmacro\n" 454 " ;[section VTG Obj align=4096]\n" 455 " [section .data]\n" 475 " [section __VTG __VTGObj align=64]\n" 456 476 "\n" 457 477 "%%elifdef ASM_FORMAT_PE\n" … … 502 522 " RTCCPTR_DEF NAME(g_aVTGArgLists)\n" 503 523 " RTCCPTR_DEF NAME(g_aVTGArgLists_End) - NAME(g_aVTGArgLists)\n" 524 "%%ifdef ASM_FORMAT_MACHO ; Apple has a real decent linker!\n" 525 "extern section$start$__VTG$__VTGPrLc\n" 526 " RTCCPTR_DEF section$start$__VTG$__VTGPrLc\n" 527 "extern section$end$__VTG$__VTGPrLc\n" 528 " RTCCPTR_DEF section$end$__VTG$__VTGPrLc\n" 529 "%%else\n" 504 530 " RTCCPTR_DEF NAME(g_aVTGPrLc)\n" 505 531 " RTCCPTR_DEF NAME(g_aVTGPrLc_End) ; cross section/segment size not possible\n" 532 "%%endif\n" 506 533 " RTCCPTR_DEF 0\n" 507 534 " RTCCPTR_DEF 0\n" … … 642 669 " dd %6u ; name\n" 643 670 " dd %6u ; Argument list offset\n" 644 " dw g_fVTGProbeEnabled_%s_%s - g_afVTGProbeEnabled\n"671 " dw NAME(g_fVTGProbeEnabled_%s_%s) - NAME(g_afVTGProbeEnabled)\n" 645 672 " dw %6u ; provider index\n" 646 673 " dd 0 ; for the application\n" … … 1903 1930 { "--probe-fn-name", kVBoxTpGOpt_ProbeFnName, RTGETOPT_REQ_STRING }, 1904 1931 { "--probe-fn-imported", kVBoxTpGOpt_ProbeFnImported, RTGETOPT_REQ_BOOL }, 1932 /** @todo We're missing a bunch of assembler options! */ 1905 1933 }; 1906 1934
Note:
See TracChangeset
for help on using the changeset viewer.

