xref: /linux/arch/sh/include/asm/ftrace.h (revision c93bf928fea22c61f6b5c04786b325c9bfbc0462)
14b4cf759SPaul Mundt #ifndef __ASM_SH_FTRACE_H
24b4cf759SPaul Mundt #define __ASM_SH_FTRACE_H
34b4cf759SPaul Mundt 
4fad57febSMatt Fleming #ifdef CONFIG_FUNCTION_TRACER
5fad57febSMatt Fleming 
6fad57febSMatt Fleming #define MCOUNT_INSN_SIZE	4 /* sizeof mcount call */
7c68e3206SPaul Mundt #define FTRACE_SYSCALL_MAX	NR_syscalls
8fad57febSMatt Fleming 
94b4cf759SPaul Mundt #ifndef __ASSEMBLY__
104b4cf759SPaul Mundt extern void mcount(void);
11fad57febSMatt Fleming 
12*c93bf928SMinfei Huang #define MCOUNT_ADDR		((unsigned long)(mcount))
13fad57febSMatt Fleming 
14fad57febSMatt Fleming #ifdef CONFIG_DYNAMIC_FTRACE
15ca0d1727SMatt Fleming #define CALL_ADDR		((long)(ftrace_call))
16fad57febSMatt Fleming #define STUB_ADDR		((long)(ftrace_stub))
17327933f5SMatt Fleming #define GRAPH_ADDR		((long)(ftrace_graph_call))
18327933f5SMatt Fleming #define CALLER_ADDR		((long)(ftrace_caller))
19fad57febSMatt Fleming 
20ca0d1727SMatt Fleming #define MCOUNT_INSN_OFFSET	((STUB_ADDR - CALL_ADDR) - 4)
21327933f5SMatt Fleming #define GRAPH_INSN_OFFSET	((CALLER_ADDR - GRAPH_ADDR) - 4)
2222f131aaSPaul Mundt 
2322f131aaSPaul Mundt struct dyn_arch_ftrace {
2422f131aaSPaul Mundt 	/* No extra data needed on sh */
2522f131aaSPaul Mundt };
2622f131aaSPaul Mundt 
2722f131aaSPaul Mundt #endif /* CONFIG_DYNAMIC_FTRACE */
284b4cf759SPaul Mundt 
29fad57febSMatt Fleming static inline unsigned long ftrace_call_adjust(unsigned long addr)
30fad57febSMatt Fleming {
31fad57febSMatt Fleming 	/* 'addr' is the memory table address. */
32fad57febSMatt Fleming 	return addr;
33fad57febSMatt Fleming }
34fad57febSMatt Fleming 
3536c87199SPaul Mundt #endif /* __ASSEMBLY__ */
3636c87199SPaul Mundt #endif /* CONFIG_FUNCTION_TRACER */
3736c87199SPaul Mundt 
3836c87199SPaul Mundt #ifndef __ASSEMBLY__
3936c87199SPaul Mundt 
40ac4fac8cSPaul Mundt /* arch/sh/kernel/return_address.c */
41ac4fac8cSPaul Mundt extern void *return_address(unsigned int);
42d26cddbbSMatt Fleming 
43eed542d6SAKASHI Takahiro #define ftrace_return_address(n) return_address(n)
44d26cddbbSMatt Fleming 
4522f131aaSPaul Mundt #endif /* __ASSEMBLY__ */
46fad57febSMatt Fleming 
474b4cf759SPaul Mundt #endif /* __ASM_SH_FTRACE_H */
48