diff options
author | AKASHI Takahiro <takahiro.akashi@linaro.org> | 2014-05-20 07:31:04 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2014-05-21 03:10:32 -0400 |
commit | eed542d6962ba33a689b4007a389f466e407bd74 (patch) | |
tree | d7ecb07cb30a0d4f20497fa6ef90d3829b4c701a /arch/xtensa | |
parent | d6d211db37e75de2ddc3a4f979038c40df7cc79c (diff) |
ftrace: Make CALLER_ADDRx macros more generic
Most archs with HAVE_ARCH_CALLER_ADDR have pretty much the same
definitions of CALLER_ADDRx(n). Instead of duplicating the code for all
the archs, define a ftrace_return_address0() and
ftrace_return_address(n) that can be overwritten by the archs if they
need to do something different. Instead of 7 macros in every arch, we
now only have at most 2 (and actually only 1 as
ftrace_return_address0() should be the same for all archs).
The CALLER_ADDRx(n) will now be defined in linux/ftrace.h and use the
ftrace_return_address*(n?) macros. This removes a lot of the duplicate
code.
Link: http://lkml.kernel.org/p/1400585464-30333-1-git-send-email-takahiro.akashi@linaro.org
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'arch/xtensa')
-rw-r--r-- | arch/xtensa/include/asm/ftrace.h | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/arch/xtensa/include/asm/ftrace.h b/arch/xtensa/include/asm/ftrace.h index 736b9d214d80..6c6d9a9f185f 100644 --- a/arch/xtensa/include/asm/ftrace.h +++ b/arch/xtensa/include/asm/ftrace.h | |||
@@ -12,24 +12,18 @@ | |||
12 | 12 | ||
13 | #include <asm/processor.h> | 13 | #include <asm/processor.h> |
14 | 14 | ||
15 | #define HAVE_ARCH_CALLER_ADDR | ||
16 | #ifndef __ASSEMBLY__ | 15 | #ifndef __ASSEMBLY__ |
17 | #define CALLER_ADDR0 ({ unsigned long a0, a1; \ | 16 | #define ftrace_return_address0 ({ unsigned long a0, a1; \ |
18 | __asm__ __volatile__ ( \ | 17 | __asm__ __volatile__ ( \ |
19 | "mov %0, a0\n" \ | 18 | "mov %0, a0\n" \ |
20 | "mov %1, a1\n" \ | 19 | "mov %1, a1\n" \ |
21 | : "=r"(a0), "=r"(a1)); \ | 20 | : "=r"(a0), "=r"(a1)); \ |
22 | MAKE_PC_FROM_RA(a0, a1); }) | 21 | MAKE_PC_FROM_RA(a0, a1); }) |
22 | |||
23 | #ifdef CONFIG_FRAME_POINTER | 23 | #ifdef CONFIG_FRAME_POINTER |
24 | extern unsigned long return_address(unsigned level); | 24 | extern unsigned long return_address(unsigned level); |
25 | #define CALLER_ADDR1 return_address(1) | 25 | #define ftrace_return_address(n) return_address(n) |
26 | #define CALLER_ADDR2 return_address(2) | 26 | #endif |
27 | #define CALLER_ADDR3 return_address(3) | ||
28 | #else /* CONFIG_FRAME_POINTER */ | ||
29 | #define CALLER_ADDR1 (0) | ||
30 | #define CALLER_ADDR2 (0) | ||
31 | #define CALLER_ADDR3 (0) | ||
32 | #endif /* CONFIG_FRAME_POINTER */ | ||
33 | #endif /* __ASSEMBLY__ */ | 27 | #endif /* __ASSEMBLY__ */ |
34 | 28 | ||
35 | #ifdef CONFIG_FUNCTION_TRACER | 29 | #ifdef CONFIG_FUNCTION_TRACER |