init.c 970 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * S390 Version
  4. * Copyright IBM Corp. 2002, 2011
  5. * Author(s): Thomas Spatzier (tspat@de.ibm.com)
  6. * Author(s): Mahesh Salgaonkar (mahesh@linux.vnet.ibm.com)
  7. * Author(s): Heinz Graalfs (graalfs@linux.vnet.ibm.com)
  8. * Author(s): Andreas Krebbel (krebbel@linux.vnet.ibm.com)
  9. *
  10. * @remark Copyright 2002-2011 OProfile authors
  11. */
  12. #include <linux/oprofile.h>
  13. #include <linux/init.h>
  14. #include <asm/processor.h>
  15. static int __s390_backtrace(void *data, unsigned long address, int reliable)
  16. {
  17. unsigned int *depth = data;
  18. if (*depth == 0)
  19. return 1;
  20. (*depth)--;
  21. oprofile_add_trace(address);
  22. return 0;
  23. }
  24. static void s390_backtrace(struct pt_regs *regs, unsigned int depth)
  25. {
  26. if (user_mode(regs))
  27. return;
  28. dump_trace(__s390_backtrace, &depth, NULL, regs->gprs[15]);
  29. }
  30. int __init oprofile_arch_init(struct oprofile_operations *ops)
  31. {
  32. ops->backtrace = s390_backtrace;
  33. return 0;
  34. }
  35. void oprofile_arch_exit(void)
  36. {
  37. }