Adapt the code to make use of new syscall handling interface

Signed-off-by: Marcin Nowakowski <marcin.nowakow...@imgtec.com>
Cc: Steven Rostedt <rost...@goodmis.org>
Cc: Ingo Molnar <mi...@redhat.com>
Cc: Benjamin Herrenschmidt <b...@kernel.crashing.org>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Michael Ellerman <m...@ellerman.id.au>
Cc: linuxppc-...@lists.ozlabs.org
---
 arch/powerpc/include/asm/ftrace.h | 11 +++++++++++
 arch/powerpc/kernel/ftrace.c      |  4 ++++
 2 files changed, 15 insertions(+)

diff --git a/arch/powerpc/include/asm/ftrace.h 
b/arch/powerpc/include/asm/ftrace.h
index 9697a73..d2ea3b6 100644
--- a/arch/powerpc/include/asm/ftrace.h
+++ b/arch/powerpc/include/asm/ftrace.h
@@ -86,6 +86,17 @@ static inline bool arch_syscall_match_sym_name(const char 
*sym, const char *name
        return !strcmp(sym + prefix_len + 1, name + prefix_len);
 }
 #endif
+
+#if defined(CONFIG_COMPAT)
+#include <linux/compat.h>
+#include <asm/compat.h>
+
+#define ARCH_COMPAT_SYSCALL_NUMBERS_OVERLAP 1
+static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs)
+{
+       return in_compat_syscall();
+}
+#endif /* CONFIG_COMPAT */
 #endif /* CONFIG_FTRACE_SYSCALLS && !__ASSEMBLY__ */
 
 #endif /* _ASM_POWERPC_FTRACE */
diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c
index 71f4d07..0764fa5 100644
--- a/arch/powerpc/kernel/ftrace.c
+++ b/arch/powerpc/kernel/ftrace.c
@@ -605,6 +605,10 @@ out:
 #if defined(CONFIG_FTRACE_SYSCALLS) && defined(CONFIG_PPC64)
 unsigned long __init arch_syscall_addr(int nr, bool compat)
 {
+#ifdef CONFIG_COMPAT
+       if (compat)
+               return sys_call_table[nr*2+1];
+#endif
        return sys_call_table[nr*2];
 }
 #endif /* CONFIG_FTRACE_SYSCALLS && CONFIG_PPC64 */
-- 
2.7.4

Reply via email to