diff options
author | Wu Zhangjin <wuzhangjin@gmail.com> | 2009-11-20 07:34:36 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2009-12-16 20:57:25 -0500 |
commit | 046199cae714a7f9e88f5a7940b077f4515f48cb (patch) | |
tree | 8fb3a93a80fc2f719daa0ac905b610de68cf6693 /arch/mips/include/asm | |
parent | e17ff5fec65a0213416efbe7ceae5f2f9887dda2 (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')
-rw-r--r-- | arch/mips/include/asm/ftrace.h | 57 |
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 @@ | |||
19 | extern void _mcount(void); | 19 | extern void _mcount(void); |
20 | #define mcount _mcount | 20 | #define mcount _mcount |
21 | 21 | ||
22 | #define safe_load(load, src, dst, error) \ | ||
23 | do { \ | ||
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) \ | ||
45 | do { \ | ||
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 |
23 | static inline unsigned long ftrace_call_adjust(unsigned long addr) | 79 | static 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 | ||
28 | struct dyn_arch_ftrace { | 84 | struct 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 */ |