diff options
author | Steven Rostedt <srostedt@redhat.com> | 2009-02-13 15:45:27 +0100 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-02-23 00:48:56 +0100 |
commit | bb9b903527eb16c8fdad59a562c29e89f5dcf233 (patch) | |
tree | 3a6cbb3a2999f2175762ba0a09f78f52933ff296 /arch/powerpc/kernel/ftrace.c | |
parent | powerpc, ftrace: use unsigned int for instruction manipulation (diff) | |
download | linux-bb9b903527eb16c8fdad59a562c29e89f5dcf233.tar.xz linux-bb9b903527eb16c8fdad59a562c29e89f5dcf233.zip |
powerpc, ftrace: use create_branch lib function
Impact: clean up, remove duplicate code
When ftrace was first ported to PowerPC, there existed a
create_function_call that would create the instruction to make a call
to a given address. Unfortunately, this call expected to write to
the address it was given, and since it used the address to calculate
the offset, it could not be faked.
ftrace needed a way to create the instruction without actually writing
that instruction to the text section. So ftrace had to implement its
own code.
Now we have create_branch in the code patching library, which does
exactly what ftrace needs. This patch replaces ftrace's implementation
with the library function.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/ftrace.c')
-rw-r--r-- | arch/powerpc/kernel/ftrace.c | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c index 610c852b92ed..4c75a1c0a5b4 100644 --- a/arch/powerpc/kernel/ftrace.c +++ b/arch/powerpc/kernel/ftrace.c @@ -31,11 +31,6 @@ #endif #ifdef CONFIG_DYNAMIC_FTRACE -static unsigned int ftrace_calc_offset(long ip, long addr) -{ - return (int)(addr - ip); -} - static unsigned int ftrace_nop_replace(void) { return PPC_NOP_INSTR; @@ -46,17 +41,10 @@ ftrace_call_replace(unsigned long ip, unsigned long addr, int link) { unsigned int op; - /* - * It would be nice to just use create_function_call, but that will - * update the code itself. Here we need to just return the - * instruction that is going to be modified, without modifying the - * code. - */ addr = GET_ADDR(addr); /* if (link) set op to 'bl' else 'b' */ - op = 0x48000000 | (link ? 1 : 0); - op |= (ftrace_calc_offset(ip, addr) & 0x03fffffc); + op = create_branch((unsigned int *)ip, addr, link ? 1 : 0); return op; } |