summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/include/dwarf-regs.h
diff options
context:
space:
mode:
authorWang Nan <wangnan0@huawei.com>2015-09-14 23:02:49 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-09-15 09:48:33 -0300
commit63ab024a5b6f295ca17a293ad81b7c728f49a89a (patch)
tree04460e9beb6d2a6bcbe7c576988661d42846129e /tools/perf/util/include/dwarf-regs.h
parent196581717d85f59365dc9303685cd5b1cdf106a3 (diff)
downloadblackbird-op-linux-63ab024a5b6f295ca17a293ad81b7c728f49a89a.tar.gz
blackbird-op-linux-63ab024a5b6f295ca17a293ad81b7c728f49a89a.zip
perf tools: regs_query_register_offset() infrastructure
regs_query_register_offset() is a helper function which converts register name like "%rax" to offset of a register in 'struct pt_regs', which is required by BPF prologue generator. PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET indicates an architecture supports converting name of a register to its offset in 'struct pt_regs'. HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET is introduced as the corresponding CFLAGS of PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET. Signed-off-by: Wang Nan <wangnan0@huawei.com> Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Alexei Starovoitov <ast@plumgrid.com> Cc: Brendan Gregg <brendan.d.gregg@gmail.com> Cc: Daniel Borkmann <daniel@iogearbox.net> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kaixu Xia <xiakaixu@huawei.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Zefan Li <lizefan@huawei.com> Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1441523623-152703-19-git-send-email-wangnan0@huawei.com Signed-off-by: He Kuang <hekuang@huawei.com> [ Extracted from eBPF patches ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/include/dwarf-regs.h')
-rw-r--r--tools/perf/util/include/dwarf-regs.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h
index 8f149655f497..07c644ed64c4 100644
--- a/tools/perf/util/include/dwarf-regs.h
+++ b/tools/perf/util/include/dwarf-regs.h
@@ -5,4 +5,12 @@
const char *get_arch_regstr(unsigned int n);
#endif
+#ifdef HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
+/*
+ * Arch should support fetching the offset of a register in pt_regs
+ * by its name. See kernel's regs_query_register_offset in
+ * arch/xxx/kernel/ptrace.c.
+ */
+int regs_query_register_offset(const char *name);
+#endif
#endif
OpenPOWER on IntegriCloud