儲存庫 vbox 的更動 53642
- 時間撮記:
- 2015-1-2 下午12:16:22 (10 年 以前)
- 位置:
- trunk/src/VBox/ExtPacks/VBoxDTrace
- 檔案:
-
- 修改 4 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/ExtPacks/VBoxDTrace/include/VBoxDTraceTypes.h
r53641 r53642 37 37 RT_C_DECLS_BEGIN 38 38 39 struct modctl; 40 39 41 typedef unsigned char uchar_t; 40 42 typedef unsigned int uint_t; … … 58 60 zoneid_t cr_zone; 59 61 } cred_t; 60 #define PRIV_POLICY_ONLY(a_pCred, a_uPriv, a_fAll) (true) 61 #define crgetuid(a_pCred) ((a_pCred)->cr_uid) 62 #define crgetzoneid(a_pCred) ((a_pCred)->cr_zone) 63 64 65 typedef struct VBoxDtCyclicId *cyclic_id_t; 62 #define PRIV_POLICY_ONLY(a_pCred, a_uPriv, a_fAll) (true) 63 #define priv_isequalset(a, b) (true) 64 #define crgetuid(a_pCred) ((a_pCred)->cr_uid) 65 #define crgetzoneid(a_pCred) ((a_pCred)->cr_zone) 66 #define crhold(a_pCred) VBoxDtCredHold 67 #define crfree(a_pCred) VBoxDtCredFree 68 void VBoxDtCredHold(struct VBoxDtCred *pCred); 69 void VBoxDtCredFree(struct VBoxDtCred *pCred); 70 71 72 typedef struct RTTIMER *cyclic_id_t; 73 #define CYCLIC_NONE ((struct RTTIMER *)NULL) 74 #define cyclic_remove(a_hTimer) RTTimerDestroy(a_hTimer) 66 75 67 76 typedef struct VBoxDtThread … … 81 90 { 82 91 uint32_t p_flag; 92 RTPROCESS p_pid; 83 93 struct dtrace_helpers *p_dtrace_helpers; 84 94 } proc_t; … … 89 99 90 100 91 typedef struct VBoxDtDevInfo dev_info_t;92 101 typedef struct VBoxDtTaskQueue taskq_t; 93 typedef struct VBoxDtMemCache kmem_cache_t;94 102 95 103 typedef struct VBoxDtMutex … … 100 108 #define mutex_exit VBoxDtMutexExit 101 109 #define MUTEX_HELD(a_pMtx) VBoxDtMutexIsOwner(a_pMtx) 110 #define MUTEX_NOT_HELD(a_pMtx) (!VBoxDtMutexIsOwner(a_pMtx)) 102 111 #define mod_lock g_DummyMtx 103 112 #define cpu_lock g_DummyMtx … … 157 166 typedef RTUID uid_t; 158 167 typedef RTPROCESS pid_t; 159 typedef RTDEV dev_t;160 168 #endif 161 169 170 #define B_FALSE (0) 171 #define B_TRUE (1) 162 172 #define NANOSEC RT_NS_1SEC 163 173 #define MILLISEC RT_MS_1SEC … … 165 175 #define NCPU RTCPUSET_MAX_CPUS 166 176 #define P2ROUNDUP(uWhat, uAlign) ( ((uWhat) + (uAlign) - 1) & ~(uAlign - 1) ) 177 #define IS_P2ALIGNED(uWhat, uAlign) ( !((uWhat) & ((uAlign) - 1)) ) 167 178 #define roundup(uWhat, uUnit) ( ( (uWhat) + ((uUnit) - 1)) / (uUnit) * (uUnit) ) 179 #define MIN(a1, a2) RT_MIN(a1, a2) 168 180 169 181 #define CPU_ON_INTR(a_pCpu) (false) … … 194 206 * comparsion warnings. */ 195 207 #define VBDTTYPE(a_VBox, a_Org) a_VBox 208 /** Mark missing void in a parameter list. */ 209 #define VBDTVOID void 210 /** Mark missing static in a function definition. */ 211 #define VBDTSTATIC static 212 #define VBDTUNASS(a_Value) = a_Value 196 213 197 214 /* … … 207 224 void VBoxDtKMemFree(void *pvMem, size_t cbMem); 208 225 226 227 typedef struct VBoxDtMemCache kmem_cache_t; 228 #define kmem_cache_create VBoxDtKMemCacheCreate 229 #define kmem_cache_destroy VBoxDtKMemCacheDestroy 230 #define kmem_cache_alloc VBoxDtKMemCacheAlloc 231 #define kmem_cache_free VBoxDtKMemCacheFree 232 struct VBoxDtMemCache *VBoxDtKMemCacheCreate(const char *pszName, size_t cbBuf, size_t cbAlign, 233 PFNRT pfnCtor, PFNRT pfnDtor, PFNRT pfnReclaim, 234 void *pvUser, void *pvVM, uint32_t fFlags); 235 void VBoxDtKMemCacheDestroy(struct VBoxDtMemCache *pCache); 236 void *VBoxDtKMemCacheAlloc(struct VBoxDtMemCache *pCache, uint32_t fFlags); 237 void VBoxDtKMemCacheFree(struct VBoxDtMemCache *pCache, void *pvMem); 238 239 209 240 typedef struct VBoxDtVMem 210 241 { … … 214 245 #define VM_SLEEP RT_BIT(0) 215 246 #define VM_BESTFIT RT_BIT(1) 247 #define VMC_IDENTIFIER RT_BIT(16) 248 #define vmem_create VBoxDtVMemCreate 249 #define vmem_destroy VBoxDtVMemDestroy 216 250 #define vmem_alloc VBoxDtVMemAlloc 217 251 #define vmem_free VBoxDtVMemFree 252 struct VBoxDtVMem *VBoxDtVMemCreate(const char *pszName, void *pvBase, size_t cb, size_t cbUnit, 253 PFNRT pfnAlloc, PFNRT pfnFree, struct VBoxDtVMem *pSrc, 254 size_t cbQCacheMax, uint32_t fFlags); 255 void VBoxDtVMemDestroy(struct VBoxDtVMem *pVMemArena); 218 256 void *VBoxDtVMemAlloc(struct VBoxDtVMem *pVMemArena, size_t cbMem, uint32_t fFlags); 219 257 void VBoxDtVMemFree(struct VBoxDtVMem *pVMemArena, void *pvMem, size_t cbMem); … … 229 267 #define ENOSPC (28) 230 268 #define ENOENT (2) 269 #define EFAULT (14) 270 #define E2BIG (7) 271 #define EACCES (13) 272 #define EALREADY (114) 273 #define ENXIO (6) 274 #define EAGAIN (11) 275 #define ENOTTY (25) 276 #define ESRCH (3) 231 277 232 278 /* … … 235 281 #define bcopy(a_pSrc, a_pDst, a_cb) memmove(a_pDst, a_pSrc, a_cb) 236 282 #define bzero(a_pDst, a_cb) RT_BZERO(a_pDst, a_cb) 283 #define bcmp(a_p1, a_p2, a_cb) memcmp(a_p1, a_p2, a_cb) 284 #define snprintf RTStrPrintf 285 286 /* 287 * Copy In/Out 288 */ 289 #define copyin VBoxDtCopyIn 290 #define copyout VBoxDtCopyOut 291 int VBoxDtCopyIn(void const *pvUser, void *pvDst, size_t cb); 292 int VBoxDtCopyOut(void const *pvSrc, void *pvUser, size_t cb); 293 294 /* 295 * Device numbers. 296 */ 297 typedef uint64_t dev_t; 298 typedef uint32_t major_t; 299 typedef uint32_t minor_t; 300 #define makedevice(a_Maj, a_Min) RT_MAKE_U64(a_Min, a_Maj) 301 #define getemajor(a_Dev) RT_HIDWORD(a_Dev) 302 #define geteminor(a_Dev) RT_LODWORD(a_Dev) 303 #define getminor(a_Dev) RT_LODWORD(a_Dev) 304 305 /* 306 * DDI 307 */ 308 #define DDI_SUCCESS (0) 309 #define DDI_FAILURE (-1) 310 #define ddi_soft_state_init VBoxDtDdiSoftStateInit 311 #define ddi_soft_state_fini VBoxDtDdiSoftStateTerm 312 #define ddi_soft_state_zalloc VBoxDtDdiSoftStateAllocZ 313 #define ddi_get_soft_state VBoxDtDdiSoftStateGet 314 #define ddi_soft_state_free VBoxDtDdiSoftStateFree 315 int VBoxDtDdiSoftStateInit(void **ppvSoftStates, size_t cbSoftState, uint32_t cMaxItems); 316 int VBoxDtDdiSoftStateTerm(void **ppvSoftStates); 317 int VBoxDtDdiSoftStateAllocZ(void *pvSoftStates, RTDEV uMinor); 318 int VBoxDtDdiSoftStateFree(void *pvSoftStates, RTDEV uMinor); 319 void *VBoxDtDdiSoftStateGet(void *pvSoftStates, RTDEV uMinor); 320 321 typedef struct VBoxDtDevInfo dev_info_t; 322 typedef enum { DDI_ATT_CMD_DUMMY } ddi_attach_cmd_t; 323 typedef enum { DDI_DETACH, DDI_SUSPEND } ddi_detach_cmd_t; 324 #define ddi_driver_major VBoxDtDdiDriverMajor 325 #define ddi_report_dev VBoxDtDdiReportDev 326 major_t VBoxDtDdiDriverMajor(struct VBoxDtDevInfo *pDevInfo); 327 void VBoxDtDdiReportDev(struct VBoxDtDevInfo *pDevInfo); 328 329 /* 330 * CTF - probably needs to be ported wholesale or smth. 331 */ 332 #define CTF_MODEL_NATIVE 1 237 333 238 334 RT_C_DECLS_END -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/dtrace.c
r53641 r53642 101 101 # include <iprt/process.h> 102 102 # include <iprt/thread.h> 103 # include <iprt/timer.h> 103 104 # include <limits.h> 104 105 … … 177 178 static vmem_t *dtrace_arena; /* probe ID arena */ 178 179 static vmem_t *dtrace_minor; /* minor number arena */ 180 #ifndef VBOX 179 181 static taskq_t *dtrace_taskq; /* task queue */ 182 #endif 180 183 static dtrace_probe_t **dtrace_probes; /* array of all probes */ 181 184 static VBDTTYPE(uint32_t,int) dtrace_nprobes; /* number of probes */ … … 410 413 #define DTRACE_LOADFUNC(bits) \ 411 414 /*CSTYLED*/ \ 412 uint##bits##_t\415 VBDTSTATIC uint##bits##_t \ 413 416 dtrace_load##bits(uintptr_t addr) \ 414 417 { \ … … 1116 1119 */ 1117 1120 static int 1118 dtrace_priv_proc_common_nocd( )1121 dtrace_priv_proc_common_nocd(VBDTVOID) 1119 1122 { 1120 1123 proc_t *proc; … … 1207 1210 * cleaning is explained in detail in <sys/dtrace_impl.h>. 1208 1211 */ 1209 void1212 VBDTSTATIC void 1210 1213 dtrace_dynvar_clean(dtrace_dstate_t *dstate) 1211 1214 { … … 1347 1350 * will be incremented. 1348 1351 */ 1349 dtrace_dynvar_t *1352 VBDTSTATIC dtrace_dynvar_t * 1350 1353 dtrace_dynvar(dtrace_dstate_t *dstate, uint_t nkeys, 1351 1354 dtrace_key_t *key, size_t dsize, dtrace_dynvar_op_t op, … … 1836 1839 } 1837 1840 } else { 1838 for (i = zero + 1; i < DTRACE_QUANTIZE_NBUCKETS; i++) {1841 for (i = zero + 1; i < VBDTCAST(int)DTRACE_QUANTIZE_NBUCKETS; i++) { 1839 1842 if (val < DTRACE_QUANTIZE_BUCKETVAL(i)) { 1840 1843 quanta[i - 1] += incr; … … 2525 2528 2526 2529 rv = dtrace_cas32((uint32_t *)&spec->dtsp_state, current, new); 2527 ASSERT( rv == current);2530 ASSERT(VBDTCAST(dtrace_speculation_state_t)rv == current); 2528 2531 spec->dtsp_cleaning = 0; 2529 2532 } … … 2609 2612 * builtin values such as 'execname' and 'probefunc.' 2610 2613 */ 2611 uintptr_t2614 VBDTSTATIC uintptr_t 2612 2615 dtrace_dif_varstr(uintptr_t addr, dtrace_state_t *state, 2613 2616 dtrace_mstate_t *mstate) … … 2810 2813 mstate->dtms_caller = caller[1]; 2811 2814 } else if ((mstate->dtms_caller = 2812 dtrace_caller(aframes)) == -1) {2815 dtrace_caller(aframes)) == VBDTCAST(uintptr_t)-1) { 2813 2816 /* 2814 2817 * We have failed to do this the quick way; … … 3665 3668 uint8_t c, tokmap[32]; /* 256 / 8 */ 3666 3669 char *dest = (char *)mstate->dtms_scratch_ptr; 3667 inti;3670 VBDTTYPE(unsigned,int) i; 3668 3671 3669 3672 /* … … 4049 4052 uintptr_t s1 = tupregs[0].dttk_value; 4050 4053 uintptr_t s2 = tupregs[1].dttk_value; 4051 inti = 0;4054 VBDTTYPE(unsigned,int) i = 0; 4052 4055 4053 4056 if (!dtrace_strcanload(s1, size, mstate, vstate) || … … 4273 4276 } 4274 4277 4275 for (i = start, j = 0; i <= end && j < size - 1; i++, j++)4278 for (i = start, j = 0; i <= end && VBDTCAST(unsigned)j < size - 1; i++, j++) 4276 4279 dest[j] = dtrace_load8(src + i); 4277 4280 … … 4305 4308 c = dtrace_load8(src + i++); 4306 4309 next: 4307 if (j + 5 >= size) /* 5 = strlen("/..c\0") */4310 if (j + 5 >= VBDTCAST(int64_t)size) /* 5 = strlen("/..c\0") */ 4308 4311 break; 4309 4312 … … 4629 4632 uint8_t cc_n = 0, cc_z = 0, cc_v = 0, cc_c = 0; 4630 4633 int64_t cc_r; 4631 uint_t pc = 0, id, opc ;4634 uint_t pc = 0, id, opc VBDTUNASS(0); 4632 4635 uint8_t ttop = 0; 4633 4636 dif_instr_t instr; … … 5598 5601 (nframes * sizeof (uint64_t)); 5599 5602 5600 if (!DTRACE_INSCRATCH(mstate, size)) {5603 if (!DTRACE_INSCRATCH(mstate, VBDTCAST(unsigned)size)) { 5601 5604 /* 5602 5605 * Not enough room for our frame pointers -- need to indicate … … 5781 5784 uint64_t val = 0; 5782 5785 #else 5783 uint64_t val ;5786 uint64_t val VBDTUNASS(0); 5784 5787 #endif 5785 5788 … … 9306 9309 int necbs = state->dts_necbs << 1; 9307 9310 9308 ASSERT(epid == state->dts_necbs + 1);9311 ASSERT(epid == VBDTCAST(dtrace_epid_t)state->dts_necbs + 1); 9309 9312 9310 9313 if (necbs == 0) { … … 9424 9427 diff = offs + sizeof (dtrace_aggid_t); 9425 9428 9426 if ( diff = (diff & (sizeof (uint64_t) - 1)))9429 if ((diff = (diff & (sizeof (uint64_t) - 1)))) 9427 9430 offs += sizeof (uint64_t) - diff; 9428 9431 … … 9639 9642 int onaggs = state->dts_naggregations; 9640 9643 9641 ASSERT(aggid == state->dts_naggregations + 1);9644 ASSERT(aggid == VBDTCAST(dtrace_aggid_t)state->dts_naggregations + 1); 9642 9645 9643 9646 if (naggs == 0) { … … 10125 10128 */ 10126 10129 dtrace_ecb_t *cached = dtrace_ecb_create_cache; 10127 dtrace_action_t *act = cached->dte_action;10128 10129 if (act != NULL) {10130 ASSERT(act ->dta_refcnt > 0);10131 act ->dta_refcnt++;10132 ecb->dte_action = act ;10130 dtrace_action_t *act2 = cached->dte_action; 10131 10132 if (act2 != NULL) { 10133 ASSERT(act2->dta_refcnt > 0); 10134 act2->dta_refcnt++; 10135 ecb->dte_action = act2; 10133 10136 ecb->dte_action_last = cached->dte_action_last; 10134 10137 ecb->dte_needed = cached->dte_needed; … … 10315 10318 for (iCpu = 0; iCpu < RTCPUSET_MAX_CPUS; iCpu++) { 10316 10319 if ( !RTCpuSetIsMember(&CpuSet, iCpu) 10317 || (cpu != DTRACE_CPUALL && cpu != iCpu))10320 || (cpu != (processorid_t)DTRACE_CPUALL && cpu != iCpu)) 10318 10321 continue; 10319 10322 … … 10366 10369 for (iCpu = 0; iCpu < RTCPUSET_MAX_CPUS; iCpu++) { 10367 10370 if ( !RTCpuSetIsMember(&CpuSet, iCpu) 10368 || (cpu != DTRACE_CPUALL && cpu != iCpu))10371 || (cpu != (processorid_t)DTRACE_CPUALL && cpu != iCpu)) 10369 10372 continue; 10370 10373 … … 11280 11283 * that the length isn't outrageous. 11281 11284 */ 11282 if (hdr.dofh_loadsz >= dtrace_dof_maxsize) {11285 if (hdr.dofh_loadsz >= VBDTCAST(uint64_t)dtrace_dof_maxsize) { 11283 11286 dtrace_dof_error(&hdr, "load size exceeds maximum"); 11284 11287 *errp = E2BIG; … … 11307 11310 dtrace_dof_property(const char *name) 11308 11311 { 11312 #ifndef VBOX 11309 11313 uchar_t *buf; 11310 11314 uint64_t loadsz; … … 11347 11351 11348 11352 return (dof); 11353 #else /* VBOX */ 11354 return (NULL); 11355 #endif /* VBOX */ 11349 11356 } 11350 11357 … … 11531 11538 11532 11539 for (i = 0; difo[i].section != DOF_SECT_NONE; i++) { 11533 if (subsec->dofs_type != difo[i].section)11540 if (subsec->dofs_type != VBDTCAST(uint32_t)difo[i].section) 11534 11541 continue; 11535 11542 … … 11539 11546 } 11540 11547 11541 if (subsec->dofs_align != difo[i].align) {11548 if (subsec->dofs_align != VBDTCAST(uint32_t)difo[i].align) { 11542 11549 dtrace_dof_error(dof, "bad alignment"); 11543 11550 goto err; … … 11552 11559 } 11553 11560 11554 if ( difo[i].entsize != subsec->dofs_entsize) {11561 if (VBDTCAST(uint32_t)difo[i].entsize != subsec->dofs_entsize) { 11555 11562 dtrace_dof_error(dof, "entry size mismatch"); 11556 11563 goto err; … … 11601 11608 * setting of the option. 11602 11609 */ 11603 for (i = 0; i < dp->dtdo_varlen; i++) {11610 for (i = 0; VBDTCAST(unsigned)i < dp->dtdo_varlen; i++) { 11604 11611 dtrace_difv_t *v = &dp->dtdo_vartab[i]; 11605 11612 dtrace_diftype_t *t = &v->dtdv_type; … … 12110 12117 dof_optdesc_t *desc; 12111 12118 12112 for (i = 0; i < dof->dofh_secnum; i++) {12119 for (i = 0; VBDTCAST(unsigned)i < dof->dofh_secnum; i++) { 12113 12120 dof_sec_t *sec = (dof_sec_t *)((uintptr_t)dof + 12114 12121 (uintptr_t)dof->dofh_secoff + i * dof->dofh_secsize); … … 12142 12149 } 12143 12150 12144 if (desc->dofo_value == DTRACEOPT_UNSET) {12151 if (desc->dofo_value == VBDTCAST(uint64_t)DTRACEOPT_UNSET) { 12145 12152 dtrace_dof_error(dof, "unset option"); 12146 12153 return (EINVAL); … … 12161 12168 * DTrace Consumer State Functions 12162 12169 */ 12163 int12170 VBDTSTATIC int 12164 12171 dtrace_dstate_init(dtrace_dstate_t *dstate, size_t size) 12165 12172 { … … 12168 12175 uintptr_t limit; 12169 12176 dtrace_dynvar_t *dvar, *next, *start; 12170 inti;12177 VBDTTYPE(size_t,int) i; 12171 12178 12172 12179 ASSERT(MUTEX_HELD(&dtrace_lock)); … … 12259 12266 } 12260 12267 12261 void12268 VBDTSTATIC void 12262 12269 dtrace_dstate_fini(dtrace_dstate_t *dstate) 12263 12270 { … … 12306 12313 dtrace_speculation_clean(state); 12307 12314 } 12315 #ifdef VBOX 12316 static DECLCALLBACK(void) dtrace_state_clean_timer(PRTTIMER pTimer, void *pvUser, uint64_t iTick) 12317 { 12318 dtrace_state_clean((dtrace_state_t *)pvUser); 12319 NOREF(pTimer); NOREF(iTick); 12320 } 12321 #endif 12308 12322 12309 12323 static void … … 12334 12348 } 12335 12349 12336 dtrace_state_t * 12350 #ifdef VBOX 12351 static DECLCALLBACK(void) dtrace_state_deadman_timer(PRTTIMER pTimer, void *pvUser, uint64_t iTick) 12352 { 12353 dtrace_state_deadman((dtrace_state_t *)pvUser); 12354 NOREF(pTimer); NOREF(iTick); 12355 } 12356 #endif 12357 12358 VBDTSTATIC dtrace_state_t * 12337 12359 dtrace_state_create(dev_t *devp, cred_t *cr) 12338 12360 { … … 12573 12595 } 12574 12596 12575 for (size = opt[which]; size >= sizeof (uint64_t); size >>= 1) {12597 for (size = opt[which]; size >= VBDTCAST(dtrace_optval_t)sizeof (uint64_t); size >>= 1) { 12576 12598 /* 12577 12599 * The size must be 8-byte aligned. If the size is not 8-byte … … 12660 12682 dtrace_speculation_t *spec; 12661 12683 dtrace_buffer_t *buf; 12684 #ifndef VBOX 12662 12685 cyc_handler_t hdlr; 12663 12686 cyc_time_t when; 12687 #endif 12664 12688 int rval = 0, i, bufsize = NCPU * sizeof (dtrace_buffer_t); 12665 12689 dtrace_icookie_t cookie; … … 12768 12792 */ 12769 12793 if (opt[DTRACEOPT_BUFSIZE] == DTRACEOPT_UNSET || 12770 opt[DTRACEOPT_BUFSIZE] < state->dts_needed) {12794 opt[DTRACEOPT_BUFSIZE] < VBDTCAST(dtrace_optval_t)state->dts_needed) { 12771 12795 opt[DTRACEOPT_BUFSIZE] = state->dts_needed; 12772 12796 } … … 12839 12863 opt[DTRACEOPT_CLEANRATE] = dtrace_cleanrate_max; 12840 12864 12865 #ifndef VBOX 12841 12866 hdlr.cyh_func = (cyc_func_t)dtrace_state_clean; 12842 12867 hdlr.cyh_arg = state; … … 12857 12882 state->dts_alive = state->dts_laststatus = dtrace_gethrtime(); 12858 12883 state->dts_deadman = cyclic_add(&hdlr, &when); 12884 #else /* VBOX */ 12885 12886 rval = RTTimerCreateEx(&state->dts_cleaner, opt[DTRACEOPT_CLEANRATE], 12887 RTTIMER_FLAGS_CPU_ANY, dtrace_state_clean_timer, state); 12888 if (RT_FAILURE(rval)) { 12889 rval = RTErrConvertToErrno(rval); 12890 goto err; 12891 } 12892 12893 state->dts_alive = state->dts_laststatus = dtrace_gethrtime(); 12894 rval = RTTimerCreateEx(&state->dts_deadman, dtrace_deadman_interval, 12895 RTTIMER_FLAGS_CPU_ANY, dtrace_state_deadman_timer, state); 12896 if (RT_FAILURE(rval)) { 12897 RTTimerDestroy(state->dts_cleaner); 12898 state->dts_cleaner = CYCLIC_NONE; 12899 state->dts_deadman = CYCLIC_NONE; 12900 rval = RTErrConvertToErrno(rval); 12901 goto err; 12902 } 12903 #endif /* VBOX */ 12859 12904 12860 12905 state->dts_activity = DTRACE_ACTIVITY_WARMUP; … … 13196 13241 } 13197 13242 13243 #ifndef VBOX 13198 13244 /* 13199 13245 * We want to create anonymous state, so we need to transition … … 13208 13254 break; 13209 13255 } 13256 #endif 13210 13257 13211 13258 /* … … 13288 13335 return; 13289 13336 13290 ASSERT(vstate->dtvs_nlocals <= dtrace_helptrace_nlocals);13337 ASSERT(vstate->dtvs_nlocals <= VBDTCAST(int32_t)dtrace_helptrace_nlocals); 13291 13338 13292 13339 /* … … 13303 13350 next = dtrace_helptrace_next; 13304 13351 13305 if (next + size < dtrace_helptrace_bufsize) {13352 if (next + size < VBDTCAST(unsigned)dtrace_helptrace_bufsize) { 13306 13353 nnext = next + size; 13307 13354 } else { … … 13326 13373 ent->dtht_illval = cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_illval; 13327 13374 13328 for (i = 0; i < vstate->dtvs_nlocals; i++) {13375 for (i = 0; VBDTCAST(int32_t)i < vstate->dtvs_nlocals; i++) { 13329 13376 dtrace_statvar_t *svar; 13330 13377 … … 13342 13389 dtrace_state_t *state, uint64_t arg0, uint64_t arg1) 13343 13390 { 13344 uint16_t *flags = &cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags;13391 VBDTTYPE(uint16_t volatile *, uint16_t *)flags = &cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags; 13345 13392 uint64_t sarg0 = mstate->dtms_arg[0]; 13346 13393 uint64_t sarg1 = mstate->dtms_arg[1]; … … 13454 13501 dtrace_helpers_t *help = p->p_dtrace_helpers; 13455 13502 dtrace_vstate_t *vstate; 13456 inti;13503 VBDTTYPE(uint_t,int) i; 13457 13504 13458 13505 ASSERT(MUTEX_HELD(&dtrace_lock)); … … 13618 13665 } 13619 13666 13620 if (vstate->dtvs_nlocals > dtrace_helptrace_nlocals) {13667 if (vstate->dtvs_nlocals > VBDTCAST(int32_t)dtrace_helptrace_nlocals) { 13621 13668 dtrace_helptrace_nlocals = vstate->dtvs_nlocals; 13622 13669 dtrace_helptrace_next = 0; … … 13676 13723 */ 13677 13724 13678 inti;13725 VBDTTYPE(uint_t,int) i; 13679 13726 mutex_exit(&dtrace_lock); 13680 13727 … … 14009 14056 */ 14010 14057 if (dhp != NULL) { 14011 for (i = 0; i < dof->dofh_secnum; i++) {14058 for (i = 0; i < VBDTCAST(int)dof->dofh_secnum; i++) { 14012 14059 dof_sec_t *sec = (dof_sec_t *)(uintptr_t)(daddr + 14013 14060 dof->dofh_secoff + i * dof->dofh_secsize); … … 14104 14151 dtrace_vstate_t *vstate; 14105 14152 proc_t *p = curproc; 14106 inti;14153 VBDTTYPE(uint_t, int) i; 14107 14154 14108 14155 mutex_enter(&dtrace_lock); … … 14232 14279 14233 14280 for (j = 0; j < new->dtha_nactions; j++) { 14234 dtrace_difo_t *dp = helper->dtha_actions[j];14235 14236 ASSERT(dp != NULL);14237 dp = dtrace_difo_duplicate(dp, vstate);14238 new->dtha_actions[j] = dp ;14281 dtrace_difo_t *dp2 = helper->dtha_actions[j]; 14282 14283 ASSERT(dp2 != NULL); 14284 dp2 = dtrace_difo_duplicate(dp2, vstate); 14285 new->dtha_actions[j] = dp2; 14239 14286 } 14240 14287 … … 14258 14305 newhelp->dthps_provs = kmem_alloc(newhelp->dthps_nprovs * 14259 14306 sizeof (dtrace_helper_provider_t *), KM_SLEEP); 14260 for (i = 0; i < newhelp->dthps_nprovs; i++) {14307 for (i = 0; i < VBDTCAST(int)newhelp->dthps_nprovs; i++) { 14261 14308 newhelp->dthps_provs[i] = help->dthps_provs[i]; 14262 14309 newhelp->dthps_provs[i]->dthp_ref++; … … 14271 14318 dtrace_helper_provider_register(to, newhelp, NULL); 14272 14319 } 14320 14321 #ifndef VBOX 14273 14322 14274 14323 /* … … 14422 14471 } 14423 14472 14424 void 14473 #endif /* !VBOX */ 14474 14475 VBDTSTATIC void 14425 14476 dtrace_suspend(void) 14426 14477 { … … 14428 14479 } 14429 14480 14430 void14481 VBDTSTATIC void 14431 14482 dtrace_resume(void) 14432 14483 { 14433 14484 dtrace_probe_foreach(offsetof(dtrace_pops_t, dtps_resume)); 14434 14485 } 14486 14487 #ifdef VBOX 14488 typedef enum { 14489 CPU_INVALID, 14490 CPU_CONFIG, 14491 CPU_UNCONFIG 14492 } cpu_setup_t; 14493 #endif 14494 14435 14495 14436 14496 static int … … 14493 14553 } 14494 14554 14555 #ifndef VBOX 14495 14556 static void 14496 14557 dtrace_cpu_setup_initial(processorid_t cpu) … … 14498 14559 (void) dtrace_cpu_setup(CPU_CONFIG, cpu); 14499 14560 } 14561 #endif /* !VBOX */ 14500 14562 14501 14563 static void … … 14560 14622 } 14561 14623 14624 #ifndef VBOX 14562 14625 if (ddi_create_minor_node(devi, DTRACEMNR_DTRACE, S_IFCHR, 14563 14626 DTRACEMNRN_DTRACE, DDI_PSEUDO, NULL) == DDI_FAILURE || … … 14572 14635 return (DDI_FAILURE); 14573 14636 } 14637 #endif 14574 14638 14575 14639 ddi_report_dev(devi); 14576 14640 dtrace_devi = devi; 14577 14641 14642 #ifndef VBOX 14578 14643 dtrace_modload = dtrace_module_loaded; 14579 14644 dtrace_modunload = dtrace_module_unloaded; … … 14587 14652 14588 14653 register_cpu_setup_func((cpu_setup_func_t *)dtrace_cpu_setup, NULL); 14654 #else 14655 /** @todo some of these hooks needs checking out! */ 14656 #endif 14589 14657 14590 14658 ASSERT(MUTEX_HELD(&cpu_lock)); … … 14595 14663 UINT32_MAX - DTRACEMNRN_CLONE, 1, NULL, NULL, NULL, 0, 14596 14664 VM_SLEEP | VMC_IDENTIFIER); 14665 #ifndef VBOX 14597 14666 dtrace_taskq = taskq_create("dtrace_taskq", 1, maxclsyspri, 14598 14667 1, INT_MAX, 0); 14668 #endif 14599 14669 14600 14670 dtrace_state_cache = kmem_cache_create("dtrace_state_cache", … … 14745 14815 dtrace_membar_producer(); 14746 14816 14817 #ifndef VBOX 14747 14818 /* 14748 14819 * If the kernel debugger is active (that is, if the kernel debugger … … 14755 14826 return (EBUSY); 14756 14827 } 14828 #endif 14757 14829 14758 14830 state = dtrace_state_create(devp, cred_p); … … 14760 14832 14761 14833 if (state == NULL) { 14834 #ifndef VBOX 14762 14835 if (--dtrace_opens == 0 && dtrace_anon.dta_enabling == NULL) 14763 14836 (void) kdi_dtrace_set(KDI_DTSET_DTRACE_DEACTIVATE); 14837 #endif 14764 14838 mutex_exit(&dtrace_lock); 14765 14839 return (EAGAIN); … … 14797 14871 ASSERT(dtrace_opens > 0); 14798 14872 14873 #ifndef VBOX 14799 14874 /* 14800 14875 * Only relinquish control of the kernel debugger interface when there … … 14803 14878 if (--dtrace_opens == 0 && dtrace_anon.dta_enabling == NULL) 14804 14879 (void) kdi_dtrace_set(KDI_DTSET_DTRACE_DEACTIVATE); 14880 #endif 14805 14881 14806 14882 mutex_exit(&dtrace_lock); … … 15366 15442 return (EFAULT); 15367 15443 15368 if ( desc.dtbd_cpu < 0 ||desc.dtbd_cpu >= NCPU)15444 if (/*VBox value is is unsigned: desc.dtbd_cpu < 0 ||*/ desc.dtbd_cpu >= NCPU) 15369 15445 return (EINVAL); 15370 15446 … … 15671 15747 dtrace_state_destroy(state); 15672 15748 15749 #ifndef VBOX 15673 15750 /* 15674 15751 * If we're being detached with anonymous state, we need to … … 15676 15753 */ 15677 15754 (void) kdi_dtrace_set(KDI_DTSET_DTRACE_DEACTIVATE); 15755 #endif 15678 15756 } 15679 15757 15680 15758 bzero(&dtrace_anon, sizeof (dtrace_anon_t)); 15759 #ifndef VBOX /** @todo CPU hooks */ 15681 15760 unregister_cpu_setup_func((cpu_setup_func_t *)dtrace_cpu_setup, NULL); 15761 #endif 15682 15762 dtrace_cpu_init = NULL; 15683 15763 dtrace_helpers_cleanup = NULL; … … 15720 15800 } 15721 15801 15802 #ifndef VBOX 15722 15803 ddi_remove_minor_node(dtrace_devi, NULL); 15804 #endif 15723 15805 dtrace_devi = NULL; 15724 15806 … … 15740 15822 * performing any operation. 15741 15823 */ 15824 #ifndef VBOX 15742 15825 taskq_destroy(dtrace_taskq); 15743 15826 dtrace_taskq = NULL; 15827 #endif 15744 15828 15745 15829 return (DDI_SUCCESS); 15746 15830 } 15747 15831 15832 #ifndef VBOX 15748 15833 /*ARGSUSED*/ 15749 15834 static int … … 15829 15914 return (mod_remove(&modlinkage)); 15830 15915 } 15916 15917 #endif /* !VBOX */ -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/sys/dtrace.h
r53641 r53642 467 467 (((sizeof (uint64_t) * NBBY) - 1) * 2 + 1) 468 468 469 #define DTRACE_QUANTIZE_ZEROBUCKET ( (sizeof (uint64_t) * NBBY) - 1)469 #define DTRACE_QUANTIZE_ZEROBUCKET (VBDTCAST(int)(sizeof (uint64_t) * NBBY) - 1) 470 470 471 471 #define DTRACE_QUANTIZE_BUCKETVAL(buck) \ … … 2196 2196 extern void (*dtrace_modload)(struct modctl *); 2197 2197 extern void (*dtrace_modunload)(struct modctl *); 2198 extern void (*dtrace_helpers_cleanup)( );2198 extern void (*dtrace_helpers_cleanup)(VBDTVOID); 2199 2199 extern void (*dtrace_helpers_fork)(proc_t *parent, proc_t *child); 2200 extern void (*dtrace_cpustart_init)( );2201 extern void (*dtrace_cpustart_fini)( );2202 2203 extern void (*dtrace_debugger_init)( );2204 extern void (*dtrace_debugger_fini)( );2200 extern void (*dtrace_cpustart_init)(VBDTVOID); 2201 extern void (*dtrace_cpustart_fini)(VBDTVOID); 2202 2203 extern void (*dtrace_debugger_init)(VBDTVOID); 2204 extern void (*dtrace_debugger_fini)(VBDTVOID); 2205 2205 extern dtrace_cacheid_t dtrace_predcache_id; 2206 2206 -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/sys/dtrace_impl.h
r53636 r53642 1262 1262 extern int dtrace_assfail(const char *, const char *, int); 1263 1263 extern int dtrace_attached(void); 1264 extern hrtime_t dtrace_gethrestime( );1264 extern hrtime_t dtrace_gethrestime(void); 1265 1265 1266 1266 #ifdef __sparc
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器