Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 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 | |
| 13 | #include <linux/linkage.h> |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 14 | #include <asm/asmmacro.h> |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 15 | #include <asm/ftrace.h> |
| 16 | |
| 17 | /* |
| 18 | * Entry condition: |
| 19 | * |
| 20 | * a2: a0 of the caller |
| 21 | */ |
| 22 | |
| 23 | ENTRY(_mcount) |
| 24 | |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 25 | abi_entry_default |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 26 | |
| 27 | movi a4, ftrace_trace_function |
| 28 | l32i a4, a4, 0 |
| 29 | movi a3, ftrace_stub |
| 30 | bne a3, a4, 1f |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 31 | abi_ret_default |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 32 | |
| 33 | 1: xor a7, a2, a1 |
| 34 | movi a3, 0x3fffffff |
| 35 | and a7, a7, a3 |
| 36 | xor a7, a7, a1 |
| 37 | |
| 38 | xor a6, a0, a1 |
| 39 | and a6, a6, a3 |
| 40 | xor a6, a6, a1 |
| 41 | addi a6, a6, -MCOUNT_INSN_SIZE |
| 42 | callx4 a4 |
| 43 | |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 44 | abi_ret_default |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 45 | |
| 46 | ENDPROC(_mcount) |
| 47 | |
| 48 | ENTRY(ftrace_stub) |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 49 | abi_entry_default |
| 50 | abi_ret_default |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 51 | ENDPROC(ftrace_stub) |