mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonas Bonn <jonas@southpole.se>
To: viro@zeniv.linux.org.uk
Cc: linux-kernel@vger.kernel.org, Jonas Bonn <jonas@southpole.se>
Subject: [PATCH 1/2] openrisc: move sys_clone's stack determination to copy_thread
Date: Thu, 25 Oct 2012 17:46:38 +0200	[thread overview]
Message-ID: <1351179999-8376-2-git-send-email-jonas@southpole.se> (raw)
In-Reply-To: <1351179999-8376-1-git-send-email-jonas@southpole.se>

Signed-off-by: Jonas Bonn <jonas@southpole.se>
---
 arch/openrisc/kernel/process.c  |    6 +++++-
 arch/openrisc/kernel/sys_or32.c |    8 +-------
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/arch/openrisc/kernel/process.c b/arch/openrisc/kernel/process.c
index e0874b8..efbe4f8 100644
--- a/arch/openrisc/kernel/process.c
+++ b/arch/openrisc/kernel/process.c
@@ -170,7 +170,11 @@ copy_thread(unsigned long clone_flags, unsigned long usp,
 	} else {
 		*userregs = *regs;
 
-		userregs->sp = usp;
+		if (usp)
+			userregs->sp = usp;		/* clone */
+		else
+			userregs->sp = regs->sp;	/* fork/clone */
+
 		userregs->gpr[11] = 0;	/* Result from fork() */
 
 		kregs->gpr[20] = 0;	/* Userspace thread */
diff --git a/arch/openrisc/kernel/sys_or32.c b/arch/openrisc/kernel/sys_or32.c
index d6ddd3c..db46b82 100644
--- a/arch/openrisc/kernel/sys_or32.c
+++ b/arch/openrisc/kernel/sys_or32.c
@@ -46,12 +46,6 @@ asmlinkage long _sys_clone(unsigned long clone_flags, unsigned long newsp,
 {
 	long ret;
 
-	/* FIXME: Is alignment necessary? */
-	/* newsp = ALIGN(newsp, 4); */
-
-	if (!newsp)
-		newsp = regs->sp;
-
 	ret = do_fork(clone_flags, newsp, regs, 0, parent_tid, child_tid);
 
 	return ret;
@@ -60,7 +54,7 @@ asmlinkage long _sys_clone(unsigned long clone_flags, unsigned long newsp,
 asmlinkage int _sys_fork(struct pt_regs *regs)
 {
 #ifdef CONFIG_MMU
-	return do_fork(SIGCHLD, regs->sp, regs, 0, NULL, NULL);
+	return do_fork(SIGCHLD, 0, regs, 0, NULL, NULL);
 #else
 	return -EINVAL;
 #endif
-- 
1.7.9.5


  reply	other threads:[~2012-10-25 15:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-25 15:46 [PATCH 0/2] openrisc: more kernel_thread cleanup Jonas Bonn
2012-10-25 15:46 ` Jonas Bonn [this message]
2012-10-25 15:55   ` [PATCH 1/2] openrisc: move sys_clone's stack determination to copy_thread Al Viro
2012-10-25 16:16     ` Jonas Bonn
2012-10-25 15:46 ` [PATCH 2/2] openrisc: determine regs directly in copy_thread Jonas Bonn
2012-10-25 16:27   ` Al Viro

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=1351179999-8376-2-git-send-email-jonas@southpole.se \
    --to=jonas@southpole.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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

all inboxes | Powered by JetHome®