]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - arch/mips/kernel/syscall.c
Merge branch 'sfc-3.9' into master
[karo-tx-linux.git] / arch / mips / kernel / syscall.c
index 201cb76b4df9d85abf01e2d45aea5b941a612378..b79d13f95bf01b5d666e18fa22caf0ff66e0188b 100644 (file)
 
 /*
  * For historic reasons the pipe(2) syscall on MIPS has an unusual calling
- * convention.  It returns results in registers $v0 / $v1 which means there
+ * convention. It returns results in registers $v0 / $v1 which means there
  * is no need for it to do verify the validity of a userspace pointer
- * argument.  Historically that used to be expensive in Linux.  These days
+ * argument.  Historically that used to be expensive in Linux. These days
  * the performance advantage is negligible.
  */
-asmlinkage int sysm_pipe(nabi_no_regargs volatile struct pt_regs regs)
+asmlinkage int sysm_pipe(void)
 {
        int fd[2];
-       int error, res;
-
-       error = do_pipe_flags(fd, 0);
-       if (error) {
-               res = error;
-               goto out;
-       }
-       regs.regs[3] = fd[1];
-       res = fd[0];
-out:
-       return res;
+       int error = do_pipe_flags(fd, 0);
+       if (error)
+               return error;
+       current_pt_regs()->regs[3] = fd[1];
+       return fd[0];
 }
 
 SYSCALL_DEFINE6(mips_mmap, unsigned long, addr, unsigned long, len,
@@ -89,43 +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, regs.regs[29], 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];
-       if (!newsp)
-               newsp = regs.regs[29];
-       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)
 {
@@ -138,10 +96,10 @@ SYSCALL_DEFINE1(set_thread_area, unsigned long, addr)
        return 0;
 }
 
-static inline int mips_atomic_set(struct pt_regs *regs,
-       unsigned long addr, unsigned long new)
+static inline int mips_atomic_set(unsigned long addr, unsigned long new)
 {
        unsigned long old, tmp;
+       struct pt_regs *regs;
        unsigned int err;
 
        if (unlikely(addr & 3))
@@ -222,6 +180,7 @@ static inline int mips_atomic_set(struct pt_regs *regs,
        if (unlikely(err))
                return err;
 
+       regs = current_pt_regs();
        regs->regs[2] = old;
        regs->regs[7] = 0;      /* No error */
 
@@ -235,22 +194,14 @@ static inline int mips_atomic_set(struct pt_regs *regs,
        : "r" (regs));
 
        /* unreached.  Honestly.  */
-       while (1);
+       unreachable();
 }
 
-save_static_function(sys_sysmips);
-static int __used noinline
-_sys_sysmips(nabi_no_regargs struct pt_regs regs)
+SYSCALL_DEFINE3(sysmips, long, cmd, long, arg1, long, arg2)
 {
-       long cmd, arg1, arg2;
-
-       cmd = regs.regs[4];
-       arg1 = regs.regs[5];
-       arg2 = regs.regs[6];
-
        switch (cmd) {
        case MIPS_ATOMIC_SET:
-               return mips_atomic_set(&regs, arg1, arg2);
+               return mips_atomic_set(arg1, arg2);
 
        case MIPS_FIXADE:
                if (arg1 & ~3)