Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752662AbbEHICk (ORCPT ); Fri, 8 May 2015 04:02:40 -0400 Received: from mail4.hitachi.co.jp ([133.145.228.5]:38193 "EHLO mail4.hitachi.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752357AbbEHICd (ORCPT ); Fri, 8 May 2015 04:02:33 -0400 Message-ID: <554C6D91.9020009@hitachi.com> Date: Fri, 08 May 2015 17:02:25 +0900 From: Masami Hiramatsu Organization: Hitachi, Ltd., Japan User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: He Kuang , ast@plumgrid.com, davem@davemloft.net, acme@kernel.org, mingo@redhat.com, a.p.zijlstra@chello.nl, jolsa@kernel.org CC: wangnan0@huawei.com, lizefan@kernel.org, linux-kernel@vger.kernel.org, pi3orama@163.com Subject: Re: [RFC PATCH 2/6] perf bpf: Add pt_regs convert table for x86 References: <1430820612-84443-1-git-send-email-hekuang@huawei.com> <1430820612-84443-3-git-send-email-hekuang@huawei.com> In-Reply-To: <1430820612-84443-3-git-send-email-hekuang@huawei.com> Content-Type: text/plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2318 Lines: 85 On 2015/05/05 19:10, He Kuang wrote: > Convert register number in debuginfo to its index in pt_regs. > This seems better introduced after 3/6, since 3/6 is generic framework. Without 3/6, this can't do anything. > Signed-off-by: He Kuang > --- > tools/perf/arch/x86/util/dwarf-regs.c | 31 +++++++++++++++++++++++++++++++ > 1 file changed, 31 insertions(+) > > diff --git a/tools/perf/arch/x86/util/dwarf-regs.c b/tools/perf/arch/x86/util/dwarf-regs.c > index be22dd4..e586a47 100644 > --- a/tools/perf/arch/x86/util/dwarf-regs.c > +++ b/tools/perf/arch/x86/util/dwarf-regs.c > @@ -59,10 +59,31 @@ const char *x86_64_regs_table[X86_64_MAX_REGS] = { > "%r15", > }; > > +const char x86_64_pt_regs_table[X86_64_MAX_REGS] = { > + 10, > + 12, > + 11, > + 5, > + 13, > + 14, > + 4, > + 19, > + 9, > + 8, > + 7, > + 6, > + 3, > + 2, > + 1, > + 0, > +}; > + > /* TODO: switching by dwarf address size */ > #ifdef __x86_64__ > #define ARCH_MAX_REGS X86_64_MAX_REGS > #define arch_regs_table x86_64_regs_table > +#define arch_pt_regs_table x86_64_pt_regs_table > +#define arch_pt_regs_type unsigned long If you need to use this as a type, please use typedef in arch header. > #else > #define ARCH_MAX_REGS X86_32_MAX_REGS > #define arch_regs_table x86_32_regs_table > @@ -73,3 +94,13 @@ const char *get_arch_regstr(unsigned int n) > { > return (n <= ARCH_MAX_REGS) ? arch_regs_table[n] : NULL; > } > + > +char get_arch_pt_regs(unsigned int n) Returning char is meaningless. Also this seems returning an index or offset of pt_regs. If so, get_arch_regoffs() will be better name. > +{ > + return (n <= ARCH_MAX_REGS) ? arch_pt_regs_table[n] : -1; > +} > + > +int get_arch_pt_regs_size(void) > +{ > + return sizeof(arch_pt_regs_type); > +} No, don't do that, since this always returns same value. Thank you, -- Masami HIRAMATSU Linux Technology Research Center, System Productivity Research Dept. Center for Technology Innovation - Systems Engineering Hitachi, Ltd., Research & Development Group E-mail: masami.hiramatsu.pt@hitachi.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/