1 /* 2 * arch/xtensa/kernel/mcount.S 3 * 4 * Xtensa specific mcount support 5 * 6 * This file is subject to the terms and condi 7 * License. See the file "COPYING" in the mai 8 * for more details. 9 * 10 * Copyright (C) 2013 Tensilica Inc. 11 */ 12 13 #include <linux/linkage.h> 14 #include <asm/asmmacro.h> 15 #include <asm/ftrace.h> 16 17 /* 18 * Entry condition: 19 * 20 * a2: a0 of the caller in windowed A 21 * a10: a0 of the caller in call0 ABI 22 * 23 * In call0 ABI the function _mcount is called 24 * its argument is in a10 and all the usual ar 25 * must be preserved in addition to callee-sav 26 */ 27 28 ENTRY(_mcount) 29 #if defined(__XTENSA_WINDOWED_ABI__) 30 abi_entry_default 31 32 movi a4, ftrace_trace_function 33 l32i a4, a4, 0 34 movi a3, ftrace_stub 35 bne a3, a4, 1f 36 abi_ret_default 37 38 1: xor a7, a2, a1 39 movi a3, 0x3fffffff 40 and a7, a7, a3 41 xor a7, a7, a1 42 43 xor a6, a0, a1 44 and a6, a6, a3 45 xor a6, a6, a1 46 addi a6, a6, -MCOUNT_INSN_SIZE 47 callx4 a4 48 49 abi_ret_default 50 #elif defined(__XTENSA_CALL0_ABI__) 51 abi_entry_default 52 53 movi a9, ftrace_trace_function 54 l32i a9, a9, 0 55 movi a11, ftrace_stub 56 bne a9, a11, 1f 57 abi_ret_default 58 59 1: abi_entry(28) 60 s32i a0, sp, 0 61 s32i a2, sp, 4 62 s32i a3, sp, 8 63 s32i a4, sp, 12 64 s32i a5, sp, 16 65 s32i a6, sp, 20 66 s32i a7, sp, 24 67 addi a2, a10, -MCOUNT_INSN_SIZE 68 callx0 a9 69 l32i a0, sp, 0 70 l32i a2, sp, 4 71 l32i a3, sp, 8 72 l32i a4, sp, 12 73 l32i a5, sp, 16 74 l32i a6, sp, 20 75 l32i a7, sp, 24 76 abi_ret(28) 77 #else 78 #error Unsupported Xtensa ABI 79 #endif 80 ENDPROC(_mcount) 81 EXPORT_SYMBOL(_mcount) 82 83 ENTRY(ftrace_stub) 84 abi_entry_default 85 abi_ret_default 86 ENDPROC(ftrace_stub)
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.