xref: /linux/arch/sh/include/asm/ftrace.h (revision 327933f5d6cdf083284d3c06e0370d1de464aef4)
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 */
7fad57febSMatt Fleming 
84b4cf759SPaul Mundt #ifndef __ASSEMBLY__
94b4cf759SPaul Mundt extern void mcount(void);
10fad57febSMatt Fleming 
11fad57febSMatt Fleming #define MCOUNT_ADDR		((long)(mcount))
12fad57febSMatt Fleming 
13fad57febSMatt Fleming #ifdef CONFIG_DYNAMIC_FTRACE
14ca0d1727SMatt Fleming #define CALL_ADDR		((long)(ftrace_call))
15fad57febSMatt Fleming #define STUB_ADDR		((long)(ftrace_stub))
16*327933f5SMatt Fleming #define GRAPH_ADDR		((long)(ftrace_graph_call))
17*327933f5SMatt Fleming #define CALLER_ADDR		((long)(ftrace_caller))
18fad57febSMatt Fleming 
19ca0d1727SMatt Fleming #define MCOUNT_INSN_OFFSET	((STUB_ADDR - CALL_ADDR) - 4)
20*327933f5SMatt Fleming #define GRAPH_INSN_OFFSET	((CALLER_ADDR - GRAPH_ADDR) - 4)
2122f131aaSPaul Mundt 
2222f131aaSPaul Mundt struct dyn_arch_ftrace {
2322f131aaSPaul Mundt 	/* No extra data needed on sh */
2422f131aaSPaul Mundt };
2522f131aaSPaul Mundt 
2622f131aaSPaul Mundt #endif /* CONFIG_DYNAMIC_FTRACE */
274b4cf759SPaul Mundt 
28fad57febSMatt Fleming static inline unsigned long ftrace_call_adjust(unsigned long addr)
29fad57febSMatt Fleming {
30fad57febSMatt Fleming 	/* 'addr' is the memory table address. */
31fad57febSMatt Fleming 	return addr;
32fad57febSMatt Fleming }
33fad57febSMatt Fleming 
3422f131aaSPaul Mundt #endif /* __ASSEMBLY__ */
35fad57febSMatt Fleming #endif /* CONFIG_FUNCTION_TRACER */
36fad57febSMatt Fleming 
374b4cf759SPaul Mundt #endif /* __ASM_SH_FTRACE_H */
38