Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757492AbbEEKLI (ORCPT ); Tue, 5 May 2015 06:11:08 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:14056 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757458AbbEEKKu (ORCPT ); Tue, 5 May 2015 06:10:50 -0400 From: He Kuang To: , , , , , , CC: , , , Subject: [RFC PATCH 2/6] perf bpf: Add pt_regs convert table for x86 Date: Tue, 5 May 2015 10:10:08 +0000 Message-ID: <1430820612-84443-3-git-send-email-hekuang@huawei.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1430820612-84443-1-git-send-email-hekuang@huawei.com> References: <1430820612-84443-1-git-send-email-hekuang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.107.197.210] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1560 Lines: 65 Convert register number in debuginfo to its index in pt_regs. 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 #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) +{ + return (n <= ARCH_MAX_REGS) ? arch_pt_regs_table[n] : -1; +} + +int get_arch_pt_regs_size(void) +{ + return sizeof(arch_pt_regs_type); +} -- 1.8.5.2 -- 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/