ftrace_64.S 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. _GLOBAL(mcount)
  16. _GLOBAL(_mcount)
  17. EXPORT_SYMBOL(_mcount)
  18. mflr r12
  19. mtctr r12
  20. mtlr r0
  21. bctr
  22. #ifdef CONFIG_FUNCTION_GRAPH_TRACER
  23. _GLOBAL(return_to_handler)
  24. /* need to save return values */
  25. std r4, -32(r1)
  26. std r3, -24(r1)
  27. /* save TOC */
  28. std r2, -16(r1)
  29. std r31, -8(r1)
  30. mr r31, r1
  31. stdu r1, -112(r1)
  32. /*
  33. * We might be called from a module.
  34. * Switch to our TOC to run inside the core kernel.
  35. */
  36. ld r2, PACATOC(r13)
  37. bl ftrace_return_to_handler
  38. nop
  39. /* return value has real return address */
  40. mtlr r3
  41. ld r1, 0(r1)
  42. ld r4, -32(r1)
  43. ld r3, -24(r1)
  44. ld r2, -16(r1)
  45. ld r31, -8(r1)
  46. /* Jump back to real return address */
  47. blr
  48. #endif /* CONFIG_FUNCTION_GRAPH_TRACER */