From owner-p4-projects@FreeBSD.ORG Fri Jul 7 18:53:56 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 29A6816A4E5; Fri, 7 Jul 2006 18:53:56 +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 05DD716A4E1 for ; Fri, 7 Jul 2006 18:53:56 +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 A507143D45 for ; Fri, 7 Jul 2006 18:53:55 +0000 (GMT) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k67IrtPs060506 for ; Fri, 7 Jul 2006 18:53:55 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k67IrtPt060503 for perforce@freebsd.org; Fri, 7 Jul 2006 18:53:55 GMT (envelope-from jb@freebsd.org) Date: Fri, 7 Jul 2006 18:53:55 GMT Message-Id: <200607071853.k67IrtPt060503@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 100918 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: Fri, 07 Jul 2006 18:53:56 -0000 http://perforce.freebsd.org/chv.cgi?CH=100918 Change 100918 by jb@jb_freebsd2 on 2006/07/07 18:53:37 Add system call trace support for the 'systrace' DTrace provider on sun4v. Affected files ... .. //depot/projects/dtrace/src/sys/sun4v/sun4v/trap.c#3 edit Differences ... ==== //depot/projects/dtrace/src/sys/sun4v/sun4v/trap.c#3 (text+ko) ==== @@ -42,6 +42,7 @@ #include "opt_ddb.h" #include "opt_ktr.h" +#include "opt_kdtrace.h" #include "opt_ktrace.h" #include @@ -92,6 +93,22 @@ #include #include +#ifdef KDTRACE +#include +#include + +/* + * These are hooks which are initialised by the dtrace module + * when it is loaded. This keeps the DTrace implementation + * opaque. + * + * This is a hook which is initialised by the systrace module + * when it is loaded. This keeps the DTrace syscall provider + * implementation opaque. + */ +systrace_probe_func_t systrace_probe_func; +#endif + void trap(struct trapframe *tf, int64_t type, uint64_t data); void syscall(struct trapframe *tf); @@ -624,8 +641,33 @@ PTRACESTOP_SC(p, td, S_PT_SCE); +#ifdef KDTRACE + /* + * If the systrace module has registered it's probe + * callback and if there is a probe active for the + * syscall 'entry', process the probe. + */ + if (systrace_probe_func != NULL && callp->sy_entry != 0) + (*systrace_probe_func)(callp->sy_entry, code, callp, + args); +#endif + error = (*callp->sy_call)(td, argp); +#ifdef KDTRACE + /* Save the error return variable for DTrace to reference. */ + td->td_errno = error; + + /* + * If the systrace module has registered it's probe + * callback and if there is a probe active for the + * syscall 'return', process the probe. + */ + if (systrace_probe_func != NULL && callp->sy_return != 0) + (*systrace_probe_func)(callp->sy_return, code, callp, + args); +#endif + CTR5(KTR_SYSC, "syscall: p=%p error=%d %s return %#lx %#lx ", p, error, syscallnames[code], td->td_retval[0], td->td_retval[1]);