From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12722 invoked by alias); 6 Jul 2009 14:37:18 -0000 Received: (qmail 12702 invoked by uid 22791); 6 Jul 2009 14:37:17 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from one.firstfloor.org (HELO one.firstfloor.org) (213.235.205.2) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 06 Jul 2009 14:34:58 +0000 Received: from basil.firstfloor.org (p5B3CB8C9.dip0.t-ipconnect.de [91.60.184.201]) by one.firstfloor.org (Postfix) with ESMTP id C33A11A98002; Mon, 6 Jul 2009 16:34:53 +0200 (CEST) Received: by basil.firstfloor.org (Postfix, from userid 1000) id 40CCA1D024A; Mon, 6 Jul 2009 16:34:53 +0200 (CEST) To: Masami Hiramatsu Cc: Ingo Molnar , Steven Rostedt , lkml, systemtap, kvm, DLE, Christoph Hellwig , Ananth N Mavinakayanahalli , Frederic Weisbecker , Roland McGrath , Srikar Dronamraju , linux-arch@vger.kernel.org Subject: Re: [PATCH -tip -v10 5/7] x86: add pt_regs register and stack access APIs From: Andi Kleen References: <20090701010838.32547.62843.stgit@localhost.localdomain> <20090701010911.32547.1313.stgit@localhost.localdomain> Date: Mon, 06 Jul 2009 14:37:00 -0000 In-Reply-To: <20090701010911.32547.1313.stgit@localhost.localdomain> (Masami Hiramatsu's message of "Tue, 30 Jun 2009 21:09:11 -0400") Message-ID: <871votop6a.fsf@basil.nowhere.org> User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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-q3/txt/msg00025.txt.bz2 Masami Hiramatsu writes: > Add following APIs for accessing registers and stack entries from pt_regs. You forgot to state who calls these functions/why are they added? Who only has strings for registers? I can see the point of having a function for nth argument though, that's useful. > +static inline unsigned long regs_get_argument_nth(struct pt_regs *regs, > + unsigned n) > +{ > + if (n < NR_REGPARMS) { > + switch (n) { > + case 0: > + return regs->ax; > + case 1: > + return regs->dx; > + case 2: > + return regs->cx; [....] That could be done shorter with a offsetof table. > + if (n < NR_REGPARMS) { > + switch (n) { > + case 0: > + return regs->di; > + case 1: > + return regs->si; > + case 2: > + return regs->dx; > + case 3: > + return regs->cx; > + case 4: > + return regs->r8; > + case 5: > + return regs->r9; and that too. -Andi -- ak@linux.intel.com -- Speaking for myself only.