Changeset 40981 in vbox for trunk/src/VBox/HostDrivers
- Timestamp:
- Apr 18, 2012 6:56:50 PM (13 years ago)
- Location:
- trunk/src/VBox/HostDrivers/Support
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPDrv.c
r40904 r40981 1789 1789 } 1790 1790 1791 case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_TRACER_UMOD_REG): 1792 { 1793 /* validate */ 1794 PSUPTRACERUMODREG pReq = (PSUPTRACERUMODREG)pReqHdr; 1795 REQ_CHECK_SIZES(SUP_IOCTL_TRACER_UMOD_REG); 1796 1797 /* execute */ 1798 pReqHdr->rc = supdrvIOCtl_TracerUmodRegister(pDevExt, pSession, pReq->u.In.pVtgHdr, pReq->u.In.szName, pReq->u.In.fFlags); 1799 return 0; 1800 } 1801 1802 case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_TRACER_UMOD_DEREG): 1803 { 1804 /* validate */ 1805 PSUPTRACERUMODDEREG pReq = (PSUPTRACERUMODDEREG)pReqHdr; 1806 REQ_CHECK_SIZES(SUP_IOCTL_TRACER_UMOD_DEREG); 1807 1808 /* execute */ 1809 pReqHdr->rc = supdrvIOCtl_TracerUmodDeregister(pDevExt, pSession, pReq->u.In.pVtgHdr); 1810 return 0; 1811 } 1812 1791 1813 default: 1792 1814 Log(("Unknown IOCTL %#lx\n", (long)uIOCtl)); -
trunk/src/VBox/HostDrivers/Support/SUPDrvIOC.h
r40819 r40981 1249 1249 1250 1250 1251 /** @name SUP_IOCTL_TRACER_UMOD_REG 1252 * Registers tracepoints in a user mode module. 1253 * 1254 * @{ 1255 */ 1256 #define SUP_IOCTL_TRACER_UMOD_REG SUP_CTL_CODE_SIZE(31, SUP_IOCTL_TRACER_UMOD_REG) 1257 #define SUP_IOCTL_TRACER_UMOD_REG_SIZE sizeof(SUPTRACERUMODREG) 1258 #define SUP_IOCTL_TRACER_UMOD_REG_SIZE_IN sizeof(SUPTRACERUMODREG) 1259 #define SUP_IOCTL_TRACER_UMOD_REG_SIZE_OUT sizeof(SUPREQHDR) 1260 typedef struct SUPTRACERUMODREG 1261 { 1262 /** The header. */ 1263 SUPREQHDR Hdr; 1264 union 1265 { 1266 struct 1267 { 1268 /** Pointer to the VTG header. */ 1269 RTR3PTR pVtgHdr; 1270 /** Future flags, MBZ. */ 1271 uint32_t fFlags; 1272 /** The module name. */ 1273 char szName[64]; 1274 } In; 1275 } u; 1276 } SUPTRACERUMODREG, *PSUPTRACERUMODREG; 1277 /** @} */ 1278 1279 1280 /** @name SUP_IOCTL_TRACER_UMOD_DEREG 1281 * Deregisters tracepoints in a user mode module. 1282 * 1283 * @{ 1284 */ 1285 #define SUP_IOCTL_TRACER_UMOD_DEREG SUP_CTL_CODE_SIZE(32, SUP_IOCTL_TRACER_UMOD_DEREG) 1286 #define SUP_IOCTL_TRACER_UMOD_DEREG_SIZE sizeof(SUPTRACERUMODDEREG) 1287 #define SUP_IOCTL_TRACER_UMOD_DEREG_SIZE_IN sizeof(SUPTRACERUMODDEREG) 1288 #define SUP_IOCTL_TRACER_UMOD_DEREG_SIZE_OUT sizeof(SUPREQHDR) 1289 typedef struct SUPTRACERUMODDEREG 1290 { 1291 /** The header. */ 1292 SUPREQHDR Hdr; 1293 union 1294 { 1295 struct 1296 { 1297 /** Pointer to the VTG header. */ 1298 RTR3PTR pVtgHdr; 1299 } In; 1300 } u; 1301 } SUPTRACERUMODDEREG, *PSUPTRACERUMODDEREG; 1302 /** @} */ 1303 1304 1251 1305 #pragma pack() /* paranoia */ 1252 1306 -
trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h
r40975 r40981 661 661 DECLASM(void) supdrvTracerProbeFireStub(void); 662 662 663 int VBOXCALL supdrvIOCtl_TracerUmodRegister(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, RTR3PTR pVtgHdr, const char *pszModName, uint32_t fFlags); 664 int VBOXCALL supdrvIOCtl_TracerUmodDeregister(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, RTR3PTR pVtgHdr); 665 void VBOXCALL supdrvIOCtl_TracerUmodProbeFire(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PCSUPDRVTRACERUSRCTX pCtx); 666 663 667 #ifdef VBOX_WITH_NATIVE_DTRACE 664 668 const SUPDRVTRACERREG * VBOXCALL supdrvDTraceInit(void); -
trunk/src/VBox/HostDrivers/Support/SUPDrvTracer.cpp
r40975 r40981 1233 1233 1234 1234 1235 int VBOXCALL supdrvIOCtl_TracerUmodRegister(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, RTR3PTR pVtgHdr, const char *pszModName, uint32_t fFlags) 1236 { 1237 return VERR_NOT_IMPLEMENTED; 1238 } 1239 1240 int VBOXCALL supdrvIOCtl_TracerUmodDeregister(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, RTR3PTR pVtgHdr) 1241 { 1242 return VERR_NOT_IMPLEMENTED; 1243 } 1244 1245 void VBOXCALL supdrvIOCtl_TracerUmodProbeFire(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PCSUPDRVTRACERUSRCTX pCtx) 1246 { 1247 1248 } 1249 1250 1235 1251 /** 1236 1252 * Open the tracer. -
trunk/src/VBox/HostDrivers/Support/SUPLib.cpp
r40975 r40981 2387 2387 } 2388 2388 2389 extern "C" 2390 { 2391 SUPDECL(void) SUPTracerFireProbe(uint32_t idProbe, uintptr_t uArg0, uintptr_t uArg1, uintptr_t uArg2, 2392 uintptr_t uArg3, uintptr_t uArg4); 2393 } 2394 2395 SUPDECL(void) SUPTracerFireProbe(uint32_t idProbe, uintptr_t uArg0, uintptr_t uArg1, uintptr_t uArg2, 2389 2390 2391 SUPDECL(void) SUPTracerFireProbe(struct VTGPROBELOC *pVtgProbeLoc, uintptr_t uArg0, uintptr_t uArg1, uintptr_t uArg2, 2396 2392 uintptr_t uArg3, uintptr_t uArg4) 2397 2393 { … … 2399 2395 } 2400 2396 2397 2398 SUPR3DECL(int) SUPR3TracerRegisterModule(uintptr_t hModNative, const char *pszModule, struct VTGOBJHDR *pVtgHdr, uint32_t fFlags) 2399 { 2400 /* Validate input. */ 2401 NOREF(hModNative); 2402 AssertPtrReturn(pVtgHdr, VERR_INVALID_POINTER); 2403 AssertPtrReturn(pszModule, VERR_INVALID_POINTER); 2404 size_t cchModule = strlen(pszModule); 2405 AssertReturn(cchModule < RT_SIZEOFMEMB(SUPTRACERUMODREG, u.In.szName), VERR_FILENAME_TOO_LONG); 2406 AssertReturn(!RTPathHavePath(pszModule), VERR_INVALID_PARAMETER); 2407 AssertReturn(fFlags == SUP_TRACER_UMOD_FLAGS_EXE || fFlags == SUP_TRACER_UMOD_FLAGS_SHARED, VERR_INVALID_PARAMETER); 2408 2409 /* fake */ 2410 if (RT_UNLIKELY(g_u32FakeMode)) 2411 return VINF_SUCCESS; 2412 2413 /* 2414 * Issue IOCtl to the SUPDRV kernel module. 2415 */ 2416 SUPTRACERUMODREG Req; 2417 Req.Hdr.u32Cookie = g_u32Cookie; 2418 Req.Hdr.u32SessionCookie= g_u32SessionCookie; 2419 Req.Hdr.cbIn = SUP_IOCTL_TRACER_UMOD_REG_SIZE_IN; 2420 Req.Hdr.cbOut = SUP_IOCTL_TRACER_UMOD_REG_SIZE_OUT; 2421 Req.Hdr.fFlags = SUPREQHDR_FLAGS_DEFAULT; 2422 Req.Hdr.rc = VERR_INTERNAL_ERROR; 2423 Req.u.In.pVtgHdr = pVtgHdr; 2424 Req.u.In.fFlags = fFlags; 2425 2426 memcpy(Req.u.In.szName, pszModule, cchModule); 2427 if (!RTPathHasExt(Req.u.In.szName)) 2428 { 2429 /* Add the default suffix if none is given. */ 2430 switch (fFlags & SUP_TRACER_UMOD_FLAGS_TYPE_MASK) 2431 { 2432 #if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2) 2433 case SUP_TRACER_UMOD_FLAGS_EXE: 2434 if (cchModule + sizeof(".exe") <= sizeof(Req.u.In.szName)) 2435 strcpy(&Req.u.In.szName[cchModule], ".exe"); 2436 break; 2437 #endif 2438 2439 case SUP_TRACER_UMOD_FLAGS_SHARED: 2440 { 2441 const char *pszSuff = RTLdrGetSuff(); 2442 size_t cchSuff = strlen(pszSuff); 2443 if (cchModule + cchSuff < sizeof(Req.u.In.szName)) 2444 memcpy(&Req.u.In.szName[cchModule], pszSuff, cchSuff + 1); 2445 break; 2446 } 2447 } 2448 } 2449 2450 int rc = suplibOsIOCtl(&g_supLibData, SUP_IOCTL_TRACER_UMOD_REG, &Req, SUP_IOCTL_TRACER_UMOD_REG_SIZE); 2451 if (RT_SUCCESS(rc)) 2452 rc = Req.Hdr.rc; 2453 return rc; 2454 } 2455 2456 2457 SUPR3DECL(int) SUPR3TracerDeregisterModule(struct VTGOBJHDR *pVtgHdr) 2458 { 2459 /* Validate input. */ 2460 AssertPtrReturn(pVtgHdr, VERR_INVALID_POINTER); 2461 2462 /* fake */ 2463 if (RT_UNLIKELY(g_u32FakeMode)) 2464 return VINF_SUCCESS; 2465 2466 /* 2467 * Issue IOCtl to the SUPDRV kernel module. 2468 */ 2469 SUPTRACERUMODDEREG Req; 2470 Req.Hdr.u32Cookie = g_u32Cookie; 2471 Req.Hdr.u32SessionCookie= g_u32SessionCookie; 2472 Req.Hdr.cbIn = SUP_IOCTL_TRACER_UMOD_REG_SIZE_IN; 2473 Req.Hdr.cbOut = SUP_IOCTL_TRACER_UMOD_REG_SIZE_OUT; 2474 Req.Hdr.fFlags = SUPREQHDR_FLAGS_DEFAULT; 2475 Req.Hdr.rc = VERR_INTERNAL_ERROR; 2476 Req.u.In.pVtgHdr = pVtgHdr; 2477 2478 int rc = suplibOsIOCtl(&g_supLibData, SUP_IOCTL_TRACER_UMOD_DEREG, &Req, SUP_IOCTL_TRACER_UMOD_DEREG_SIZE); 2479 if (RT_SUCCESS(rc)) 2480 rc = Req.Hdr.rc; 2481 return rc; 2482 } 2483
Note:
See TracChangeset
for help on using the changeset viewer.