diff options
Diffstat (limited to 'arch/powerpc/kernel/entry_32.S')
-rw-r--r-- | arch/powerpc/kernel/entry_32.S | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S index fd54cb59728e..12247b937d25 100644 --- a/arch/powerpc/kernel/entry_32.S +++ b/arch/powerpc/kernel/entry_32.S | |||
@@ -1199,9 +1199,11 @@ _GLOBAL(_mcount) | |||
1199 | 1199 | ||
1200 | mtctr r5 | 1200 | mtctr r5 |
1201 | bctrl | 1201 | bctrl |
1202 | |||
1203 | nop | 1202 | nop |
1204 | 1203 | ||
1204 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | ||
1205 | b ftrace_graph_caller | ||
1206 | #endif | ||
1205 | MCOUNT_RESTORE_FRAME | 1207 | MCOUNT_RESTORE_FRAME |
1206 | 1208 | ||
1207 | bctr | 1209 | bctr |
@@ -1210,4 +1212,43 @@ _GLOBAL(_mcount) | |||
1210 | _GLOBAL(ftrace_stub) | 1212 | _GLOBAL(ftrace_stub) |
1211 | blr | 1213 | blr |
1212 | 1214 | ||
1215 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | ||
1216 | _GLOBAL(ftrace_graph_caller) | ||
1217 | /* load r4 with local address */ | ||
1218 | lwz r4, 44(r1) | ||
1219 | subi r4, r4, MCOUNT_INSN_SIZE | ||
1220 | |||
1221 | /* get the parent address */ | ||
1222 | addi r3, r1, 52 | ||
1223 | |||
1224 | bl prepare_ftrace_return | ||
1225 | nop | ||
1226 | |||
1227 | MCOUNT_RESTORE_FRAME | ||
1228 | /* old link register ends up in ctr reg */ | ||
1229 | bctr | ||
1230 | |||
1231 | _GLOBAL(return_to_handler) | ||
1232 | /* need to save return values */ | ||
1233 | stwu r1, -32(r1) | ||
1234 | stw r3, 20(r1) | ||
1235 | stw r4, 16(r1) | ||
1236 | stw r31, 12(r1) | ||
1237 | mr r31, r1 | ||
1238 | |||
1239 | bl ftrace_return_to_handler | ||
1240 | nop | ||
1241 | |||
1242 | /* return value has real return address */ | ||
1243 | mtlr r3 | ||
1244 | |||
1245 | lwz r3, 20(r1) | ||
1246 | lwz r4, 16(r1) | ||
1247 | lwz r31,12(r1) | ||
1248 | lwz r1, 0(r1) | ||
1249 | |||
1250 | /* Jump back to real return address */ | ||
1251 | blr | ||
1252 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ | ||
1253 | |||
1213 | #endif /* CONFIG_MCOUNT */ | 1254 | #endif /* CONFIG_MCOUNT */ |