perf_callchain.c 764 B

1234567891011121314151617181920212223242526272829303132
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Performance event callchain support - SuperH architecture code
  4. *
  5. * Copyright (C) 2009 Paul Mundt
  6. */
  7. #include <linux/kernel.h>
  8. #include <linux/sched.h>
  9. #include <linux/perf_event.h>
  10. #include <linux/percpu.h>
  11. #include <asm/unwinder.h>
  12. #include <asm/ptrace.h>
  13. static void callchain_address(void *data, unsigned long addr, int reliable)
  14. {
  15. struct perf_callchain_entry_ctx *entry = data;
  16. if (reliable)
  17. perf_callchain_store(entry, addr);
  18. }
  19. static const struct stacktrace_ops callchain_ops = {
  20. .address = callchain_address,
  21. };
  22. void
  23. perf_callchain_kernel(struct perf_callchain_entry_ctx *entry, struct pt_regs *regs)
  24. {
  25. perf_callchain_store(entry, regs->pc);
  26. unwind_stack(NULL, regs, NULL, &callchain_ops, entry);
  27. }