Changeset 53667 in vbox for trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/uts
- Timestamp:
- Jan 2, 2015 12:32:53 PM (10 years ago)
- Location:
- trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/dtrace.c
r53666 r53667 206 206 * DTrace Internal Variables 207 207 */ 208 #ifndef VBOX 208 209 static dev_info_t *dtrace_devi; /* device info */ 210 #endif 209 211 static vmem_t *dtrace_arena; /* probe ID arena */ 212 #ifndef VBOX 210 213 static vmem_t *dtrace_minor; /* minor number arena */ 211 #ifndef VBOX212 214 static taskq_t *dtrace_taskq; /* task queue */ 213 215 #endif … … 218 220 static int dtrace_opens; /* number of opens */ 219 221 static int dtrace_helpers; /* number of helpers */ 222 #ifndef VBOX 220 223 static void *dtrace_softstate; /* softstate pointer */ 224 #endif 221 225 static dtrace_hash_t *dtrace_bymod; /* probes hashed by module */ 222 226 static dtrace_hash_t *dtrace_byfunc; /* probes hashed by function */ … … 518 522 static void dtrace_enabling_matchall(void); 519 523 static dtrace_state_t *dtrace_anon_grab(void); 524 #ifndef VBOX 520 525 static uint64_t dtrace_helper(int, dtrace_mstate_t *, 521 526 dtrace_state_t *, uint64_t, uint64_t); 522 527 static dtrace_helpers_t *dtrace_helpers_create(proc_t *); 528 #endif 523 529 static void dtrace_buffer_drop(dtrace_buffer_t *); 524 530 static intptr_t dtrace_buffer_reserve(dtrace_buffer_t *, size_t, size_t, … … 1152 1158 dtrace_priv_proc_common_nocd(VBDTVOID) 1153 1159 { 1160 #ifndef VBOX 1154 1161 proc_t *proc; 1155 1162 … … 1159 1166 1160 1167 return (0); 1168 #else 1169 return (1); 1170 #endif 1161 1171 } 1162 1172 … … 2519 2529 } 2520 2530 2531 #ifdef VBOX 2532 /** */ 2533 static DECLCALLBACK(void) dtrace_speculation_clean_here_wrapper(RTCPUID idCpu, void *pvUser1, void *pvUser2) 2534 { 2535 dtrace_speculation_clean_here((dtrace_state_t *)pvUser1); 2536 NOREF(pvUser2); NOREF(idCpu); 2537 } 2538 #endif 2539 2521 2540 /* 2522 2541 * Note: not called from probe context. This function is called … … 2549 2568 return; 2550 2569 2570 #ifndef VBOX 2551 2571 dtrace_xcall(DTRACE_CPUALL, 2552 2572 (dtrace_xcall_t)dtrace_speculation_clean_here, state); 2573 #else 2574 RTMpOnAll(dtrace_speculation_clean_here_wrapper, state, NULL); 2575 #endif 2553 2576 2554 2577 /* … … 5692 5715 break; 5693 5716 5717 #ifndef VBOX 5694 5718 sym = (char *)(uintptr_t)dtrace_helper( 5695 5719 DTRACE_HELPER_ACTION_USTACK, 5696 5720 mstate, state, pcs[i], fps[i]); 5721 #else 5722 sym = NULL; 5723 #endif 5697 5724 5698 5725 /* … … 5929 5956 s_cr->cr_gid != cr->cr_rgid || 5930 5957 s_cr->cr_gid != cr->cr_sgid || 5958 #ifndef VBOX 5931 5959 (proc = VBDT_GET_PROC()) == NULL || 5932 5960 (proc->p_flag & SNOCD)) 5961 #else 5962 0) 5963 5964 #endif 5933 5965 continue; 5934 5966 } … … 6105 6137 } 6106 6138 6139 #ifndef VBOX /* no helpers */ 6107 6140 if (DTRACE_USTACK_STRSIZE(rec->dtrd_arg) != 0 && 6108 6141 curproc->p_dtrace_helpers != NULL) { … … 6119 6152 continue; 6120 6153 } 6154 #endif 6121 6155 6122 6156 DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); … … 7277 7311 */ 7278 7312 ASSERT(old == dtrace_provider); 7313 #ifndef VBOX 7279 7314 ASSERT(dtrace_devi != NULL); 7315 #endif 7280 7316 ASSERT(MUTEX_HELD(&dtrace_provider_lock)); 7281 7317 ASSERT(MUTEX_HELD(&dtrace_lock)); … … 7380 7416 7381 7417 if ((prev = dtrace_provider) == old) { 7418 #ifndef VBOX 7382 7419 ASSERT(self || dtrace_devi == NULL); 7383 7420 ASSERT(old->dtpv_next == NULL || dtrace_devi == NULL); 7421 #endif 7384 7422 dtrace_provider = old->dtpv_next; 7385 7423 } else { … … 10348 10386 } 10349 10387 10388 #ifdef VBOX 10389 static DECLCALLBACK(void) dtrace_buffer_switch_wrapper(RTCPUID idCpu, void *pvUser1, void *pvUser2) 10390 { 10391 dtrace_buffer_switch((dtrace_buffer_t *)pvUser1); 10392 NOREF(pvUser2); NOREF(idCpu); 10393 } 10394 #endif 10395 10350 10396 /* 10351 10397 * Note: called from cross call context. This function activates a buffer … … 10374 10420 dtrace_interrupt_enable(cookie); 10375 10421 } 10422 10423 #ifdef VBOX 10424 static DECLCALLBACK(void) dtrace_buffer_activate_wrapper(RTCPUID idCpu, void *pvUser1, void *pvUser2) 10425 { 10426 dtrace_buffer_activate((dtrace_state_t *)pvUser1); 10427 NOREF(pvUser2); NOREF(idCpu); 10428 } 10429 #endif 10376 10430 10377 10431 static int … … 12451 12505 12452 12506 VBDTSTATIC dtrace_state_t * 12507 #ifdef VBOX 12508 dtrace_state_create(cred_t *cr) 12509 #else 12453 12510 dtrace_state_create(dev_t *devp, cred_t *cr) 12511 #endif 12454 12512 { 12455 12513 minor_t minor; … … 12463 12521 ASSERT(MUTEX_HELD(&cpu_lock)); 12464 12522 12523 #ifndef VBOX 12465 12524 minor = (minor_t)(uintptr_t)vmem_alloc(dtrace_minor, 1, 12466 12525 VM_BESTFIT | VM_SLEEP); … … 12472 12531 12473 12532 state = ddi_get_soft_state(dtrace_softstate, minor); 12533 #else 12534 state = kmem_alloc(sizeof (*state), KM_SLEEP); 12535 if (!state) { 12536 return (NULL); 12537 } 12538 #endif 12474 12539 state->dts_epid = DTRACE_EPIDNONE + 1; 12475 12540 … … 12478 12543 NULL, NULL, NULL, 0, VM_SLEEP | VMC_IDENTIFIER); 12479 12544 12545 #ifndef VBOX 12480 12546 if (devp != NULL) { 12481 12547 major = getemajor(*devp); … … 12488 12554 if (devp != NULL) 12489 12555 *devp = state->dts_dev; 12556 #endif 12490 12557 12491 12558 /* … … 13031 13098 * processing all of them. 13032 13099 */ 13100 #ifndef VBOX 13033 13101 dtrace_xcall(DTRACE_CPUALL, 13034 13102 (dtrace_xcall_t)dtrace_buffer_activate, state); 13103 #else 13104 RTMpOnAll(dtrace_buffer_activate_wrapper, state, NULL); 13105 #endif 13035 13106 goto out; 13036 13107 … … 13178 13249 dtrace_ecb_t *ecb; 13179 13250 dtrace_vstate_t *vstate = &state->dts_vstate; 13251 #ifndef VBOX 13180 13252 minor_t minor = getminor(state->dts_dev); 13253 #endif 13181 13254 int i, bufsize = NCPU * sizeof (dtrace_buffer_t); 13182 13255 dtrace_speculation_t *spec = state->dts_speculations; … … 13285 13358 13286 13359 vmem_destroy(state->dts_aggid_arena); 13360 #ifndef VBOX 13287 13361 ddi_soft_state_free(dtrace_softstate, minor); 13288 13362 vmem_free(dtrace_minor, (void *)(uintptr_t)minor, 1); 13363 #else 13364 kmem_free(state, sizeof (*state)); 13365 #endif 13289 13366 } 13290 13367 … … 13420 13497 * DTrace Helper Functions 13421 13498 */ 13499 #ifndef VBOX /* No helper stuff */ 13422 13500 static void 13423 13501 dtrace_helper_trace(dtrace_helper_action_t *helper, … … 14415 14493 } 14416 14494 14417 #ifndef VBOX14418 14419 14495 /* 14420 14496 * DTrace Hook Functions … … 14697 14773 * DTrace Driver Cookbook Functions 14698 14774 */ 14699 #ifndef VBOX 14775 #ifdef VBOX 14776 int dtrace_attach(ddi_attach_cmd_t cmd) 14777 #else 14700 14778 /*ARGSUSED*/ 14701 14779 static int 14702 14780 dtrace_attach(dev_info_t *devi, ddi_attach_cmd_t cmd) 14703 #else14704 int dtrace_attach(dev_info_t *devi, ddi_attach_cmd_t cmd)14705 14781 #endif 14706 14782 { … … 14713 14789 mutex_enter(&dtrace_lock); 14714 14790 14791 #ifndef VBOX 14715 14792 if (ddi_soft_state_init(&dtrace_softstate, 14716 14793 sizeof (dtrace_state_t), 0) != 0) { … … 14722 14799 } 14723 14800 14724 #ifndef VBOX14725 14801 if (ddi_create_minor_node(devi, DTRACEMNR_DTRACE, S_IFCHR, 14726 14802 DTRACEMNRN_DTRACE, DDI_PSEUDO, NULL) == DDI_FAILURE || … … 14735 14811 return (DDI_FAILURE); 14736 14812 } 14737 #endif14738 14813 14739 14814 ddi_report_dev(devi); 14740 14815 dtrace_devi = devi; 14741 14816 14742 #ifndef VBOX14743 14817 dtrace_modload = dtrace_module_loaded; 14744 14818 dtrace_modunload = dtrace_module_unloaded; … … 14760 14834 dtrace_arena = vmem_create("dtrace", (void *)1, UINT32_MAX, 1, 14761 14835 NULL, NULL, NULL, 0, VM_SLEEP | VMC_IDENTIFIER); 14836 #ifndef VBOX 14762 14837 dtrace_minor = vmem_create("dtrace_minor", (void *)DTRACEMNRN_CLONE, 14763 14838 UINT32_MAX - DTRACEMNRN_CLONE, 1, NULL, NULL, NULL, 0, 14764 14839 VM_SLEEP | VMC_IDENTIFIER); 14765 #ifndef VBOX14766 14840 dtrace_taskq = taskq_create("dtrace_taskq", 1, maxclsyspri, 14767 14841 1, INT_MAX, 0); … … 14878 14952 } 14879 14953 14954 #ifdef VBOX 14955 int dtrace_open(dtrace_state_t **ppState, cred_t *cred_p) 14956 #else 14880 14957 /*ARGSUSED*/ 14881 14958 static int 14882 14959 dtrace_open(dev_t *devp, int flag, int otyp, cred_t *cred_p) 14960 #endif 14883 14961 { 14884 14962 dtrace_state_t *state; … … 14887 14965 zoneid_t zoneid; 14888 14966 14967 #ifndef VBOX 14889 14968 if (getminor(*devp) == DTRACEMNRN_HELPER) 14890 14969 return (0); … … 14896 14975 if (getminor(*devp) != DTRACEMNRN_DTRACE) 14897 14976 return (ENXIO); 14977 #endif /* !VBOX */ 14898 14978 14899 14979 /* … … 14930 15010 #endif 14931 15011 15012 #ifndef VBOX 14932 15013 state = dtrace_state_create(devp, cred_p); 15014 #else 15015 state = dtrace_state_create(cred_p); 15016 #endif 14933 15017 mutex_exit(&cpu_lock); 14934 15018 … … 14944 15028 mutex_exit(&dtrace_lock); 14945 15029 15030 #ifdef VBOX 15031 *ppState = state; 15032 #endif 14946 15033 return (0); 14947 15034 } 14948 15035 15036 #ifdef VBOX 15037 int dtrace_close(dtrace_state_t *state) 15038 #else 14949 15039 /*ARGSUSED*/ 14950 15040 static int 14951 15041 dtrace_close(dev_t dev, int flag, int otyp, cred_t *cred_p) 14952 { 15042 #endif 15043 { 15044 #ifndef VBOX 14953 15045 minor_t minor = getminor(dev); 14954 15046 dtrace_state_t *state; … … 14958 15050 14959 15051 state = ddi_get_soft_state(dtrace_softstate, minor); 15052 #endif 14960 15053 14961 15054 mutex_enter(&cpu_lock); … … 15046 15139 #endif /* !VBOX */ 15047 15140 15141 #ifdef VBOX 15142 int dtrace_ioctl(dtrace_state_t *state, int cmd, intptr_t arg, int32_t *rv) 15143 #else 15048 15144 /*ARGSUSED*/ 15049 #ifndef VBOX15050 15145 static int 15051 15146 dtrace_ioctl(dev_t dev, int cmd, intptr_t arg, int md, cred_t *cr, int *rv) 15052 #else15053 int dtrace_ioctl(dev_t dev, int cmd, intptr_t arg, int md, cred_t *cr, int *rv)15054 15147 #endif 15055 15148 { 15149 #ifndef VBOX 15056 15150 minor_t minor = getminor(dev); 15057 15151 dtrace_state_t *state; 15152 #endif 15058 15153 int rval; 15059 15154 … … 15061 15156 if (minor == DTRACEMNRN_HELPER) 15062 15157 return (dtrace_ioctl_helper(cmd, arg, rv)); 15158 15159 state = ddi_get_soft_state(dtrace_softstate, minor); 15063 15160 #endif 15064 15065 state = ddi_get_soft_state(dtrace_softstate, minor);15066 15161 15067 15162 if (state->dts_anon) { … … 15281 15376 dtrace_vstate_t *vstate; 15282 15377 int err = 0; 15378 #ifdef VBOX 15379 cred_t *cr = CRED(); 15380 #endif 15283 15381 15284 15382 *rv = 0; … … 15372 15470 uid_t uid; 15373 15471 zoneid_t zoneid; 15472 #ifdef VBOX 15473 cred_t *cr = CRED(); 15474 #endif 15374 15475 15375 15476 if (copyin((void *)arg, &desc, sizeof (desc)) != 0) … … 15629 15730 ASSERT(!(buf->dtb_flags & DTRACEBUF_NOSWITCH)); 15630 15731 15732 #ifndef VBOX 15631 15733 dtrace_xcall(desc.dtbd_cpu, 15632 15734 (dtrace_xcall_t)dtrace_buffer_switch, buf); 15735 #else 15736 if ((int32_t)desc.dtbd_cpu == DTRACE_CPUALL) 15737 RTMpOnAll(dtrace_buffer_switch_wrapper, buf, NULL); 15738 else 15739 RTMpOnSpecific(desc.dtbd_cpu, dtrace_buffer_switch_wrapper, buf, NULL); 15740 #endif 15633 15741 15634 15742 state->dts_errors += buf->dtb_xamot_errors; … … 15809 15917 } 15810 15918 15811 #ifndef VBOX 15919 #ifdef VBOX 15920 int dtrace_detach(ddi_detach_cmd_t cmd) 15921 #else 15812 15922 /*ARGSUSED*/ 15813 15923 static int 15814 15924 dtrace_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) 15815 #else15816 int dtrace_detach(dev_info_t *dip, ddi_detach_cmd_t cmd)15817 15925 #endif 15818 15926 { … … 15903 16011 15904 16012 kmem_cache_destroy(dtrace_state_cache); 16013 #ifndef VBOX 15905 16014 vmem_destroy(dtrace_minor); 16015 #endif 15906 16016 vmem_destroy(dtrace_arena); 15907 16017 … … 15916 16026 #ifndef VBOX 15917 16027 ddi_remove_minor_node(dtrace_devi, NULL); 16028 dtrace_devi = NULL; 16029 16030 ddi_soft_state_fini(&dtrace_softstate); 15918 16031 #endif 15919 dtrace_devi = NULL;15920 15921 ddi_soft_state_fini(&dtrace_softstate);15922 16032 15923 16033 ASSERT(dtrace_vtime_references == 0); -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/sys/dtrace_impl.h
r53642 r53667 1102 1102 */ 1103 1103 struct dtrace_state { 1104 #ifndef VBOX 1104 1105 dev_t dts_dev; /* device */ 1106 #endif 1105 1107 int dts_necbs; /* total number of ECBs */ 1106 1108 dtrace_ecb_t **dts_ecbs; /* array of ECBs */
Note:
See TracChangeset
for help on using the changeset viewer.