diff options
-rw-r--r-- | arch/powerpc/Kconfig | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/entry_32.S | 43 | ||||
-rw-r--r-- | arch/powerpc/kernel/ftrace.c | 2 |
3 files changed, 44 insertions, 3 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index b298fb0703de..f50b1c41a699 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -111,7 +111,7 @@ config PPC | |||
111 | select HAVE_FTRACE_MCOUNT_RECORD | 111 | select HAVE_FTRACE_MCOUNT_RECORD |
112 | select HAVE_DYNAMIC_FTRACE | 112 | select HAVE_DYNAMIC_FTRACE |
113 | select HAVE_FUNCTION_TRACER | 113 | select HAVE_FUNCTION_TRACER |
114 | select HAVE_FUNCTION_GRAPH_TRACER if PPC64 | 114 | select HAVE_FUNCTION_GRAPH_TRACER if PPC64 || !DYNAMIC_FTRACE |
115 | select ARCH_WANT_OPTIONAL_GPIOLIB | 115 | select ARCH_WANT_OPTIONAL_GPIOLIB |
116 | select HAVE_IDE | 116 | select HAVE_IDE |
117 | select HAVE_IOREMAP_PROT | 117 | select HAVE_IOREMAP_PROT |
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 */ |
diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c index 5c6dfa97e838..dddd99bbbd8d 100644 --- a/arch/powerpc/kernel/ftrace.c +++ b/arch/powerpc/kernel/ftrace.c | |||
@@ -603,7 +603,7 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr) | |||
603 | "1: " PPC_LL "%[old], 0(%[parent])\n" | 603 | "1: " PPC_LL "%[old], 0(%[parent])\n" |
604 | "2: " PPC_STL "%[return_hooker], 0(%[parent])\n" | 604 | "2: " PPC_STL "%[return_hooker], 0(%[parent])\n" |
605 | " li %[faulted], 0\n" | 605 | " li %[faulted], 0\n" |
606 | "3:" | 606 | "3:\n" |
607 | 607 | ||
608 | ".section .fixup, \"ax\"\n" | 608 | ".section .fixup, \"ax\"\n" |
609 | "4: li %[faulted], 1\n" | 609 | "4: li %[faulted], 1\n" |