ftrace_64.S 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Split from entry_64.S
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version
  7. * 2 of the License, or (at your option) any later version.
  8. */
  9. #include <linux/magic.h>
  10. #include <asm/ppc_asm.h>
  11. #include <asm/asm-offsets.h>
  12. #include <asm/ftrace.h>
  13. #include <asm/ppc-opcode.h>
  14. #include <asm/export.h>
  15. .pushsection ".tramp.ftrace.text","aw",@progbits;
  16. .globl ftrace_tramp_text
  17. ftrace_tramp_text:
  18. .space 64
  19. .popsection
  20. .pushsection ".tramp.ftrace.init","aw",@progbits;
  21. .globl ftrace_tramp_init
  22. ftrace_tramp_init:
  23. .space 64
  24. .popsection
  25. _GLOBAL(mcount)
  26. _GLOBAL(_mcount)
  27. EXPORT_SYMBOL(_mcount)
  28. mflr r12
  29. mtctr r12
  30. mtlr r0
  31. bctr
  32. #ifdef CONFIG_FUNCTION_GRAPH_TRACER
  33. _GLOBAL(return_to_handler)
  34. /* need to save return values */
  35. std r4, -32(r1)
  36. std r3, -24(r1)
  37. /* save TOC */
  38. std r2, -16(r1)
  39. std r31, -8(r1)
  40. mr r31, r1
  41. stdu r1, -112(r1)
  42. /*
  43. * We might be called from a module.
  44. * Switch to our TOC to run inside the core kernel.
  45. */
  46. ld r2, PACATOC(r13)
  47. bl ftrace_return_to_handler
  48. nop
  49. /* return value has real return address */
  50. mtlr r3
  51. ld r1, 0(r1)
  52. ld r4, -32(r1)
  53. ld r3, -24(r1)
  54. ld r2, -16(r1)
  55. ld r31, -8(r1)
  56. /* Jump back to real return address */
  57. blr
  58. #endif /* CONFIG_FUNCTION_GRAPH_TRACER */