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