diff options
Diffstat (limited to 'arch/mips/kernel/mcount.S')
-rw-r--r-- | arch/mips/kernel/mcount.S | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S index 522e91c688fc..0a9cfdb271dd 100644 --- a/arch/mips/kernel/mcount.S +++ b/arch/mips/kernel/mcount.S | |||
@@ -70,6 +70,9 @@ _mcount: | |||
70 | nop | 70 | nop |
71 | 71 | ||
72 | MCOUNT_SAVE_REGS | 72 | MCOUNT_SAVE_REGS |
73 | #ifdef KBUILD_MCOUNT_RA_ADDRESS | ||
74 | PTR_S t0, PT_R12(sp) /* t0 saved the location of the return address(at) by -mmcount-ra-address */ | ||
75 | #endif | ||
73 | 76 | ||
74 | move a0, ra /* arg1: next ip, selfaddr */ | 77 | move a0, ra /* arg1: next ip, selfaddr */ |
75 | .globl ftrace_call | 78 | .globl ftrace_call |
@@ -133,11 +136,22 @@ ftrace_stub: | |||
133 | NESTED(ftrace_graph_caller, PT_SIZE, ra) | 136 | NESTED(ftrace_graph_caller, PT_SIZE, ra) |
134 | #ifdef CONFIG_DYNAMIC_FTRACE | 137 | #ifdef CONFIG_DYNAMIC_FTRACE |
135 | PTR_L a1, PT_R31(sp) /* load the original ra from the stack */ | 138 | PTR_L a1, PT_R31(sp) /* load the original ra from the stack */ |
139 | #ifdef KBUILD_MCOUNT_RA_ADDRESS | ||
140 | PTR_L t0, PT_R12(sp) /* load the original t0 from the stack */ | ||
141 | #endif | ||
136 | #else | 142 | #else |
137 | MCOUNT_SAVE_REGS | 143 | MCOUNT_SAVE_REGS |
138 | move a1, ra /* arg2: next ip, selfaddr */ | 144 | move a1, ra /* arg2: next ip, selfaddr */ |
139 | #endif | 145 | #endif |
146 | |||
147 | #ifdef KBUILD_MCOUNT_RA_ADDRESS | ||
148 | bnez t0, 1f /* non-leaf func: t0 saved the location of the return address */ | ||
149 | nop | ||
150 | PTR_LA t0, PT_R1(sp) /* leaf func: get the location of at(old ra) from our own stack */ | ||
151 | 1: move a0, t0 /* arg1: the location of the return address */ | ||
152 | #else | ||
140 | PTR_LA a0, PT_R1(sp) /* arg1: &AT -> a0 */ | 153 | PTR_LA a0, PT_R1(sp) /* arg1: &AT -> a0 */ |
154 | #endif | ||
141 | jal prepare_ftrace_return | 155 | jal prepare_ftrace_return |
142 | #ifdef CONFIG_FRAME_POINTER | 156 | #ifdef CONFIG_FRAME_POINTER |
143 | move a2, fp /* arg3: frame pointer */ | 157 | move a2, fp /* arg3: frame pointer */ |