Commit 4a9e3f8e authored by Michael Ellerman's avatar Michael Ellerman Committed by Benjamin Herrenschmidt

powerpc/ftrace: Use ppc_function_entry() instead of GET_ADDR

Use ppc_function_entry() from code-patching.h.
Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent f03cdb3a
...@@ -23,12 +23,6 @@ ...@@ -23,12 +23,6 @@
#include <asm/code-patching.h> #include <asm/code-patching.h>
#include <asm/ftrace.h> #include <asm/ftrace.h>
#ifdef CONFIG_PPC32
# define GET_ADDR(addr) addr
#else
/* PowerPC64's functions are data that points to the functions */
# define GET_ADDR(addr) (*(unsigned long *)addr)
#endif
#ifdef CONFIG_DYNAMIC_FTRACE #ifdef CONFIG_DYNAMIC_FTRACE
static unsigned int ftrace_nop_replace(void) static unsigned int ftrace_nop_replace(void)
...@@ -41,7 +35,7 @@ ftrace_call_replace(unsigned long ip, unsigned long addr, int link) ...@@ -41,7 +35,7 @@ ftrace_call_replace(unsigned long ip, unsigned long addr, int link)
{ {
unsigned int op; unsigned int op;
addr = GET_ADDR(addr); addr = ppc_function_entry((void *)addr);
/* if (link) set op to 'bl' else 'b' */ /* if (link) set op to 'bl' else 'b' */
op = create_branch((unsigned int *)ip, addr, link ? 1 : 0); op = create_branch((unsigned int *)ip, addr, link ? 1 : 0);
...@@ -197,7 +191,7 @@ __ftrace_make_nop(struct module *mod, ...@@ -197,7 +191,7 @@ __ftrace_make_nop(struct module *mod,
ptr = ((unsigned long)jmp[0] << 32) + jmp[1]; ptr = ((unsigned long)jmp[0] << 32) + jmp[1];
/* This should match what was called */ /* This should match what was called */
if (ptr != GET_ADDR(addr)) { if (ptr != ppc_function_entry((void *)addr)) {
printk(KERN_ERR "addr does not match %lx\n", ptr); printk(KERN_ERR "addr does not match %lx\n", ptr);
return -EINVAL; return -EINVAL;
} }
...@@ -570,7 +564,7 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr) ...@@ -570,7 +564,7 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
return_hooker = (unsigned long)&mod_return_to_handler; return_hooker = (unsigned long)&mod_return_to_handler;
#endif #endif
return_hooker = GET_ADDR(return_hooker); return_hooker = ppc_function_entry((void *)return_hooker);
/* /*
* Protect against fault, even if it shouldn't * Protect against fault, even if it shouldn't
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment