Commit 50150d2b authored by Al Viro's avatar Al Viro

mips: switch to generic sys_fork() and sys_clone()

we still need the wrappers to store callee-saved registers in
pt_regs, but once that done we can jump to kernel/fork.c variants.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 64b3122d
......@@ -41,6 +41,7 @@ config MIPS
select HAVE_MOD_ARCH_SPECIFIC
select MODULES_USE_ELF_REL if MODULES
select MODULES_USE_ELF_RELA if MODULES && 64BIT
select CLONE_BACKWARDS
select GENERIC_SIGALTSTACK
select GENERIC_COMPAT_RT_SIGACTION
select GENERIC_COMPAT_RT_SIGQUEUEINFO
......
......@@ -20,10 +20,10 @@
#define save_static_function(symbol) \
__asm__( \
".text\n\t" \
".globl\t" #symbol "\n\t" \
".globl\t__" #symbol "\n\t" \
".align\t2\n\t" \
".type\t" #symbol ", @function\n\t" \
".ent\t" #symbol ", 0\n" \
".type\t__" #symbol ", @function\n\t" \
".ent\t__" #symbol ", 0\n__" \
#symbol":\n\t" \
".frame\t$29, 0, $31\n\t" \
"sw\t$16,"__str(PT_R16)"($29)\t\t\t# save_static_function\n\t" \
......@@ -35,9 +35,9 @@ __asm__( \
"sw\t$22,"__str(PT_R22)"($29)\n\t" \
"sw\t$23,"__str(PT_R23)"($29)\n\t" \
"sw\t$30,"__str(PT_R30)"($29)\n\t" \
"j\t_" #symbol "\n\t" \
".end\t" #symbol "\n\t" \
".size\t" #symbol",. - " #symbol)
"j\t" #symbol "\n\t" \
".end\t__" #symbol "\n\t" \
".size\t__" #symbol",. - __" #symbol)
#define nabi_no_regargs
......@@ -48,10 +48,10 @@ __asm__( \
#define save_static_function(symbol) \
__asm__( \
".text\n\t" \
".globl\t" #symbol "\n\t" \
".globl\t__" #symbol "\n\t" \
".align\t2\n\t" \
".type\t" #symbol ", @function\n\t" \
".ent\t" #symbol ", 0\n" \
".type\t__" #symbol ", @function\n\t" \
".ent\t__" #symbol ", 0\n__" \
#symbol":\n\t" \
".frame\t$29, 0, $31\n\t" \
"sd\t$16,"__str(PT_R16)"($29)\t\t\t# save_static_function\n\t" \
......@@ -63,9 +63,9 @@ __asm__( \
"sd\t$22,"__str(PT_R22)"($29)\n\t" \
"sd\t$23,"__str(PT_R23)"($29)\n\t" \
"sd\t$30,"__str(PT_R30)"($29)\n\t" \
"j\t_" #symbol "\n\t" \
".end\t" #symbol "\n\t" \
".size\t" #symbol",. - " #symbol)
"j\t" #symbol "\n\t" \
".end\t__" #symbol "\n\t" \
".size\t__" #symbol",. - __" #symbol)
#define nabi_no_regargs \
unsigned long __dummy0, \
......
......@@ -43,6 +43,8 @@
# ifdef CONFIG_MIPS32_O32
# define __ARCH_WANT_COMPAT_SYS_TIME
# endif
#define __ARCH_WANT_SYS_FORK
#define __ARCH_WANT_SYS_CLONE
/* whitelists for checksyscalls */
#define __IGNORE_select
......
......@@ -279,25 +279,6 @@ asmlinkage long sys32_fallocate(int fd, int mode, unsigned offset_a2,
merge_64(len_a4, len_a5));
}
save_static_function(sys32_clone);
static int noinline __used
_sys32_clone(nabi_no_regargs struct pt_regs regs)
{
unsigned long clone_flags;
unsigned long newsp;
int __user *parent_tidptr, *child_tidptr;
clone_flags = regs.regs[4];
newsp = regs.regs[5];
parent_tidptr = (int __user *) regs.regs[6];
/* Use __dummy4 instead of getting it off the stack, so that
syscall() works. */
child_tidptr = (int __user *) __dummy4;
return do_fork(clone_flags, newsp, 0,
parent_tidptr, child_tidptr);
}
asmlinkage long sys32_lookup_dcookie(u32 a0, u32 a1, char __user *buf,
size_t len)
{
......
......@@ -226,7 +226,7 @@ einval: li v0, -ENOSYS
.macro syscalltable
sys sys_syscall 8 /* 4000 */
sys sys_exit 1
sys sys_fork 0
sys __sys_fork 0
sys sys_read 3
sys sys_write 3
sys sys_open 3 /* 4005 */
......@@ -344,7 +344,7 @@ einval: li v0, -ENOSYS
sys sys_ipc 6
sys sys_fsync 1
sys sys_sigreturn 0
sys sys_clone 0 /* 4120 */
sys __sys_clone 6 /* 4120 */
sys sys_setdomainname 2
sys sys_newuname 1
sys sys_ni_syscall 0 /* sys_modify_ldt */
......
......@@ -170,8 +170,8 @@ sys_call_table:
PTR sys_socketpair
PTR sys_setsockopt
PTR sys_getsockopt
PTR sys_clone /* 5055 */
PTR sys_fork
PTR __sys_clone /* 5055 */
PTR __sys_fork
PTR sys_execve
PTR sys_exit
PTR sys_wait4
......
......@@ -159,8 +159,8 @@ EXPORT(sysn32_call_table)
PTR sys_socketpair
PTR compat_sys_setsockopt
PTR sys_getsockopt
PTR sys_clone /* 6055 */
PTR sys_fork
PTR __sys_clone /* 6055 */
PTR __sys_fork
PTR compat_sys_execve
PTR sys_exit
PTR compat_sys_wait4
......
......@@ -194,7 +194,7 @@ einval: li v0, -ENOSYS
sys_call_table:
PTR sys32_syscall /* 4000 */
PTR sys_exit
PTR sys_fork
PTR __sys_fork
PTR sys_read
PTR sys_write
PTR compat_sys_open /* 4005 */
......@@ -312,7 +312,7 @@ sys_call_table:
PTR sys_32_ipc
PTR sys_fsync
PTR sys32_sigreturn
PTR sys32_clone /* 4120 */
PTR __sys_clone /* 4120 */
PTR sys_setdomainname
PTR sys_newuname
PTR sys_ni_syscall /* sys_modify_ldt */
......
......@@ -83,41 +83,7 @@ SYSCALL_DEFINE6(mips_mmap2, unsigned long, addr, unsigned long, len,
}
save_static_function(sys_fork);
static int __used noinline
_sys_fork(nabi_no_regargs struct pt_regs regs)
{
return do_fork(SIGCHLD, 0, 0, NULL, NULL);
}
save_static_function(sys_clone);
static int __used noinline
_sys_clone(nabi_no_regargs struct pt_regs regs)
{
unsigned long clone_flags;
unsigned long newsp;
int __user *parent_tidptr, *child_tidptr;
clone_flags = regs.regs[4];
newsp = regs.regs[5];
parent_tidptr = (int __user *) regs.regs[6];
#ifdef CONFIG_32BIT
/* We need to fetch the fifth argument off the stack. */
child_tidptr = NULL;
if (clone_flags & (CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID)) {
int __user *__user *usp = (int __user *__user *) regs.regs[29];
if (regs.regs[2] == __NR_syscall) {
if (get_user (child_tidptr, &usp[5]))
return -EFAULT;
}
else if (get_user (child_tidptr, &usp[4]))
return -EFAULT;
}
#else
child_tidptr = (int __user *) regs.regs[8];
#endif
return do_fork(clone_flags, newsp, 0,
parent_tidptr, child_tidptr);
}
SYSCALL_DEFINE1(set_thread_area, unsigned long, addr)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment