init.c 934 B

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