From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26188 invoked by alias); 27 Oct 2009 02:49:51 -0000 Received: (qmail 26181 invoked by uid 22791); 27 Oct 2009 02:49:51 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,UNPARSEABLE_RELAY X-Spam-Check-By: sourceware.org Received: from rcsinet12.oracle.com (HELO rgminet12.oracle.com) (148.87.113.124) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 27 Oct 2009 02:49:46 +0000 Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rgminet12.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n9R2msuU002941 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 27 Oct 2009 02:48:55 GMT Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by acsinet15.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n9R2oYVE004873; Tue, 27 Oct 2009 02:50:35 GMT Received: from abhmt006.oracle.com by acsmt354.oracle.com with ESMTP id 20634228951256611756; Mon, 26 Oct 2009 19:49:16 -0700 Received: from dhcp-beijing-cdc-10-182-120-164.cn.oracle.com (/10.182.121.213) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Oct 2009 19:49:15 -0700 Message-ID: <4AE65F54.70800@oracle.com> Date: Tue, 27 Oct 2009 02:49:00 -0000 From: Wenji Huang User-Agent: Thunderbird 2.0.0.12 (X11/20080213) MIME-Version: 1.0 To: Mahesh J Salgaonkar CC: systemtap@sources.redhat.com, Masami Hiramatsu Subject: [PATCH -tip tracing/kprobes] Powerpc port of the kprobe-based event tracer. References: <20091020121505.724222003@mars.in.ibm.com> In-Reply-To: <20091020121505.724222003@mars.in.ibm.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2009-q4/txt/msg00298.txt.bz2 Hi, > +#define kernel_stack_pointer(regs) ((regs)->gpr[1]) > + > +/** > + * regs_get_register() - get register value from its offset > + * @regs: pt_regs from which register value is gotten > + * @offset: offset number of the register. > + * > + * regs_get_register returns the value of a register whose offset from @regs > + * is @offset. The @offset is the offset of the register in struct pt_regs. "is @offset." seems be redundant. > + * If @offset is bigger than MAX_REG_OFFSET, this returns 0. > + */ > +static inline unsigned long regs_get_register(struct pt_regs *regs, [...] > + * regs_within_kernel_stack() - check the address in the stack > + * @regs: pt_regs which contains kernel stack pointer. > + * @addr: address which is checked. > + * > + * regs_within_kenel_stack() checks @addr is within the kernel stack page(s). > + * If @addr is within the kernel stack, it returns true. If not, returns false. s/regs_within_kenel_stack/regs_within_kernel_stack/ The return type function is declared as int. > + */ > + > +static inline int regs_within_kernel_stack(struct pt_regs *regs, > + unsigned long addr) > +{ > + return ((addr & ~(THREAD_SIZE - 1)) == > + (kernel_stack_pointer(regs) & ~(THREAD_SIZE - 1))); > +} > + > +/** > + * regs_get_kernel_stack_nth() - get Nth entry of the stack > + * @regs: pt_regs which contains kernel stack pointer. > + * @n: stack entry number. > + * > + * regs_get_kernel_stack_nth() returns @n th entry of the kernel stack which > + * is specifined by @regs. If the @n th entry is NOT in the kernel stack, > + * this returns 0. s/specifined/specified/ > + */ > +static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, > + unsigned int n) > +{ > + unsigned long *addr = (unsigned long *)kernel_stack_pointer(regs); > + addr += n; > + if (regs_within_kernel_stack(regs, (unsigned long)addr)) > + return *addr; > + else > + return 0; > +} > + > + > +/* Get Nth argument at function call */ > +extern unsigned long regs_get_argument_nth(struct pt_regs *regs, > + unsigned int n); > + Maybe to put extern declaration at the very beginning is better. > /* > * These are defined as per linux/ptrace.h, which see. > */ [...] Regards, Wenji