mcount.S 775 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * arch/xtensa/kernel/mcount.S
  3. *
  4. * Xtensa specific mcount support
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file "COPYING" in the main directory of this archive
  8. * for more details.
  9. *
  10. * Copyright (C) 2013 Tensilica Inc.
  11. */
  12. #include <linux/linkage.h>
  13. #include <asm/ftrace.h>
  14. /*
  15. * Entry condition:
  16. *
  17. * a2: a0 of the caller
  18. */
  19. ENTRY(_mcount)
  20. entry a1, 16
  21. movi a4, ftrace_trace_function
  22. l32i a4, a4, 0
  23. movi a3, ftrace_stub
  24. bne a3, a4, 1f
  25. retw
  26. 1: xor a7, a2, a1
  27. movi a3, 0x3fffffff
  28. and a7, a7, a3
  29. xor a7, a7, a1
  30. xor a6, a0, a1
  31. and a6, a6, a3
  32. xor a6, a6, a1
  33. addi a6, a6, -MCOUNT_INSN_SIZE
  34. callx4 a4
  35. retw
  36. ENDPROC(_mcount)
  37. ENTRY(ftrace_stub)
  38. entry a1, 16
  39. retw
  40. ENDPROC(ftrace_stub)