/*1* arch/xtensa/kernel/mcount.S2*3* Xtensa specific mcount support4*5* This file is subject to the terms and conditions of the GNU General Public6* License. See the file "COPYING" in the main directory of this archive7* for more details.8*9* Copyright (C) 2013 Tensilica Inc.10*/1112#include <linux/linkage.h>13#include <asm/asmmacro.h>14#include <asm/ftrace.h>1516/*17* Entry condition:18*19* a2: a0 of the caller in windowed ABI20* a10: a0 of the caller in call0 ABI21*22* In call0 ABI the function _mcount is called with the special ABI:23* its argument is in a10 and all the usual argument registers (a2 - a7)24* must be preserved in addition to callee-saved a12 - a15.25*/2627ENTRY(_mcount)28#if defined(__XTENSA_WINDOWED_ABI__)29abi_entry_default3031movi a4, ftrace_trace_function32l32i a4, a4, 033movi a3, ftrace_stub34bne a3, a4, 1f35abi_ret_default36371: xor a7, a2, a138movi a3, 0x3fffffff39and a7, a7, a340xor a7, a7, a14142xor a6, a0, a143and a6, a6, a344xor a6, a6, a145addi a6, a6, -MCOUNT_INSN_SIZE46callx4 a44748abi_ret_default49#elif defined(__XTENSA_CALL0_ABI__)50abi_entry_default5152movi a9, ftrace_trace_function53l32i a9, a9, 054movi a11, ftrace_stub55bne a9, a11, 1f56abi_ret_default57581: abi_entry(28)59s32i a0, sp, 060s32i a2, sp, 461s32i a3, sp, 862s32i a4, sp, 1263s32i a5, sp, 1664s32i a6, sp, 2065s32i a7, sp, 2466addi a2, a10, -MCOUNT_INSN_SIZE67callx0 a968l32i a0, sp, 069l32i a2, sp, 470l32i a3, sp, 871l32i a4, sp, 1272l32i a5, sp, 1673l32i a6, sp, 2074l32i a7, sp, 2475abi_ret(28)76#else77#error Unsupported Xtensa ABI78#endif79ENDPROC(_mcount)80EXPORT_SYMBOL(_mcount)8182ENTRY(ftrace_stub)83abi_entry_default84abi_ret_default85ENDPROC(ftrace_stub)868788