b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | |
| 3 | #ifndef __ASM_NDS32_FTRACE_H |
| 4 | #define __ASM_NDS32_FTRACE_H |
| 5 | |
| 6 | #ifdef CONFIG_FUNCTION_TRACER |
| 7 | |
| 8 | #define HAVE_FUNCTION_GRAPH_FP_TEST |
| 9 | |
| 10 | #define MCOUNT_ADDR ((unsigned long)(_mcount)) |
| 11 | /* mcount call is composed of three instructions: |
| 12 | * sethi + ori + jral |
| 13 | */ |
| 14 | #define MCOUNT_INSN_SIZE 12 |
| 15 | |
| 16 | extern void _mcount(unsigned long parent_ip); |
| 17 | |
| 18 | #ifdef CONFIG_DYNAMIC_FTRACE |
| 19 | |
| 20 | #define FTRACE_ADDR ((unsigned long)_ftrace_caller) |
| 21 | |
| 22 | #ifdef __NDS32_EL__ |
| 23 | #define INSN_NOP 0x09000040 |
| 24 | #define INSN_SIZE(insn) (((insn & 0x00000080) == 0) ? 4 : 2) |
| 25 | #define IS_SETHI(insn) ((insn & 0x000000fe) == 0x00000046) |
| 26 | #define ENDIAN_CONVERT(insn) be32_to_cpu(insn) |
| 27 | #else /* __NDS32_EB__ */ |
| 28 | #define INSN_NOP 0x40000009 |
| 29 | #define INSN_SIZE(insn) (((insn & 0x80000000) == 0) ? 4 : 2) |
| 30 | #define IS_SETHI(insn) ((insn & 0xfe000000) == 0x46000000) |
| 31 | #define ENDIAN_CONVERT(insn) (insn) |
| 32 | #endif |
| 33 | |
| 34 | extern void _ftrace_caller(unsigned long parent_ip); |
| 35 | static inline unsigned long ftrace_call_adjust(unsigned long addr) |
| 36 | { |
| 37 | return addr; |
| 38 | } |
| 39 | struct dyn_arch_ftrace { |
| 40 | }; |
| 41 | |
| 42 | #endif /* CONFIG_DYNAMIC_FTRACE */ |
| 43 | |
| 44 | #endif /* CONFIG_FUNCTION_TRACER */ |
| 45 | |
| 46 | #endif /* __ASM_NDS32_FTRACE_H */ |