aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-10-26 19:37:49 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-11-28 23:43:40 -0500
commit39d91a9eafec7524482e70af76ccbe803dce5b8e (patch)
tree25b195b538b42b59fc3d4ca28c1abf66c4c6e645 /arch
parentcb56217362d87159b683175247d8d059df80aefa (diff)
openrisc: switch to use of generic fork and clone
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/openrisc/include/asm/syscalls.h7
-rw-r--r--arch/openrisc/include/uapi/asm/unistd.h2
-rw-r--r--arch/openrisc/kernel/Makefile2
-rw-r--r--arch/openrisc/kernel/entry.S12
-rw-r--r--arch/openrisc/kernel/process.c5
-rw-r--r--arch/openrisc/kernel/sys_or32.c57
6 files changed, 19 insertions, 66 deletions
diff --git a/arch/openrisc/include/asm/syscalls.h b/arch/openrisc/include/asm/syscalls.h
index 84a978af44d7..8ee816812a9e 100644
--- a/arch/openrisc/include/asm/syscalls.h
+++ b/arch/openrisc/include/asm/syscalls.h
@@ -24,4 +24,11 @@ asmlinkage long sys_or1k_atomic(unsigned long type, unsigned long *v1,
24 24
25#include <asm-generic/syscalls.h> 25#include <asm-generic/syscalls.h>
26 26
27asmlinkage long __sys_clone(unsigned long clone_flags, unsigned long newsp,
28 void __user *parent_tid, void __user *child_tid, int tls);
29asmlinkage long __sys_fork(void);
30
31#define sys_clone __sys_clone
32#define sys_fork __sys_fork
33
27#endif /* __ASM_OPENRISC_SYSCALLS_H */ 34#endif /* __ASM_OPENRISC_SYSCALLS_H */
diff --git a/arch/openrisc/include/uapi/asm/unistd.h b/arch/openrisc/include/uapi/asm/unistd.h
index 5db7bc0fa5a7..5082b8066325 100644
--- a/arch/openrisc/include/uapi/asm/unistd.h
+++ b/arch/openrisc/include/uapi/asm/unistd.h
@@ -21,6 +21,8 @@
21#define sys_mmap2 sys_mmap_pgoff 21#define sys_mmap2 sys_mmap_pgoff
22 22
23#define __ARCH_WANT_SYS_EXECVE 23#define __ARCH_WANT_SYS_EXECVE
24#define __ARCH_WANT_SYS_FORK
25#define __ARCH_WANT_SYS_CLONE
24 26
25#include <asm-generic/unistd.h> 27#include <asm-generic/unistd.h>
26 28
diff --git a/arch/openrisc/kernel/Makefile b/arch/openrisc/kernel/Makefile
index e1ee0fa2bbda..35f92ce51c24 100644
--- a/arch/openrisc/kernel/Makefile
+++ b/arch/openrisc/kernel/Makefile
@@ -5,7 +5,7 @@
5extra-y := head.o vmlinux.lds 5extra-y := head.o vmlinux.lds
6 6
7obj-y := setup.o idle.o or32_ksyms.o process.o dma.o \ 7obj-y := setup.o idle.o or32_ksyms.o process.o dma.o \
8 traps.o time.o irq.o entry.o ptrace.o signal.o sys_or32.o \ 8 traps.o time.o irq.o entry.o ptrace.o signal.o \
9 sys_call_table.o 9 sys_call_table.o
10 10
11obj-$(CONFIG_MODULES) += module.o 11obj-$(CONFIG_MODULES) += module.o
diff --git a/arch/openrisc/kernel/entry.S b/arch/openrisc/kernel/entry.S
index c60a09df323f..5e5b30601bbf 100644
--- a/arch/openrisc/kernel/entry.S
+++ b/arch/openrisc/kernel/entry.S
@@ -1071,15 +1071,15 @@ _fork_save_extra_regs_and_call:
1071 l.jr r29 1071 l.jr r29
1072 l.sw PT_GPR28(r1),r28 1072 l.sw PT_GPR28(r1),r28
1073 1073
1074ENTRY(sys_clone) 1074ENTRY(__sys_clone)
1075 l.movhi r29,hi(_sys_clone) 1075 l.movhi r29,hi(sys_clone)
1076 l.ori r29,r29,lo(_sys_clone) 1076 l.ori r29,r29,lo(sys_clone)
1077 l.j _fork_save_extra_regs_and_call 1077 l.j _fork_save_extra_regs_and_call
1078 l.addi r7,r1,0 1078 l.addi r7,r1,0
1079 1079
1080ENTRY(sys_fork) 1080ENTRY(__sys_fork)
1081 l.movhi r29,hi(_sys_fork) 1081 l.movhi r29,hi(sys_fork)
1082 l.ori r29,r29,lo(_sys_fork) 1082 l.ori r29,r29,lo(sys_fork)
1083 l.j _fork_save_extra_regs_and_call 1083 l.j _fork_save_extra_regs_and_call
1084 l.addi r3,r1,0 1084 l.addi r3,r1,0
1085 1085
diff --git a/arch/openrisc/kernel/process.c b/arch/openrisc/kernel/process.c
index e0874b8e09e4..6b853668369b 100644
--- a/arch/openrisc/kernel/process.c
+++ b/arch/openrisc/kernel/process.c
@@ -168,9 +168,10 @@ copy_thread(unsigned long clone_flags, unsigned long usp,
168 kregs->gpr[20] = usp; /* fn, kernel thread */ 168 kregs->gpr[20] = usp; /* fn, kernel thread */
169 kregs->gpr[22] = arg; 169 kregs->gpr[22] = arg;
170 } else { 170 } else {
171 *userregs = *regs; 171 *userregs = *current_pt_regs();
172 172
173 userregs->sp = usp; 173 if (usp)
174 userregs->sp = usp;
174 userregs->gpr[11] = 0; /* Result from fork() */ 175 userregs->gpr[11] = 0; /* Result from fork() */
175 176
176 kregs->gpr[20] = 0; /* Userspace thread */ 177 kregs->gpr[20] = 0; /* Userspace thread */
diff --git a/arch/openrisc/kernel/sys_or32.c b/arch/openrisc/kernel/sys_or32.c
deleted file mode 100644
index 57060084c0cc..000000000000
--- a/arch/openrisc/kernel/sys_or32.c
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 * OpenRISC sys_or32.c
3 *
4 * Linux architectural port borrowing liberally from similar works of
5 * others. All original copyrights apply as per the original source
6 * declaration.
7 *
8 * Modifications for the OpenRISC architecture:
9 * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
10 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
16 *
17 * This file contains various random system calls that
18 * have a non-standard calling sequence on some platforms.
19 * Since we don't have to do any backwards compatibility, our
20 * versions are done in the most "normal" way possible.
21 */
22
23#include <linux/errno.h>
24#include <linux/syscalls.h>
25#include <linux/mm.h>
26
27#include <asm/syscalls.h>
28
29/* These are secondary entry points as the primary entry points are defined in
30 * entry.S where we add the 'regs' parameter value
31 */
32
33asmlinkage long _sys_clone(unsigned long clone_flags, unsigned long newsp,
34 int __user *parent_tid, int __user *child_tid,
35 struct pt_regs *regs)
36{
37 long ret;
38
39 /* FIXME: Is alignment necessary? */
40 /* newsp = ALIGN(newsp, 4); */
41
42 if (!newsp)
43 newsp = regs->sp;
44
45 ret = do_fork(clone_flags, newsp, regs, 0, parent_tid, child_tid);
46
47 return ret;
48}
49
50asmlinkage int _sys_fork(struct pt_regs *regs)
51{
52#ifdef CONFIG_MMU
53 return do_fork(SIGCHLD, regs->sp, regs, 0, NULL, NULL);
54#else
55 return -EINVAL;
56#endif
57}