Changeset 53663 in vbox for trunk/src/VBox
- Timestamp:
- Jan 2, 2015 12:31:45 PM (10 years ago)
- Location:
- trunk/src/VBox/ExtPacks/VBoxDTrace
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ExtPacks/VBoxDTrace/VBoxDTraceR0/VBoxDTraceR0.cpp
r53645 r53663 54 54 struct VBoxDtMutex g_DummyMtx; 55 55 56 void (*dtrace_cpu_init)(processorid_t); 57 void (*dtrace_modload)(struct modctl *); 58 void (*dtrace_modunload)(struct modctl *); 59 void (*dtrace_helpers_cleanup)(void); 60 void (*dtrace_helpers_fork)(proc_t *, proc_t *); 61 void (*dtrace_cpustart_init)(void); 62 void (*dtrace_cpustart_fini)(void); 63 void (*dtrace_cpc_fire)(uint64_t); 64 void (*dtrace_debugger_init)(void); 65 void (*dtrace_debugger_fini)(void); 66 dtrace_cacheid_t dtrace_predcache_id = DTRACE_CACHEIDNONE + 1; 67 68 69 void dtrace_toxic_ranges(void (*pfnAddOne)(uintptr_t uBase, uintptr_t cbRange)) 70 { 71 /** @todo ? */ 72 } 73 56 74 57 75 … … 156 174 } 157 175 return u64; 176 } 177 178 179 /** copyin implementation */ 180 int VBoxDtCopyIn(void const *pvUser, void *pvDst, size_t cb) 181 { 182 int rc = RTR0MemUserCopyFrom(pvDst, (uintptr_t)pvUser, cb); 183 return RT_SUCCESS(rc) ? 0 : -1; 184 } 185 186 187 /** copyout implementation */ 188 int VBoxDtCopyOut(void const *pvSrc, void *pvUser, size_t cb) 189 { 190 int rc = RTR0MemUserCopyTo((uintptr_t)pvUser, pvSrc, cb); 191 return RT_SUCCESS(rc) ? 0 : -1; 158 192 } 159 193 … … 451 485 } 452 486 487 488 /** uprintf implementation */ 489 void VBoxDtUPrintf(const char *pszFormat, ...) 490 { 491 va_list va; 492 va_start(va, pszFormat); 493 VBoxDtUPrintfV(pszFormat, va); 494 va_end(va); 495 } 496 497 498 /** vuprintf implementation */ 499 void VBoxDtUPrintfV(const char *pszFormat, va_list va) 500 { 501 SUPR0Printf("%N", pszFormat, va); 502 } 503 504 505 /* CRED implementation. */ 506 cred_t *VBoxDtGetCurrentCreds(void) 507 { 508 struct VBoxDtThread *pThread = VBoxDtGetCurrentThread(); 509 if (!pThread) 510 return NULL; 511 return pThread->t_proc->p_cred; 512 } 513 514 515 /* crhold implementation */ 516 void VBoxDtCredHold(struct VBoxDtCred *pCred) 517 { 518 int32_t cRefs = ASMAtomicIncS32(&pCred->cr_refs); 519 Assert(cRefs > 1); 520 } 521 522 523 /* crfree implementation */ 524 void VBoxDtCredFree(struct VBoxDtCred *pCred) 525 { 526 int32_t cRefs = ASMAtomicDecS32(&pCred->cr_refs); 527 Assert(cRefs >= 0); 528 if (!cRefs) 529 RTMemFree(pCred); 530 } 531 532 453 533 #if 0 454 dtrace_probe_error 455 456 VBoxDtGetCurrentCreds 534 VBoxDtDdiDriverMajor 535 VBoxDtDdiReportDev 536 VBoxDtDdiSoftStateAllocZ 537 VBoxDtDdiSoftStateFree 538 VBoxDtDdiSoftStateGet 539 VBoxDtDdiSoftStateInit 540 VBoxDtDdiSoftStateTerm 541 457 542 VBoxDtGetCurrentProc 458 543 VBoxDtGetCurrentThread 459 544 VBoxDtGetKernelBase 545 460 546 VBoxDtKMemAlloc 461 547 VBoxDtKMemAllocZ 548 VBoxDtKMemCacheAlloc 549 VBoxDtKMemCacheCreate 550 VBoxDtKMemCacheDestroy 551 VBoxDtKMemCacheFree 462 552 VBoxDtKMemFree 463 553 VBoxDtMutexEnter … … 465 555 VBoxDtMutexIsOwner 466 556 VBoxDtVMemAlloc 557 VBoxDtVMemCreate 558 VBoxDtVMemDestroy 467 559 VBoxDtVMemFree 560 561 562 dtrace_xcall 563 nocrt_strncpy 564 RTErrConvertToErrno 468 565 #endif -
trunk/src/VBox/ExtPacks/VBoxDTrace/include/VBoxDTraceTypes.h
r53659 r53663 189 189 typedef struct VBoxDtCred 190 190 { 191 int32_t cr_refs; 191 192 RTUID cr_uid; 192 193 RTUID cr_ruid; … … 219 220 uintptr_t t_dtrace_astpc; 220 221 uint32_t t_predcache; 222 struct VBoxDtProcess *t_proc; 221 223 } kthread_t; 222 extern kthread_t*VBoxDtGetCurrentThread(void);224 struct VBoxDtThread *VBoxDtGetCurrentThread(void); 223 225 #define curthread (VBoxDtGetCurrentThread()) 224 226 … … 229 231 RTPROCESS p_pid; 230 232 struct dtrace_helpers *p_dtrace_helpers; 233 struct VBoxDtCred *p_cred; 231 234 } proc_t; 232 235 proc_t *VBoxDtGetCurrentProc(void); … … 280 283 #define cpu_core (g_aVBoxDtCpuCores) 281 284 282 cred_t*VBoxDtGetCurrentCreds(void);285 struct VBoxDtCred *VBoxDtGetCurrentCreds(void); 283 286 #define CRED() VBoxDtGetCurrentCreds() 284 287 … … 386 389 void VBoxDtDdiReportDev(struct VBoxDtDevInfo *pDevInfo); 387 390 391 /* 392 * DTrace bits we've made external. 393 */ 394 extern int dtrace_attach(dev_info_t *devi, ddi_attach_cmd_t cmd); 395 extern int dtrace_ioctl(dev_t dev, int cmd, intptr_t arg, int md, cred_t *cr, int *rv); 396 388 397 #endif /* IN_RING0 */ 389 398 -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_subr.c
r53662 r53663 47 47 # include <unistd.h> 48 48 # endif 49 # include <VBox/sup.h> 49 50 #endif /* VBOX */ 50 51 … … 483 484 { 484 485 const dtrace_vector_t *v = dtp->dt_vector; 486 #ifdef VBOX 487 int rc; 488 #endif 485 489 486 490 if (v != NULL) … … 491 495 return (ioctl(dtp->dt_fd, val, arg)); 492 496 #else 497 # if 1 498 rc = SUPR3CallR0Service(RT_STR_TUPLE("VBoxDTrace"), val, (uintptr_t)arg, NULL); 499 if (RT_SUCCESS(rc)) { 500 501 } 502 # else 493 503 /* Fake ioctl */ 494 504 switch (val) { … … 531 541 532 542 } 533 AssertFailed(); /** @todo FIXME */ 543 # endif 534 544 #endif 535 545 … … 538 548 } 539 549 550 #ifndef /* VBOX - who needs this? */ 540 551 int 541 552 dt_status(dtrace_hdl_t *dtp, processorid_t cpu) … … 553 564 return (v->dtv_status(dtp->dt_varg, cpu)); 554 565 } 566 #endif 555 567 556 568 #ifndef VBOX -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/dtrace.c
r53647 r53663 14695 14695 * DTrace Driver Cookbook Functions 14696 14696 */ 14697 #ifndef VBOX 14697 14698 /*ARGSUSED*/ 14698 14699 static int 14699 14700 dtrace_attach(dev_info_t *devi, ddi_attach_cmd_t cmd) 14701 #else 14702 int dtrace_attach(dev_info_t *devi, ddi_attach_cmd_t cmd) 14703 #endif 14700 14704 { 14701 14705 dtrace_provider_id_t id; … … 15037 15041 15038 15042 /*ARGSUSED*/ 15043 #ifndef VBOX 15039 15044 static int 15040 15045 dtrace_ioctl(dev_t dev, int cmd, intptr_t arg, int md, cred_t *cr, int *rv) 15046 #else 15047 int dtrace_ioctl(dev_t dev, int cmd, intptr_t arg, int md, cred_t *cr, int *rv) 15048 #endif 15041 15049 { 15042 15050 minor_t minor = getminor(dev); … … 15793 15801 } 15794 15802 15803 #ifndef VBOX 15795 15804 /*ARGSUSED*/ 15796 15805 static int 15797 15806 dtrace_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) 15807 #else 15808 int dtrace_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) 15809 #endif 15798 15810 { 15799 15811 dtrace_state_t *state;
Note:
See TracChangeset
for help on using the changeset viewer.