[PATCH 1/2] openrisc: move sys_clone's stack determination to copy_thread

From: Jonas Bonn
Date: Thu Oct 25 2012 - 11:47:06 EST


Signed-off-by: Jonas Bonn <jonas@xxxxxxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/