diff options
author | Steven Rostedt <rostedt@goodmis.org> | 2009-02-11 15:01:18 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-02-22 18:48:54 -0500 |
commit | bf528a3a9bd11b6ae39684b18c9c0678f23924fd (patch) | |
tree | 2d9b872ebb5484c9537e355ae7d0cbc1351afd92 /arch/powerpc/include/asm/ftrace.h | |
parent | bb7253403f7a4670a128e4c080fd8ea1bd4d5029 (diff) |
powerpc32, ftrace: save and restore mcount regs with macro
Impact: clean up
Use a macro to save and restore the registers for PowerPC32,
since that code is duplicated.
This is similar to the work done by Cyrill Gorcunov for the
mcount code in x86_64.
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/include/asm/ftrace.h')
-rw-r--r-- | arch/powerpc/include/asm/ftrace.h | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/arch/powerpc/include/asm/ftrace.h b/arch/powerpc/include/asm/ftrace.h index e5f2ae8362f7..dde1296b8b41 100644 --- a/arch/powerpc/include/asm/ftrace.h +++ b/arch/powerpc/include/asm/ftrace.h | |||
@@ -5,7 +5,44 @@ | |||
5 | #define MCOUNT_ADDR ((long)(_mcount)) | 5 | #define MCOUNT_ADDR ((long)(_mcount)) |
6 | #define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */ | 6 | #define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */ |
7 | 7 | ||
8 | #ifndef __ASSEMBLY__ | 8 | #ifdef __ASSEMBLY__ |
9 | |||
10 | /* Based off of objdump optput from glibc */ | ||
11 | |||
12 | #define MCOUNT_SAVE_FRAME \ | ||
13 | stwu r1,-48(r1); \ | ||
14 | stw r3, 12(r1); \ | ||
15 | stw r4, 16(r1); \ | ||
16 | stw r5, 20(r1); \ | ||
17 | stw r6, 24(r1); \ | ||
18 | mflr r3; \ | ||
19 | lwz r4, 52(r1); \ | ||
20 | mfcr r5; \ | ||
21 | stw r7, 28(r1); \ | ||
22 | stw r8, 32(r1); \ | ||
23 | stw r9, 36(r1); \ | ||
24 | stw r10,40(r1); \ | ||
25 | stw r3, 44(r1); \ | ||
26 | stw r5, 8(r1) | ||
27 | |||
28 | #define MCOUNT_RESTORE_FRAME \ | ||
29 | lwz r6, 8(r1); \ | ||
30 | lwz r0, 44(r1); \ | ||
31 | lwz r3, 12(r1); \ | ||
32 | mtctr r0; \ | ||
33 | lwz r4, 16(r1); \ | ||
34 | mtcr r6; \ | ||
35 | lwz r5, 20(r1); \ | ||
36 | lwz r6, 24(r1); \ | ||
37 | lwz r0, 52(r1); \ | ||
38 | lwz r7, 28(r1); \ | ||
39 | lwz r8, 32(r1); \ | ||
40 | mtlr r0; \ | ||
41 | lwz r9, 36(r1); \ | ||
42 | lwz r10,40(r1); \ | ||
43 | addi r1, r1, 48 | ||
44 | |||
45 | #else /* !__ASSEMBLY__ */ | ||
9 | extern void _mcount(void); | 46 | extern void _mcount(void); |
10 | 47 | ||
11 | #ifdef CONFIG_DYNAMIC_FTRACE | 48 | #ifdef CONFIG_DYNAMIC_FTRACE |