All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Gerst <brgerst@gmail.com>
To: hpa@zytor.com
Cc: Ingo Molnar <mingo@elte.hu>,
	x86@kernel.org, torvalds@linux-foundation.org, jeremy@goop.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 6/6] x86: Merge sys_clone
Date: Wed,  9 Dec 2009 19:01:56 -0500	[thread overview]
Message-ID: <1260403316-5679-7-git-send-email-brgerst@gmail.com> (raw)
In-Reply-To: <1260403316-5679-1-git-send-email-brgerst@gmail.com>

Change 32-bit sys_clone to new PTREGSCALL stub, and merge with 64-bit.

Signed-off-by: Brian Gerst <brgerst@gmail.com>
---
 arch/x86/include/asm/syscalls.h |    8 ++------
 arch/x86/kernel/entry_32.S      |   14 +++++++++++++-
 arch/x86/kernel/process.c       |    9 +++++++++
 arch/x86/kernel/process_32.c    |   15 ---------------
 arch/x86/kernel/process_64.c    |    9 ---------
 5 files changed, 24 insertions(+), 31 deletions(-)

diff --git a/arch/x86/include/asm/syscalls.h b/arch/x86/include/asm/syscalls.h
index df2c511..b0ce780 100644
--- a/arch/x86/include/asm/syscalls.h
+++ b/arch/x86/include/asm/syscalls.h
@@ -25,6 +25,8 @@ int sys_fork(struct pt_regs *);
 int sys_vfork(struct pt_regs *);
 long sys_execve(char __user *, char __user * __user *,
 		char __user * __user *, struct pt_regs *);
+long sys_clone(unsigned long, unsigned long, void __user *,
+	       void __user *, struct pt_regs *);
 
 /* kernel/ldt.c */
 asmlinkage int sys_modify_ldt(int, void __user *, unsigned long);
@@ -42,9 +44,6 @@ asmlinkage int sys_get_thread_area(struct user_desc __user *);
 /* X86_32 only */
 #ifdef CONFIG_X86_32
 
-/* kernel/process_32.c */
-int sys_clone(struct pt_regs *);
-
 /* kernel/signal.c */
 asmlinkage int sys_sigsuspend(int, int, old_sigset_t);
 asmlinkage int sys_sigaction(int, const struct old_sigaction __user *,
@@ -73,9 +72,6 @@ int sys_vm86(unsigned long, unsigned long, struct pt_regs *);
 
 /* X86_64 only */
 /* kernel/process_64.c */
-asmlinkage long sys_clone(unsigned long, unsigned long,
-			  void __user *, void __user *,
-			  struct pt_regs *);
 long sys_arch_prctl(int, unsigned long);
 
 /* kernel/sys_x86_64.c */
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index 6c2f25d..6492555 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -760,7 +760,6 @@ ptregs_##name: \
 
 PTREGSCALL1(iopl)
 PTREGSCALL0(fork)
-PTREGSCALL0(clone)
 PTREGSCALL0(vfork)
 PTREGSCALL3(execve)
 PTREGSCALL2(sigaltstack)
@@ -769,6 +768,19 @@ PTREGSCALL0(rt_sigreturn)
 PTREGSCALL2(vm86)
 PTREGSCALL1(vm86old)
 
+/* Clone is an oddball.  The 4th arg is in %edi */
+	ALIGN;
+ptregs_clone:
+	leal 4(%esp),%eax
+	pushl %eax
+	pushl PT_EDI(%eax)
+	movl PT_EDX(%eax),%ecx
+	movl PT_ECX(%eax),%edx
+	movl PT_EBX(%eax),%eax
+	call sys_clone
+	addl $8,%esp
+	ret
+
 .macro FIXUP_ESPFIX_STACK
 /*
  * Switch back for ESPFIX stack to the normal zerobased stack
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index bb17bd9..f3c1a6b 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -234,6 +234,15 @@ int sys_vfork(struct pt_regs *regs)
 		       NULL, NULL);
 }
 
+long
+sys_clone(unsigned long clone_flags, unsigned long newsp,
+	  void __user *parent_tid, void __user *child_tid, struct pt_regs *regs)
+{
+	if (!newsp)
+		newsp = regs->sp;
+	return do_fork(clone_flags, newsp, regs, 0, parent_tid, child_tid);
+}
+
 
 /*
  * sys_execve() executes a new program.
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 486e38e..506d5a7 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -436,21 +436,6 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
 	return prev_p;
 }
 
-int sys_clone(struct pt_regs *regs)
-{
-	unsigned long clone_flags;
-	unsigned long newsp;
-	int __user *parent_tidptr, *child_tidptr;
-
-	clone_flags = regs->bx;
-	newsp = regs->cx;
-	parent_tidptr = (int __user *)regs->dx;
-	child_tidptr = (int __user *)regs->di;
-	if (!newsp)
-		newsp = regs->sp;
-	return do_fork(clone_flags, newsp, regs, 0, parent_tidptr, child_tidptr);
-}
-
 #define top_esp                (THREAD_SIZE - sizeof(unsigned long))
 #define top_ebp                (THREAD_SIZE - 2*sizeof(unsigned long))
 
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 671960d..83019f9 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -534,15 +534,6 @@ void set_personality_64bit(void)
 	current->personality &= ~READ_IMPLIES_EXEC;
 }
 
-asmlinkage long
-sys_clone(unsigned long clone_flags, unsigned long newsp,
-	  void __user *parent_tid, void __user *child_tid, struct pt_regs *regs)
-{
-	if (!newsp)
-		newsp = regs->sp;
-	return do_fork(clone_flags, newsp, regs, 0, parent_tid, child_tid);
-}
-
 unsigned long get_wchan(struct task_struct *p)
 {
 	unsigned long stack;
-- 
1.6.5.2


  parent reply	other threads:[~2009-12-10  0:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-10  0:01 [PATCH 0/6] x86: Merge pt_regs using syscalls Brian Gerst
2009-12-10  0:01 ` [PATCH 1/6] x86, 32-bit: Add new pt_regs stubs Brian Gerst
2009-12-10  0:05   ` H. Peter Anvin
2009-12-10  0:45   ` [tip:x86/asm] x86-32: " tip-bot for Brian Gerst
2009-12-10  0:47   ` [tip:x86/asm] x86-32: Avoid pipeline serialization in PTREGSCALL1 and 2 tip-bot for H. Peter Anvin
2009-12-10  0:01 ` [PATCH 2/6] x86: Merge sys_iopl Brian Gerst
2009-12-10  0:45   ` [tip:x86/asm] " tip-bot for Brian Gerst
2009-12-10  0:57   ` [tip:x86/asm] x86-64, paravirt: Call set_iopl_mask() on 64 bits tip-bot for H. Peter Anvin
2009-12-10  0:01 ` [PATCH 3/6] x86: Merge sys_execve Brian Gerst
2009-12-10  0:46   ` [tip:x86/asm] " tip-bot for Brian Gerst
2009-12-10  0:01 ` [PATCH 4/6] x86: Merge sys_sigaltstack Brian Gerst
2009-12-10  0:46   ` [tip:x86/asm] " tip-bot for Brian Gerst
2009-12-10  0:01 ` [PATCH 5/6] x86, 32-bit: Convert sys_vm86 & sys_vm86old Brian Gerst
2009-12-10  0:46   ` [tip:x86/asm] " tip-bot for Brian Gerst
2009-12-10  0:01 ` Brian Gerst [this message]
2009-12-10  0:46   ` [tip:x86/asm] x86: Merge sys_clone tip-bot for Brian Gerst
2009-12-10  0:47 ` [PATCH 0/6] x86: Merge pt_regs using syscalls H. Peter Anvin
2009-12-10  0:52   ` Jeremy Fitzhardinge

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=1260403316-5679-7-git-send-email-brgerst@gmail.com \
    --to=brgerst@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.