aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/include/asm/ftrace.h
diff options
context:
space:
mode:
authorWu Zhangjin <wuzhangjin@gmail.com>2009-11-20 07:34:36 -0500
committerRalf Baechle <ralf@linux-mips.org>2009-12-16 20:57:25 -0500
commit046199cae714a7f9e88f5a7940b077f4515f48cb (patch)
tree8fb3a93a80fc2f719daa0ac905b610de68cf6693 /arch/mips/include/asm/ftrace.h
parente17ff5fec65a0213416efbe7ceae5f2f9887dda2 (diff)
MIPS: Tracing: Make ftrace for MIPS work without -fno-omit-frame-pointer
When remove the -fno-omit-frame-pointer, gcc will not save the frame pointer for us, we need to save one ourselves. Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Nicholas Mc Guire <der.herr@hofr.at> Cc: zhangfx@lemote.com Cc: Wu Zhangjin <wuzhangjin@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: linux-kernel@vger.kernel.org Cc: linux-mips@linux-mips.org Patchwork: http://patchwork.linux-mips.org/patch/679/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/include/asm/ftrace.h')
-rw-r--r--arch/mips/include/asm/ftrace.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/arch/mips/include/asm/ftrace.h b/arch/mips/include/asm/ftrace.h
index 7094a40b96d8..3986cd8704f3 100644
--- a/arch/mips/include/asm/ftrace.h
+++ b/arch/mips/include/asm/ftrace.h
@@ -19,6 +19,62 @@
19extern void _mcount(void); 19extern void _mcount(void);
20#define mcount _mcount 20#define mcount _mcount
21 21
22#define safe_load(load, src, dst, error) \
23do { \
24 asm volatile ( \
25 "1: " load " %[" STR(dst) "], 0(%[" STR(src) "])\n"\
26 " li %[" STR(error) "], 0\n" \
27 "2:\n" \
28 \
29 ".section .fixup, \"ax\"\n" \
30 "3: li %[" STR(error) "], 1\n" \
31 " j 2b\n" \
32 ".previous\n" \
33 \
34 ".section\t__ex_table,\"a\"\n\t" \
35 STR(PTR) "\t1b, 3b\n\t" \
36 ".previous\n" \
37 \
38 : [dst] "=&r" (dst), [error] "=r" (error)\
39 : [src] "r" (src) \
40 : "memory" \
41 ); \
42} while (0)
43
44#define safe_store(store, src, dst, error) \
45do { \
46 asm volatile ( \
47 "1: " store " %[" STR(src) "], 0(%[" STR(dst) "])\n"\
48 " li %[" STR(error) "], 0\n" \
49 "2:\n" \
50 \
51 ".section .fixup, \"ax\"\n" \
52 "3: li %[" STR(error) "], 1\n" \
53 " j 2b\n" \
54 ".previous\n" \
55 \
56 ".section\t__ex_table,\"a\"\n\t"\
57 STR(PTR) "\t1b, 3b\n\t" \
58 ".previous\n" \
59 \
60 : [error] "=r" (error) \
61 : [dst] "r" (dst), [src] "r" (src)\
62 : "memory" \
63 ); \
64} while (0)
65
66#define safe_load_code(dst, src, error) \
67 safe_load(STR(lw), src, dst, error)
68#define safe_store_code(src, dst, error) \
69 safe_store(STR(sw), src, dst, error)
70
71#define safe_load_stack(dst, src, error) \
72 safe_load(STR(PTR_L), src, dst, error)
73
74#define safe_store_stack(src, dst, error) \
75 safe_store(STR(PTR_S), src, dst, error)
76
77
22#ifdef CONFIG_DYNAMIC_FTRACE 78#ifdef CONFIG_DYNAMIC_FTRACE
23static inline unsigned long ftrace_call_adjust(unsigned long addr) 79static inline unsigned long ftrace_call_adjust(unsigned long addr)
24{ 80{
@@ -27,6 +83,7 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr)
27 83
28struct dyn_arch_ftrace { 84struct dyn_arch_ftrace {
29}; 85};
86
30#endif /* CONFIG_DYNAMIC_FTRACE */ 87#endif /* CONFIG_DYNAMIC_FTRACE */
31#endif /* __ASSEMBLY__ */ 88#endif /* __ASSEMBLY__ */
32#endif /* CONFIG_FUNCTION_TRACER */ 89#endif /* CONFIG_FUNCTION_TRACER */