Patchwork [06/40] x86: add arch_compat_syscall_addr()

login
register
mail settings
Submitter Ian Munsie
Date June 23, 2010, 10:02 a.m.
Message ID <1277287401-28571-7-git-send-email-imunsie@au1.ibm.com>
Download mbox | patch
Permalink /patch/56632/
State Not Applicable
Headers show

Comments

Ian Munsie - June 23, 2010, 10:02 a.m.
From: Jason Baron <jbaron@redhat.com>

Add arch_compat_syscall_addr(int nr) for x86_64. This is in preparation for adding
compat syscall support to the event tracer.

Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
---
 arch/x86/include/asm/syscall.h |    5 +++++
 arch/x86/kernel/ftrace.c       |    8 ++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)

Patch

diff --git a/arch/x86/include/asm/syscall.h b/arch/x86/include/asm/syscall.h
index c4a348f..4e462cc 100644
--- a/arch/x86/include/asm/syscall.h
+++ b/arch/x86/include/asm/syscall.h
@@ -16,7 +16,12 @@ 
 #include <linux/sched.h>
 #include <linux/err.h>
 
+#if defined(CONFIG_COMPAT) && defined(CONFIG_FTRACE_SYSCALLS)
+ #define __HAVE_ARCH_FTRACE_COMPAT_SYSCALLS
+#endif
+
 extern const unsigned long sys_call_table[];
+extern const unsigned long *ia32_sys_call_table;
 
 /*
  * Only the low 32 bits of orig_ax are meaningful, so we return int.
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index cd37469..4b36a0b 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -26,6 +26,7 @@ 
 #include <asm/ftrace.h>
 #include <asm/nops.h>
 #include <asm/nmi.h>
+#include <asm/syscall.h>
 
 
 #ifdef CONFIG_DYNAMIC_FTRACE
@@ -510,3 +511,10 @@  void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
 	}
 }
 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
+
+#ifdef __HAVE_ARCH_FTRACE_COMPAT_SYSCALLS
+unsigned long __init arch_compat_syscall_addr(int nr)
+{
+	return (unsigned long)(&ia32_sys_call_table)[nr];
+}
+#endif