mcount.S 844 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/asmmacro.h>
  14. #include <asm/ftrace.h>
  15. /*
  16. * Entry condition:
  17. *
  18. * a2: a0 of the caller
  19. */
  20. ENTRY(_mcount)
  21. abi_entry_default
  22. movi a4, ftrace_trace_function
  23. l32i a4, a4, 0
  24. movi a3, ftrace_stub
  25. bne a3, a4, 1f
  26. abi_ret_default
  27. 1: xor a7, a2, a1
  28. movi a3, 0x3fffffff
  29. and a7, a7, a3
  30. xor a7, a7, a1
  31. xor a6, a0, a1
  32. and a6, a6, a3
  33. xor a6, a6, a1
  34. addi a6, a6, -MCOUNT_INSN_SIZE
  35. callx4 a4
  36. abi_ret_default
  37. ENDPROC(_mcount)
  38. ENTRY(ftrace_stub)
  39. abi_entry_default
  40. abi_ret_default
  41. ENDPROC(ftrace_stub)