diff options
author | Zong Li <zong@andestech.com> | 2018-08-15 11:00:08 +0800 |
---|---|---|
committer | Greentime Hu <greentime@andestech.com> | 2018-09-04 14:45:18 +0800 |
commit | 6b1d6d2fba37129f690ee7e9164f225c55626cac (patch) | |
tree | d343bd17356b373133cce508a63c1de3b2f1e933 /arch/nds32/include | |
parent | fbf58a52ac088669dfa930e557d0303a9fbb7e17 (diff) | |
download | talos-obmc-linux-6b1d6d2fba37129f690ee7e9164f225c55626cac.tar.gz talos-obmc-linux-6b1d6d2fba37129f690ee7e9164f225c55626cac.zip |
nds32/ftrace: Support dynamic function tracer
This patch contains the implementation of dynamic function tracer.
The mcount call is composed of three instructions, so there are three
nop for enough placeholder.
Signed-off-by: Zong Li <zong@andestech.com>
Acked-by: Greentime Hu <greentime@andestech.com>
Signed-off-by: Greentime Hu <greentime@andestech.com>
Diffstat (limited to 'arch/nds32/include')
-rw-r--r-- | arch/nds32/include/asm/ftrace.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/arch/nds32/include/asm/ftrace.h b/arch/nds32/include/asm/ftrace.h index bac7657f576a..2f96cc96aa35 100644 --- a/arch/nds32/include/asm/ftrace.h +++ b/arch/nds32/include/asm/ftrace.h @@ -15,6 +15,32 @@ extern void _mcount(unsigned long parent_ip); +#ifdef CONFIG_DYNAMIC_FTRACE + +#define FTRACE_ADDR ((unsigned long)_ftrace_caller) + +#ifdef __NDS32_EL__ +#define INSN_NOP 0x09000040 +#define INSN_SIZE(insn) (((insn & 0x00000080) == 0) ? 4 : 2) +#define IS_SETHI(insn) ((insn & 0x000000fe) == 0x00000046) +#define ENDIAN_CONVERT(insn) be32_to_cpu(insn) +#else /* __NDS32_EB__ */ +#define INSN_NOP 0x40000009 +#define INSN_SIZE(insn) (((insn & 0x80000000) == 0) ? 4 : 2) +#define IS_SETHI(insn) ((insn & 0xfe000000) == 0x46000000) +#define ENDIAN_CONVERT(insn) (insn) +#endif + +extern void _ftrace_caller(unsigned long parent_ip); +static inline unsigned long ftrace_call_adjust(unsigned long addr) +{ + return addr; +} +struct dyn_arch_ftrace { +}; + +#endif /* CONFIG_DYNAMIC_FTRACE */ + #endif /* CONFIG_FUNCTION_TRACER */ #endif /* __ASM_NDS32_FTRACE_H */ |