aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/syscall.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/kernel/syscall.c')
-rw-r--r--arch/mips/kernel/syscall.c73
1 files changed, 12 insertions, 61 deletions
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index 201cb76b4df9..b32466a1a1d2 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -46,20 +46,14 @@
46 * argument. Historically that used to be expensive in Linux. These days 46 * argument. Historically that used to be expensive in Linux. These days
47 * the performance advantage is negligible. 47 * the performance advantage is negligible.
48 */ 48 */
49asmlinkage int sysm_pipe(nabi_no_regargs volatile struct pt_regs regs) 49asmlinkage int sysm_pipe(void)
50{ 50{
51 int fd[2]; 51 int fd[2];
52 int error, res; 52 int error = do_pipe_flags(fd, 0);
53 53 if (error)
54 error = do_pipe_flags(fd, 0); 54 return error;
55 if (error) { 55 current_pt_regs()->regs[3] = fd[1];
56 res = error; 56 return fd[0];
57 goto out;
58 }
59 regs.regs[3] = fd[1];
60 res = fd[0];
61out:
62 return res;
63} 57}
64 58
65SYSCALL_DEFINE6(mips_mmap, unsigned long, addr, unsigned long, len, 59SYSCALL_DEFINE6(mips_mmap, unsigned long, addr, unsigned long, len,
@@ -89,43 +83,7 @@ SYSCALL_DEFINE6(mips_mmap2, unsigned long, addr, unsigned long, len,
89} 83}
90 84
91save_static_function(sys_fork); 85save_static_function(sys_fork);
92static int __used noinline
93_sys_fork(nabi_no_regargs struct pt_regs regs)
94{
95 return do_fork(SIGCHLD, regs.regs[29], 0, NULL, NULL);
96}
97
98save_static_function(sys_clone); 86save_static_function(sys_clone);
99static int __used noinline
100_sys_clone(nabi_no_regargs struct pt_regs regs)
101{
102 unsigned long clone_flags;
103 unsigned long newsp;
104 int __user *parent_tidptr, *child_tidptr;
105
106 clone_flags = regs.regs[4];
107 newsp = regs.regs[5];
108 if (!newsp)
109 newsp = regs.regs[29];
110 parent_tidptr = (int __user *) regs.regs[6];
111#ifdef CONFIG_32BIT
112 /* We need to fetch the fifth argument off the stack. */
113 child_tidptr = NULL;
114 if (clone_flags & (CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID)) {
115 int __user *__user *usp = (int __user *__user *) regs.regs[29];
116 if (regs.regs[2] == __NR_syscall) {
117 if (get_user (child_tidptr, &usp[5]))
118 return -EFAULT;
119 }
120 else if (get_user (child_tidptr, &usp[4]))
121 return -EFAULT;
122 }
123#else
124 child_tidptr = (int __user *) regs.regs[8];
125#endif
126 return do_fork(clone_flags, newsp, 0,
127 parent_tidptr, child_tidptr);
128}
129 87
130SYSCALL_DEFINE1(set_thread_area, unsigned long, addr) 88SYSCALL_DEFINE1(set_thread_area, unsigned long, addr)
131{ 89{
@@ -138,10 +96,10 @@ SYSCALL_DEFINE1(set_thread_area, unsigned long, addr)
138 return 0; 96 return 0;
139} 97}
140 98
141static inline int mips_atomic_set(struct pt_regs *regs, 99static inline int mips_atomic_set(unsigned long addr, unsigned long new)
142 unsigned long addr, unsigned long new)
143{ 100{
144 unsigned long old, tmp; 101 unsigned long old, tmp;
102 struct pt_regs *regs;
145 unsigned int err; 103 unsigned int err;
146 104
147 if (unlikely(addr & 3)) 105 if (unlikely(addr & 3))
@@ -222,6 +180,7 @@ static inline int mips_atomic_set(struct pt_regs *regs,
222 if (unlikely(err)) 180 if (unlikely(err))
223 return err; 181 return err;
224 182
183 regs = current_pt_regs();
225 regs->regs[2] = old; 184 regs->regs[2] = old;
226 regs->regs[7] = 0; /* No error */ 185 regs->regs[7] = 0; /* No error */
227 186
@@ -235,22 +194,14 @@ static inline int mips_atomic_set(struct pt_regs *regs,
235 : "r" (regs)); 194 : "r" (regs));
236 195
237 /* unreached. Honestly. */ 196 /* unreached. Honestly. */
238 while (1); 197 unreachable();
239} 198}
240 199
241save_static_function(sys_sysmips); 200SYSCALL_DEFINE3(sysmips, long, cmd, long, arg1, long, arg2)
242static int __used noinline
243_sys_sysmips(nabi_no_regargs struct pt_regs regs)
244{ 201{
245 long cmd, arg1, arg2;
246
247 cmd = regs.regs[4];
248 arg1 = regs.regs[5];
249 arg2 = regs.regs[6];
250
251 switch (cmd) { 202 switch (cmd) {
252 case MIPS_ATOMIC_SET: 203 case MIPS_ATOMIC_SET:
253 return mips_atomic_set(&regs, arg1, arg2); 204 return mips_atomic_set(arg1, arg2);
254 205
255 case MIPS_FIXADE: 206 case MIPS_FIXADE:
256 if (arg1 & ~3) 207 if (arg1 & ~3)