From owner-p4-projects@FreeBSD.ORG Thu Feb 14 20:52:52 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7B86A16A419; Thu, 14 Feb 2008 20:52:52 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3FFD216A417 for ; Thu, 14 Feb 2008 20:52:52 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 44E3D13C46A for ; Thu, 14 Feb 2008 20:52:52 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m1EKqqT5032674 for ; Thu, 14 Feb 2008 20:52:52 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m1EKqq60032671 for perforce@freebsd.org; Thu, 14 Feb 2008 20:52:52 GMT (envelope-from jb@freebsd.org) Date: Thu, 14 Feb 2008 20:52:52 GMT Message-Id: <200802142052.m1EKqq60032671@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 135404 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, 14 Feb 2008 20:52:52 -0000 http://perforce.freebsd.org/chv.cgi?CH=135404 Change 135404 by jb@jb_freebsd1 on 2008/02/14 20:52:23 WIP to implement the printt() action. Affected files ... .. //depot/projects/dtrace/src/sys/contrib/opensolaris/uts/common/dtrace/dtrace.c#39 edit Differences ... ==== //depot/projects/dtrace/src/sys/contrib/opensolaris/uts/common/dtrace/dtrace.c#39 (text) ==== @@ -4513,7 +4513,7 @@ uintptr_t *typeref = (uintptr_t *) P2ROUNDUP(mstate->dtms_scratch_ptr, sizeof(uintptr_t)); size_t scratch_size = ((uintptr_t) typeref - mstate->dtms_scratch_ptr) + size; - /* type, length and address */ + /* address, length, type */ typeref[0] = tupregs[0].dttk_value; typeref[1] = tupregs[1].dttk_value; typeref[2] = tupregs[2].dttk_value; @@ -6064,6 +6064,43 @@ break; } + case DTRACEACT_PRINTT: { + /* The DIF returns a 'typeref'. */ + uintptr_t *typeref = (uintptr_t *)(uintptr_t) val; + + /* Get the size from the typeref. */ + size = typeref[1]; + + /* + * Check if the size exceeds the allocated + * buffer size. + */ + if (size + sizeof(uintptr_t) > dp->dtdo_rtype.dtdt_size) { + /* Flag a drop! */ + *flags |= CPU_DTRACE_DROP; + continue; + } + + /* Store the size in the buffer first. */ + DTRACE_STORE(uintptr_t, tomax, + valoffs, size); + + /* + * Offset the buffer address to the start + * of the data. + */ + valoffs += sizeof(uintptr_t); + + /* + * Reset to the memory address rather than + * the typeref array, then let the BYREF + * code below do the work to store the + * memory data in the buffer. + */ + val = typeref[0]; + break; + } + case DTRACEACT_CHILL: if (dtrace_priv_kernel_destructive(state)) dtrace_action_chill(&mstate, val); @@ -9860,6 +9897,10 @@ size = dp->dtdo_rtype.dtdt_size; break; + case DTRACEACT_PRINTT: + size = dp->dtdo_rtype.dtdt_size; + break; + case DTRACEACT_COMMIT: { dtrace_action_t *act = ecb->dte_action;