From owner-p4-projects@FreeBSD.ORG Tue May 2 00:00:11 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id BC95216A406; Tue, 2 May 2006 00:00:10 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8278F16A401 for ; Tue, 2 May 2006 00:00:10 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0C3B843D49 for ; Tue, 2 May 2006 00:00:10 +0000 (GMT) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k42009pZ046320 for ; Tue, 2 May 2006 00:00:09 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k420090L046317 for perforce@freebsd.org; Tue, 2 May 2006 00:00:09 GMT (envelope-from jb@freebsd.org) Date: Tue, 2 May 2006 00:00:09 GMT Message-Id: <200605020000.k420090L046317@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jb@freebsd.org using -f From: John Birrell To: Perforce Change Reviews Cc: Subject: PERFORCE change 96533 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2006 00:00:11 -0000 http://perforce.freebsd.org/chv.cgi?CH=96533 Change 96533 by jb@jb_freebsd2 on 2006/05/01 23:59:55 Work-in-progress update. Lots and lots of issues still with this file. At the moment I'm not sure how to get most of the commented out sections of this file executed. I think I need Sun's DTrace Test Suite for that. Affected files ... .. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_dif.c#4 edit Differences ... ==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_dif.c#4 (text+ko) ==== @@ -83,13 +83,8 @@ return (mstate->dtms_timestamp); case DIF_VAR_VTIMESTAMP: -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); -#ifdef DOODAD ASSERT(dtrace_vtime_references != 0); return (curthread->t_dtrace_vtime); -#else -return 0; -#endif case DIF_VAR_WALLTIMESTAMP: if (!(mstate->dtms_present & DTRACE_MSTATE_WALLTIMESTAMP)) { @@ -218,7 +213,6 @@ return ((uint64_t)(uintptr_t) mstate->dtms_probe->dtpr_mod); - case DIF_VAR_PROBEFUNC: ASSERT(mstate->dtms_present & DTRACE_MSTATE_PROBE); return ((uint64_t)(uintptr_t) mstate->dtms_probe->dtpr_func); @@ -338,11 +332,10 @@ dtrace_key_t *tupregs, int nargs, dtrace_mstate_t *mstate, dtrace_state_t *state) { -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); -#ifdef DOODAD volatile uint16_t *flags = &cpu_core[CPU->cpu_id].cpuc_dtrace_flags; volatile uintptr_t *illval = &cpu_core[CPU->cpu_id].cpuc_dtrace_illval; +#ifdef DOODAD union { mutex_impl_t mi; uint64_t mx; @@ -352,6 +345,7 @@ krwlock_t ri; uintptr_t rw; } r; +#endif switch (subr) { case DIF_SUBR_RAND: @@ -359,48 +353,69 @@ break; case DIF_SUBR_MUTEX_OWNED: +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD m.mx = dtrace_load64(tupregs[0].dttk_value); if (MUTEX_TYPE_ADAPTIVE(&m.mi)) regs[rd] = MUTEX_OWNER(&m.mi) != MUTEX_NO_OWNER; else regs[rd] = LOCK_HELD(&m.mi.m_spin.m_spinlock); +#endif break; case DIF_SUBR_MUTEX_OWNER: +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD m.mx = dtrace_load64(tupregs[0].dttk_value); if (MUTEX_TYPE_ADAPTIVE(&m.mi) && MUTEX_OWNER(&m.mi) != MUTEX_NO_OWNER) regs[rd] = (uintptr_t)MUTEX_OWNER(&m.mi); else regs[rd] = 0; +#endif break; case DIF_SUBR_MUTEX_TYPE_ADAPTIVE: +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD m.mx = dtrace_load64(tupregs[0].dttk_value); regs[rd] = MUTEX_TYPE_ADAPTIVE(&m.mi); +#endif break; case DIF_SUBR_MUTEX_TYPE_SPIN: +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD m.mx = dtrace_load64(tupregs[0].dttk_value); regs[rd] = MUTEX_TYPE_SPIN(&m.mi); +#endif break; case DIF_SUBR_RW_READ_HELD: { +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD uintptr_t tmp; r.rw = dtrace_loadptr(tupregs[0].dttk_value); regs[rd] = _RW_READ_HELD(&r.ri, tmp); +#endif break; } case DIF_SUBR_RW_WRITE_HELD: +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD r.rw = dtrace_loadptr(tupregs[0].dttk_value); regs[rd] = _RW_WRITE_HELD(&r.ri); +#endif break; case DIF_SUBR_RW_ISWRITER: +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD r.rw = dtrace_loadptr(tupregs[0].dttk_value); regs[rd] = _RW_ISWRITER(&r.ri); +#endif break; case DIF_SUBR_BCOPY: { @@ -437,7 +452,7 @@ if (mstate->dtms_scratch_ptr + scratch_size > mstate->dtms_scratch_base + mstate->dtms_scratch_size) { DTRACE_CPUFLAG_SET(CPU_DTRACE_NOSCRATCH); - regs[rd] = NULL; + regs[rd] = 0; break; } @@ -488,7 +503,7 @@ if (mstate->dtms_scratch_ptr + size > mstate->dtms_scratch_base + mstate->dtms_scratch_size) { DTRACE_CPUFLAG_SET(CPU_DTRACE_NOSCRATCH); - regs[rd] = NULL; + regs[rd] = 0; break; } @@ -504,12 +519,14 @@ case DIF_SUBR_MSGSIZE: case DIF_SUBR_MSGDSIZE: { +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD uintptr_t baddr = tupregs[0].dttk_value, daddr; uintptr_t wptr, rptr; size_t count = 0; int cont = 0; - while (baddr != NULL && !(*flags & CPU_DTRACE_FAULT)) { + while (baddr != 0 && !(*flags & CPU_DTRACE_FAULT)) { wptr = dtrace_loadptr(baddr + offsetof(mblk_t, b_wptr)); @@ -550,10 +567,13 @@ if (!(*flags & CPU_DTRACE_FAULT)) regs[rd] = count; +#endif break; } case DIF_SUBR_PROGENYOF: { +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD pid_t pid = tupregs[0].dttk_value; proc_t *p; int rval = 0; @@ -570,6 +590,7 @@ DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); regs[rd] = rval; +#endif break; } @@ -626,7 +647,7 @@ uintptr_t limit = addr + state->dts_options[DTRACEOPT_STRSIZE]; char c, target = (char)tupregs[1].dttk_value; - for (regs[rd] = NULL; addr < limit; addr++) { + for (regs[rd] = 0; addr < limit; addr++) { if ((c = dtrace_load8(addr)) == target) { regs[rd] = addr; @@ -644,6 +665,8 @@ case DIF_SUBR_STRSTR: case DIF_SUBR_INDEX: case DIF_SUBR_RINDEX: { +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD /* * We're going to iterate over the string looking for the * specified string. We will iterate until we have reached @@ -777,10 +800,13 @@ } } +#endif break; } case DIF_SUBR_STRTOK: { +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD uintptr_t addr = tupregs[0].dttk_value; uintptr_t tokaddr = tupregs[1].dttk_value; uint64_t size = state->dts_options[DTRACEOPT_STRSIZE]; @@ -866,10 +892,13 @@ regs[rd] = (uintptr_t)dest; mstate->dtms_scratch_ptr += size; mstate->dtms_strtok = addr; +#endif break; } case DIF_SUBR_SUBSTR: { +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD uintptr_t s = tupregs[0].dttk_value; uint64_t size = state->dts_options[DTRACEOPT_STRSIZE]; char *d = (char *)mstate->dtms_scratch_ptr; @@ -912,26 +941,35 @@ mstate->dtms_scratch_ptr += size; regs[rd] = (uintptr_t)d; +#endif break; } case DIF_SUBR_GETMAJOR: +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD #ifdef _LP64 regs[rd] = (tupregs[0].dttk_value >> NBITSMINOR64) & MAXMAJ64; #else regs[rd] = (tupregs[0].dttk_value >> NBITSMINOR) & MAXMAJ; #endif +#endif break; case DIF_SUBR_GETMINOR: +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD #ifdef _LP64 regs[rd] = tupregs[0].dttk_value & MAXMIN64; #else regs[rd] = tupregs[0].dttk_value & MAXMIN; #endif +#endif break; case DIF_SUBR_DDI_PATHNAME: { +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD /* * This one is a galactic mess. We are going to roughly * emulate ddi_pathname(), but it's made more complicated @@ -1111,10 +1149,13 @@ mstate->dtms_scratch_ptr += size; } +#endif break; } case DIF_SUBR_STRJOIN: { +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD char *d = (char *)mstate->dtms_scratch_ptr; uint64_t size = state->dts_options[DTRACEOPT_STRSIZE]; uintptr_t s1 = tupregs[0].dttk_value; @@ -1157,10 +1198,13 @@ regs[rd] = (uintptr_t)d; } +#endif break; } case DIF_SUBR_LLTOSTR: { +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD int64_t i = (int64_t)tupregs[0].dttk_value; int64_t val = i < 0 ? i * -1 : i; uint64_t size = 22; /* enough room for 2^64 in decimal */ @@ -1184,11 +1228,14 @@ regs[rd] = (uintptr_t)end + 1; mstate->dtms_scratch_ptr += size; +#endif break; } case DIF_SUBR_DIRNAME: case DIF_SUBR_BASENAME: { +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD char *dest = (char *)mstate->dtms_scratch_ptr; uint64_t size = state->dts_options[DTRACEOPT_STRSIZE]; uintptr_t src = tupregs[0].dttk_value; @@ -1311,10 +1358,13 @@ dest[j] = '\0'; regs[rd] = (uintptr_t)dest; mstate->dtms_scratch_ptr += size; +#endif break; } case DIF_SUBR_CLEANPATH: { +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD char *dest = (char *)mstate->dtms_scratch_ptr, c; uint64_t size = state->dts_options[DTRACEOPT_STRSIZE]; uintptr_t src = tupregs[0].dttk_value; @@ -1415,10 +1465,10 @@ dest[j] = '\0'; regs[rd] = (uintptr_t)dest; mstate->dtms_scratch_ptr += size; +#endif break; } } -#endif } /* @@ -1659,53 +1709,32 @@ regs[rd] = dtrace_load64(regs[r1]); break; case DIF_OP_ULDSB: -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); -#ifdef DOODAD regs[rd] = (int8_t) dtrace_fuword8((void *)(uintptr_t)regs[r1]); -#endif break; case DIF_OP_ULDSH: -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); -#ifdef DOODAD regs[rd] = (int16_t) dtrace_fuword16((void *)(uintptr_t)regs[r1]); -#endif break; case DIF_OP_ULDSW: -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); -#ifdef DOODAD regs[rd] = (int32_t) dtrace_fuword32((void *)(uintptr_t)regs[r1]); -#endif break; case DIF_OP_ULDUB: -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); -#ifdef DOODAD regs[rd] = dtrace_fuword8((void *)(uintptr_t)regs[r1]); -#endif break; case DIF_OP_ULDUH: -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); -#ifdef DOODAD regs[rd] = dtrace_fuword16((void *)(uintptr_t)regs[r1]); -#endif break; case DIF_OP_ULDUW: -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); -#ifdef DOODAD regs[rd] = dtrace_fuword32((void *)(uintptr_t)regs[r1]); -#endif break; case DIF_OP_ULDX: -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); -#ifdef DOODAD regs[rd] = dtrace_fuword64((void *)(uintptr_t)regs[r1]); -#endif break; case DIF_OP_RET: rval = regs[rd]; @@ -1894,6 +1923,7 @@ break; case DIF_OP_LDTS: { +printf("%s(%d):\n",__FUNCTION__,__LINE__); printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); #ifdef DOODAD dtrace_dynvar_t *dvar;