mcount64.S 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Copyright IBM Corp. 2008,2009
  3. *
  4. * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>,
  5. *
  6. */
  7. #include <asm/asm-offsets.h>
  8. .section .kprobes.text, "ax"
  9. .globl ftrace_stub
  10. ftrace_stub:
  11. br %r14
  12. .globl _mcount
  13. _mcount:
  14. #ifdef CONFIG_DYNAMIC_FTRACE
  15. br %r14
  16. .globl ftrace_caller
  17. ftrace_caller:
  18. #endif
  19. larl %r1,function_trace_stop
  20. icm %r1,0xf,0(%r1)
  21. bnzr %r14
  22. stmg %r2,%r5,32(%r15)
  23. stg %r14,112(%r15)
  24. lgr %r1,%r15
  25. aghi %r15,-160
  26. stg %r1,__SF_BACKCHAIN(%r15)
  27. lgr %r2,%r14
  28. lg %r3,168(%r15)
  29. larl %r14,ftrace_trace_function
  30. lg %r14,0(%r14)
  31. basr %r14,%r14
  32. #ifdef CONFIG_FUNCTION_GRAPH_TRACER
  33. lg %r2,168(%r15)
  34. lg %r3,272(%r15)
  35. .globl ftrace_graph_caller
  36. ftrace_graph_caller:
  37. # The bras instruction gets runtime patched to call prepare_ftrace_return.
  38. # See ftrace_enable_ftrace_graph_caller. The patched instruction is:
  39. # bras %r14,prepare_ftrace_return
  40. bras %r14,0f
  41. 0: stg %r2,168(%r15)
  42. #endif
  43. aghi %r15,160
  44. lmg %r2,%r5,32(%r15)
  45. lg %r14,112(%r15)
  46. br %r14
  47. #ifdef CONFIG_FUNCTION_GRAPH_TRACER
  48. .globl return_to_handler
  49. return_to_handler:
  50. stmg %r2,%r5,32(%r15)
  51. lgr %r1,%r15
  52. aghi %r15,-160
  53. stg %r1,__SF_BACKCHAIN(%r15)
  54. brasl %r14,ftrace_return_to_handler
  55. aghi %r15,160
  56. lgr %r14,%r2
  57. lmg %r2,%r5,32(%r15)
  58. br %r14
  59. #endif