From owner-p4-projects@FreeBSD.ORG Thu Apr 27 00:23:05 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 93BAD16A403; Thu, 27 Apr 2006 00:23:05 +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 720C116A401 for ; Thu, 27 Apr 2006 00:23:05 +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 342DC43D45 for ; Thu, 27 Apr 2006 00:23:05 +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 k3R0N5GL053593 for ; Thu, 27 Apr 2006 00:23:05 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k3R0N44j053587 for perforce@freebsd.org; Thu, 27 Apr 2006 00:23:04 GMT (envelope-from jb@freebsd.org) Date: Thu, 27 Apr 2006 00:23:04 GMT Message-Id: <200604270023.k3R0N44j053587@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 96177 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: Thu, 27 Apr 2006 00:23:05 -0000 http://perforce.freebsd.org/chv.cgi?CH=96177 Change 96177 by jb@jb_freebsd2 on 2006/04/27 00:22:31 Process for code in the quest for the holy grail. Lots of stuff still commented out here, but we're moving in the right direction. Example: file hello.d BEGIN { trace("Hello world!\n"); exit(0); } >dtrace -s hello.d CPU ID FUNCTION:NAME 0 1 :BEGIN Hello world! Another significant emotional event. Affected files ... .. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_dif.c#3 edit Differences ... ==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_dif.c#3 (text+ko) ==== @@ -1430,8 +1430,6 @@ dtrace_dif_emulate(dtrace_difo_t *difo, dtrace_mstate_t *mstate, dtrace_vstate_t *vstate, dtrace_state_t *state) { -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); -#ifdef DOODAD const dif_instr_t *text = difo->dtdo_buf; const uint_t textlen = difo->dtdo_len; const char *strtab = difo->dtdo_strtab; @@ -1439,7 +1437,9 @@ uint64_t rval = 0; dtrace_statvar_t *svar; +#ifdef DOODAD dtrace_dstate_t *dstate = &vstate->dtvs_dynvars; +#endif dtrace_difv_t *v; volatile uint16_t *flags = &cpu_core[CPU->cpu_id].cpuc_dtrace_flags; volatile uintptr_t *illval = &cpu_core[CPU->cpu_id].cpuc_dtrace_illval; @@ -1450,7 +1450,7 @@ uint8_t cc_n = 0, cc_z = 0, cc_v = 0, cc_c = 0; int64_t cc_r; - uint_t pc = 0, id, opc; + uint_t pc = 0, id, opc = 0; uint8_t ttop = 0; dif_instr_t instr; uint_t r1, r2, rd; @@ -1659,32 +1659,53 @@ 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]; @@ -1735,7 +1756,7 @@ * then this is to be treated as a * reference to a NULL variable. */ - regs[rd] = NULL; + regs[rd] = 0; } else { regs[rd] = a + sizeof (uint64_t); } @@ -1759,10 +1780,10 @@ if (v->dtdv_type.dtdt_flags & DIF_TF_BYREF) { uintptr_t a = (uintptr_t)svar->dtsv_data; - ASSERT(a != NULL); + ASSERT(a != 0); ASSERT(svar->dtsv_size != 0); - if (regs[rd] == NULL) { + if (regs[rd] == 0) { *(uint8_t *)a = UINT8_MAX; break; } else { @@ -1821,7 +1842,7 @@ * then this is to be treated as a * reference to a NULL variable. */ - regs[rd] = NULL; + regs[rd] = 0; } else { regs[rd] = a + sizeof (uint64_t); } @@ -1854,7 +1875,7 @@ ASSERT(svar->dtsv_size == NCPU * sz); a += CPU->cpu_id * sz; - if (regs[rd] == NULL) { + if (regs[rd] == 0) { *(uint8_t *)a = UINT8_MAX; break; } else { @@ -1873,6 +1894,8 @@ break; case DIF_OP_LDTS: { +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD dtrace_dynvar_t *dvar; dtrace_key_t *key; @@ -1900,11 +1923,14 @@ } else { regs[rd] = *((uint64_t *)dvar->dtdv_data); } +#endif break; } case DIF_OP_STTS: { +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD dtrace_dynvar_t *dvar; dtrace_key_t *key; @@ -1940,6 +1966,7 @@ } else { *((uint64_t *)dvar->dtdv_data) = regs[rd]; } +#endif break; } @@ -2000,6 +2027,8 @@ case DIF_OP_LDGAA: case DIF_OP_LDTAA: { +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD dtrace_dynvar_t *dvar; dtrace_key_t *key = tupregs; uint_t nkeys = ttop; @@ -2035,11 +2064,14 @@ regs[rd] = *((uint64_t *)dvar->dtdv_data); } +#endif break; } case DIF_OP_STGAA: case DIF_OP_STTAA: { +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD dtrace_dynvar_t *dvar; dtrace_key_t *key = tupregs; uint_t nkeys = ttop; @@ -2074,6 +2106,7 @@ } else { *((uint64_t *)dvar->dtdv_data) = regs[rd]; } +#endif break; } @@ -2086,7 +2119,7 @@ mstate->dtms_scratch_base + mstate->dtms_scratch_size) { DTRACE_CPUFLAG_SET(CPU_DTRACE_NOSCRATCH); - regs[rd] = NULL; + regs[rd] = 0; } else { dtrace_bzero((void *) mstate->dtms_scratch_ptr, size); @@ -2166,7 +2199,6 @@ mstate->dtms_fltoffs = opc * sizeof (dif_instr_t); mstate->dtms_present |= DTRACE_MSTATE_FLTOFFS; -#endif return (0); }