linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Ian Munsie" <imunsie@au1.ibm.com>
To: linux-kernel@vger.kernel.org, linuxppc-dev@ozlabs.org
Cc: Chase Douglas <cndougla@linux.vnet.ibm.com>,
	Dave Kleikamp <shaggy@linux.vnet.ibm.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Jason Baron <jbaron@redhat.com>, Ingo Molnar <mingo@elte.hu>,
	Steven Rostedt <rostedt@goodmis.org>,
	David Gibson <dwg@au1.ibm.com>, Ingo Molnar <mingo@redhat.com>,
	Paul Mackerras <paulus@samba.org>,
	Ian Munsie <imunsie@au1.ibm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Arjan van de Ven <arjan@linux.intel.com>,
	Christoph Hellwig <hch@lst.de>, Anton Blanchard <anton@samba.org>
Subject: [PATCH 40/40] trace syscalls, PPC: Convert morphing native/compat syscalls
Date: Wed, 23 Jun 2010 20:03:21 +1000	[thread overview]
Message-ID: <1277287401-28571-41-git-send-email-imunsie@au1.ibm.com> (raw)
In-Reply-To: <1277287401-28571-1-git-send-email-imunsie@au1.ibm.com>

From: Ian Munsie <imunsie@au1.ibm.com>

Several of the PowerPC system call implementations are used as both the
32bit compat version on PPC64 and the 32bit native version on PPC32.

Previousely these used the preprocessor to change the function names on
PPC64 to add the compat_ prefix.

This patch converts these system calls to use the SYSCALL_DEFINE family
of macros, with the preprocessor selecting which macro to use at their
implementation (which should also make things a little clearer, if more
verbose).

This patch also renames the swapcontext syscall and it's assembly
wrapper such that only the first three characters of their names will
differ which ftrace syscalls ignores when matching the syscall names
to their symbol names. This ensures that the appropriate meta-data will
match for this system call.

Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
---
 arch/powerpc/include/asm/systbl.h |    2 +-
 arch/powerpc/kernel/entry_64.S    |    4 +-
 arch/powerpc/kernel/signal_32.c   |   56 +++++++++++++++++++++++++-----------
 3 files changed, 42 insertions(+), 20 deletions(-)

diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h
index 06c0a73..a0afa14 100644
--- a/arch/powerpc/include/asm/systbl.h
+++ b/arch/powerpc/include/asm/systbl.h
@@ -252,7 +252,7 @@ COMPAT_SYS_SPU(clock_settime)
 COMPAT_SYS_SPU(clock_gettime)
 COMPAT_SYS_SPU(clock_getres)
 COMPAT_SYS_SPU(clock_nanosleep)
-SYSX(ppc64_swapcontext,ppc32_swapcontext,ppc_swapcontext)
+SYSX(ppc_swapcontext,ppc32_swapcontext,ppc_swapcontext)
 COMPAT_SYS_SPU(tgkill)
 COMPAT_SYS_SPU(utimes)
 COMPAT_SYS_SPU(statfs64)
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 42e9d90..8c23ff1 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -346,10 +346,10 @@ _GLOBAL(ppc_clone)
 
 _GLOBAL(ppc32_swapcontext)
 	bl	.save_nvgprs
-	bl	.compat_sys_swapcontext
+	bl	.sys32_swapcontext
 	b	syscall_exit
 
-_GLOBAL(ppc64_swapcontext)
+_GLOBAL(ppc_swapcontext)
 	bl	.save_nvgprs
 	bl	.sys_swapcontext
 	b	syscall_exit
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index 212583d..2c4071f 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -55,13 +55,6 @@
 #undef DEBUG_SIG
 
 #ifdef CONFIG_PPC64
-#define sys_sigsuspend	compat_sys_sigsuspend
-#define sys_rt_sigsuspend	compat_sys_rt_sigsuspend
-#define sys_rt_sigreturn	compat_sys_rt_sigreturn
-#define sys_sigaction	compat_sys_sigaction
-#define sys_swapcontext	compat_sys_swapcontext
-#define sys_sigreturn	compat_sys_sigreturn
-
 #define old_sigaction	old_sigaction32
 #define sigcontext	sigcontext32
 #define mcontext	mcontext32
@@ -239,7 +232,11 @@ static inline int restore_general_regs(struct pt_regs *regs,
 /*
  * Atomically swap in the new signal mask, and wait for a signal.
  */
-long sys_sigsuspend(old_sigset_t mask)
+#ifdef CONFIG_PPC64
+COMPAT_SYSCALL_DEFINE1(sigsuspend, old_sigset_t, mask)
+#else
+SYSCALL_DEFINE1(sigsuspend, old_sigset_t, mask)
+#endif
 {
 	mask &= _BLOCKABLE;
 	spin_lock_irq(&current->sighand->siglock);
@@ -254,8 +251,15 @@ long sys_sigsuspend(old_sigset_t mask)
  	return -ERESTARTNOHAND;
 }
 
-long sys_sigaction(int sig, struct old_sigaction __user *act,
-		struct old_sigaction __user *oact)
+#ifdef CONFIG_PPC64
+COMPAT_SYSCALL_DEFINE3(sigaction, int, sig,
+		struct old_sigaction __user *, act,
+		struct old_sigaction __user *, oact)
+#else
+SYSCALL_DEFINE3(sigaction, int, sig,
+		struct old_sigaction __user *, act,
+		struct old_sigaction __user *, oact)
+#endif
 {
 	struct k_sigaction new_ka, old_ka;
 	int ret;
@@ -938,9 +942,21 @@ static int do_setcontext(struct ucontext __user *ucp, struct pt_regs *regs, int
 	return 0;
 }
 
-long sys_swapcontext(struct ucontext __user *old_ctx,
-		     struct ucontext __user *new_ctx,
-		     int ctx_size, int r6, int r7, int r8, struct pt_regs *regs)
+/*
+ * Note: Named sys_swapcontext on PPC32 and sys32_swapcontext on PPC64.
+ * Ensures that it's name will still match when compared with it's wrappers
+ * name (ppc_swapcontext on PPC32, ppc32_swapcontext on PPC64) for ftrace
+ * syscalls (which ignores the 1st three characters).
+ */
+#ifdef CONFIG_PPC64
+PPC_REGS_COMPAT_SYSCALL_DEFINEx(3, long, sys32_, swapcontext, regs,
+		struct ucontext __user *, old_ctx,
+		struct ucontext __user *, new_ctx, int, ctx_size)
+#else
+PPC_REGS_SYSCALL_DEFINE3_RET(long, swapcontext, regs,
+		struct ucontext __user *, old_ctx,
+		struct ucontext __user *, new_ctx, int, ctx_size)
+#endif
 {
 	unsigned char tmp;
 	int ctx_has_vsx_region = 0;
@@ -1029,8 +1045,11 @@ long sys_swapcontext(struct ucontext __user *old_ctx,
 	return 0;
 }
 
-long sys_rt_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
-		     struct pt_regs *regs)
+#ifdef CONFIG_PPC64
+PPC_REGS_COMPAT_SYSCALL_DEFINE0_RET(long, rt_sigreturn, regs)
+#else
+PPC_REGS_SYSCALL_DEFINE0_RET(long, rt_sigreturn, regs)
+#endif
 {
 	struct rt_sigframe __user *rt_sf;
 
@@ -1256,8 +1275,11 @@ badframe:
 /*
  * Do a signal return; undo the signal stack.
  */
-long sys_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
-		       struct pt_regs *regs)
+#ifdef CONFIG_PPC64
+PPC_REGS_COMPAT_SYSCALL_DEFINE0_RET(long, sigreturn, regs)
+#else
+PPC_REGS_SYSCALL_DEFINE0_RET(long, sigreturn, regs)
+#endif
 {
 	struct sigcontext __user *sc;
 	struct sigcontext sigctx;
-- 
1.7.1

      parent reply	other threads:[~2010-06-23 10:04 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-23 10:02 ftrace syscalls, PowerPC: Various fixes, Compat Syscall support and PowerPC implementation, V2 Ian Munsie
2010-06-23 10:02 ` [PATCH 01/40] ftrace syscalls: don't add events for unmapped syscalls Ian Munsie
2010-06-23 15:02   ` Steven Rostedt
2010-06-29  1:18     ` Ian Munsie
2010-06-23 10:02 ` [PATCH 02/40] ftrace syscalls: Make arch_syscall_addr weak Ian Munsie
2010-06-23 10:02 ` [PATCH 03/40] ftrace syscalls: Allow arch specific syscall symbol matching Ian Munsie
2010-06-23 10:02 ` [PATCH 04/40] trace, powerpc: Implement raw syscall tracepoints on PowerPC Ian Munsie
2010-06-23 10:02 ` [PATCH 05/40] x86: add NR_syscalls_compat, make ia32 syscall table visible Ian Munsie
2010-06-23 10:02 ` [PATCH 06/40] x86: add arch_compat_syscall_addr() Ian Munsie
2010-06-23 10:02 ` [PATCH 07/40] compat: have generic is_compat_task for !CONFIG_COMPAT Ian Munsie
2010-06-23 10:02 ` [PATCH 08/40] tracing: remove syscall bitmaps in preparation for compat support Ian Munsie
2010-06-23 15:16   ` Steven Rostedt
2010-06-23 19:14     ` Jason Baron
2010-06-23 19:34       ` Jason Baron
2010-06-23 19:45         ` Steven Rostedt
2010-06-23 10:02 ` [PATCH 09/40] tracing: move __start_ftrace_events and __stop_ftrace_events to header file Ian Munsie
2010-06-23 10:02 ` [PATCH 10/40] tracing: add tracing support for compat syscalls Ian Munsie
2010-06-23 15:26   ` Steven Rostedt
2010-06-23 16:02     ` Frederic Weisbecker
2010-06-23 10:02 ` [PATCH 11/40] syscalls: add ARCH_COMPAT_SYSCALL_DEFINE() Ian Munsie
2010-06-23 10:02 ` [PATCH 12/40] x86, compat: convert ia32 layer to use Ian Munsie
2010-06-23 10:14   ` Christoph Hellwig
2010-06-23 10:36     ` Frederic Weisbecker
2010-06-23 10:46       ` Christoph Hellwig
2010-06-23 11:41         ` Frederic Weisbecker
2010-06-23 19:23           ` H. Peter Anvin
2010-06-24 14:37             ` Christoph Hellwig
2010-06-23 10:02 ` [PATCH 13/40] syscalls: add new COMPAT_SYSCALL_DEFINE#N() macro Ian Munsie
2010-06-23 10:02 ` [PATCH 14/40] compat: convert to use COMPAT_SYSCALL_DEFINE#N() Ian Munsie
2010-06-23 10:02 ` [PATCH 15/40] compat: convert fs compat to use COMPAT_SYSCALL_DEFINE#N() macros Ian Munsie
2010-06-23 10:02 ` [PATCH 16/40] tags: recognize compat syscalls Ian Munsie
2010-06-24 12:02   ` Michal Marek
2010-06-23 10:02 ` [PATCH 17/40] tracing: make a "compat_syscalls" tracing subsys Ian Munsie
2010-06-23 10:02 ` [PATCH 18/40] compat_syscalls: introduce CONFIG_COMPAT_FTRACE_SYSCALLS Ian Munsie
2010-06-23 10:03 ` [PATCH 19/40] trace syscalls: Remove redundant syscall_nr checks Ian Munsie
2010-06-23 10:03 ` [PATCH 20/40] trace syscalls: Considder compat_syscall_nr when verifying syscall_nr Ian Munsie
2010-06-23 10:03 ` [PATCH 21/40] trace syscalls, PPC: Add ftrace compat syscall support for PPC64 Ian Munsie
2010-06-23 10:03 ` [PATCH 22/40] trace syscalls, PPC: Convert syscalls to SYSCALL_DEFINE Ian Munsie
2010-06-23 10:03 ` [PATCH 23/40] trace syscalls, PPC: Convert ppc32 compat syscalls to COMPAT_SYSCALL Ian Munsie
2010-06-23 10:03 ` [PATCH 24/40] trace syscalls, PPC: Convert more " Ian Munsie
2010-06-23 10:03 ` [PATCH 25/40] trace syscalls: Refactor syscall metadata creation Ian Munsie
2010-06-23 10:03 ` [PATCH 26/40] trace syscalls, PPC: Add PPC_REGS_SYSCALL_DEFINE macros Ian Munsie
2010-06-23 10:03 ` [PATCH 27/40] trace syscalls: Add COMPAT_SYSCALL_DEFINE0 macro Ian Munsie
2010-06-23 10:03 ` [PATCH 28/40] trace syscalls, PPC: Convert syscalls using regs to REGS_SYSCALL_DEFINE macros Ian Munsie
2010-06-23 10:03 ` [PATCH 29/40] trace syscalls, PPC: Convert ppc32_ syscalls to ARCH_COMPAT_SYSCALL_DEFINE Ian Munsie
2010-06-23 10:03 ` [PATCH 30/40] trace syscalls: Convert remaining kernel/compat.c syscalls to COMPAT_SYSCALL_DEFINE Ian Munsie
2010-06-23 10:03 ` [PATCH 31/40] trace syscalls: Convert various generic compat syscalls Ian Munsie
2010-06-23 10:19   ` Andi Kleen
2010-06-23 10:29     ` Frederic Weisbecker
2010-06-23 10:37       ` Andi Kleen
2010-06-23 11:38         ` Frederic Weisbecker
2010-06-23 12:35           ` Andi Kleen
2010-06-23 12:41             ` Christoph Hellwig
2010-06-23 15:51           ` H. Peter Anvin
2010-06-24 12:05         ` Michal Marek
2010-06-23 10:30     ` KOSAKI Motohiro
2010-06-23 10:03 ` [PATCH 32/40] trace syscalls: Record metadata for syscalls with their own wrappers Ian Munsie
2010-06-23 10:03 ` [PATCH 33/40] trace syscalls: Infrastructure for syscalls different return types Ian Munsie
2010-06-23 10:03 ` [PATCH 34/40] trace syscalls: Convert generic syscalls without long return type Ian Munsie
2010-06-23 10:03 ` [PATCH 35/40] trace syscalls, PPC: Convert PPC syscalls without long return types Ian Munsie
2010-06-23 10:03 ` [PATCH 36/40] trace syscalls: Early terminate search for sys_ni_syscall Ian Munsie
2010-06-23 10:03 ` [PATCH 37/40] trace syscalls: Print out unmapped syscalls at boot Ian Munsie
2010-06-23 10:03 ` [PATCH 38/40] trace syscalls: Remove redundant test for unmapped compat syscalls Ian Munsie
2010-06-23 10:03 ` [PATCH 39/40] trace syscalls: Clean confusing {s, r, }name and fix ABI breakage Ian Munsie
2010-06-23 18:03   ` [PATCH 39/40] trace syscalls: Clean confusing {s,r,}name " Jason Baron
2010-06-29  1:02     ` [PATCH 39/40] trace syscalls: Clean confusing {s, r, }name " Ian Munsie
2010-06-23 10:03 ` Ian Munsie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1277287401-28571-41-git-send-email-imunsie@au1.ibm.com \
    --to=imunsie@au1.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=anton@samba.org \
    --cc=arjan@linux.intel.com \
    --cc=cndougla@linux.vnet.ibm.com \
    --cc=dwg@au1.ibm.com \
    --cc=fweisbec@gmail.com \
    --cc=hch@lst.de \
    --cc=jbaron@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=paulus@samba.org \
    --cc=rostedt@goodmis.org \
    --cc=shaggy@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).