aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/kernel/process.c5
-rw-r--r--arch/mips/kernel/scall32-o32.S17
-rw-r--r--arch/mips/kernel/scall64-64.S17
-rw-r--r--arch/mips/kernel/scall64-n32.S17
-rw-r--r--arch/mips/kernel/scall64-o32.S17
-rw-r--r--arch/mips/kernel/signal.c88
-rw-r--r--arch/mips/kernel/signal32.c8
-rw-r--r--arch/mips/kernel/signal_n32.c4
-rw-r--r--arch/mips/kernel/syscall.c48
-rw-r--r--include/asm-mips/abi.h4
-rw-r--r--include/asm-mips/io.h2
-rw-r--r--include/asm-mips/thread_info.h2
-rw-r--r--include/asm-mips/unistd.h64
13 files changed, 215 insertions, 78 deletions
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index fa98f10d0132..5232fc752935 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -4,6 +4,7 @@
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 1994 - 1999, 2000 by Ralf Baechle and others. 6 * Copyright (C) 1994 - 1999, 2000 by Ralf Baechle and others.
7 * Copyright (C) 2005, 2006 by Ralf Baechle (ralf@linux-mips.org)
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 * Copyright (C) 2004 Thiemo Seufer 9 * Copyright (C) 2004 Thiemo Seufer
9 */ 10 */
@@ -58,8 +59,8 @@ ATTRIB_NORET void cpu_idle(void)
58 } 59 }
59} 60}
60 61
61extern int do_signal(sigset_t *oldset, struct pt_regs *regs); 62extern void do_signal(struct pt_regs *regs);
62extern int do_signal32(sigset_t *oldset, struct pt_regs *regs); 63extern void do_signal32(struct pt_regs *regs);
63 64
64/* 65/*
65 * Native o32 and N64 ABI without DSP ASE 66 * Native o32 and N64 ABI without DSP ASE
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index a42e0e8caa7b..d7c4a38ed5ae 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -617,6 +617,23 @@ einval: li v0, -EINVAL
617 sys sys_inotify_init 0 617 sys sys_inotify_init 0
618 sys sys_inotify_add_watch 3 /* 4285 */ 618 sys sys_inotify_add_watch 3 /* 4285 */
619 sys sys_inotify_rm_watch 2 619 sys sys_inotify_rm_watch 2
620 sys sys_migrate_pages 4
621 sys sys_openat 4
622 sys sys_mkdirat 3
623 sys sys_mknodat 4 /* 4290 */
624 sys sys_fchownat 5
625 sys sys_futimesat 3
626 sys sys_newfstatat 4
627 sys sys_unlinkat 3
628 sys sys_renameat 4 /* 4295 */
629 sys sys_linkat 4
630 sys sys_symlinkat 3
631 sys sys_readlinkat 4
632 sys sys_fchmodat 3
633 sys sys_faccessat 3 /* 4300 */
634 sys sys_pselect6 6
635 sys sys_ppoll 5
636 sys sys_unshare 1
620 .endm 637 .endm
621 638
622 /* We pre-compute the number of _instruction_ bytes needed to 639 /* We pre-compute the number of _instruction_ bytes needed to
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index 47bfbd416709..98bf25df56f3 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -443,3 +443,20 @@ sys_call_table:
443 PTR sys_inotify_init 443 PTR sys_inotify_init
444 PTR sys_inotify_add_watch 444 PTR sys_inotify_add_watch
445 PTR sys_inotify_rm_watch /* 5245 */ 445 PTR sys_inotify_rm_watch /* 5245 */
446 PTR sys_migrate_pages
447 PTR sys_openat
448 PTR sys_mkdirat
449 PTR sys_mknodat
450 PTR sys_fchownat /* 5250 */
451 PTR sys_futimesat
452 PTR sys_newfstatat
453 PTR sys_unlinkat
454 PTR sys_renameat
455 PTR sys_linkat /* 5255 */
456 PTR sys_symlinkat
457 PTR sys_readlinkat
458 PTR sys_fchmodat
459 PTR sys_faccessat
460 PTR sys_pselect6 /* 5260 */
461 PTR sys_ppoll
462 PTR sys_unshare
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index b465ced1758f..bc4980cefc8b 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -369,3 +369,20 @@ EXPORT(sysn32_call_table)
369 PTR sys_inotify_init 369 PTR sys_inotify_init
370 PTR sys_inotify_add_watch 370 PTR sys_inotify_add_watch
371 PTR sys_inotify_rm_watch 371 PTR sys_inotify_rm_watch
372 PTR sys_migrate_pages /* 6250 */
373 PTR sys_openat
374 PTR sys_mkdirat
375 PTR sys_mknodat
376 PTR sys_fchownat
377 PTR sys_futimesat /* 6255 */
378 PTR sys_newfstatat
379 PTR sys_unlinkat
380 PTR sys_renameat
381 PTR sys_linkat
382 PTR sys_symlinkat /* 6260 */
383 PTR sys_readlinkat
384 PTR sys_fchmodat
385 PTR sys_faccessat
386 PTR sys_pselect6
387 PTR sys_ppoll /* 6265 */
388 PTR sys_unshare
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 3d338ca7eeeb..5b0414018c9a 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -491,4 +491,21 @@ sys_call_table:
491 PTR sys_inotify_init 491 PTR sys_inotify_init
492 PTR sys_inotify_add_watch /* 4285 */ 492 PTR sys_inotify_add_watch /* 4285 */
493 PTR sys_inotify_rm_watch 493 PTR sys_inotify_rm_watch
494 PTR sys_migrate_pages
495 PTR compat_sys_openat
496 PTR sys_mkdirat
497 PTR sys_mknodat /* 4290 */
498 PTR sys_fchownat
499 PTR compat_sys_futimesat
500 PTR compat_sys_newfstatat
501 PTR sys_unlinkat
502 PTR sys_renameat /* 4295 */
503 PTR sys_linkat
504 PTR sys_symlinkat
505 PTR sys_readlinkat
506 PTR sys_fchmodat
507 PTR sys_faccessat /* 4300 */
508 PTR sys_pselect6
509 PTR sys_ppoll
510 PTR sys_unshare
494 .size sys_call_table,.-sys_call_table 511 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index aaec4785e9a6..c974cc9b30eb 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -39,8 +39,6 @@
39 39
40#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 40#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
41 41
42int do_signal(sigset_t *oldset, struct pt_regs *regs);
43
44/* 42/*
45 * Atomically swap in the new signal mask, and wait for a signal. 43 * Atomically swap in the new signal mask, and wait for a signal.
46 */ 44 */
@@ -50,7 +48,7 @@ save_static_function(sys_sigsuspend);
50__attribute_used__ noinline static int 48__attribute_used__ noinline static int
51_sys_sigsuspend(nabi_no_regargs struct pt_regs regs) 49_sys_sigsuspend(nabi_no_regargs struct pt_regs regs)
52{ 50{
53 sigset_t saveset, newset; 51 sigset_t newset;
54 sigset_t __user *uset; 52 sigset_t __user *uset;
55 53
56 uset = (sigset_t __user *) regs.regs[4]; 54 uset = (sigset_t __user *) regs.regs[4];
@@ -59,19 +57,15 @@ _sys_sigsuspend(nabi_no_regargs struct pt_regs regs)
59 sigdelsetmask(&newset, ~_BLOCKABLE); 57 sigdelsetmask(&newset, ~_BLOCKABLE);
60 58
61 spin_lock_irq(&current->sighand->siglock); 59 spin_lock_irq(&current->sighand->siglock);
62 saveset = current->blocked; 60 current->saved_sigmask = current->blocked;
63 current->blocked = newset; 61 current->blocked = newset;
64 recalc_sigpending(); 62 recalc_sigpending();
65 spin_unlock_irq(&current->sighand->siglock); 63 spin_unlock_irq(&current->sighand->siglock);
66 64
67 regs.regs[2] = EINTR; 65 current->state = TASK_INTERRUPTIBLE;
68 regs.regs[7] = 1; 66 schedule();
69 while (1) { 67 set_thread_flag(TIF_RESTORE_SIGMASK);
70 current->state = TASK_INTERRUPTIBLE; 68 return -ERESTARTNOHAND;
71 schedule();
72 if (do_signal(&saveset, &regs))
73 return -EINTR;
74 }
75} 69}
76#endif 70#endif
77 71
@@ -79,7 +73,7 @@ save_static_function(sys_rt_sigsuspend);
79__attribute_used__ noinline static int 73__attribute_used__ noinline static int
80_sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) 74_sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
81{ 75{
82 sigset_t saveset, newset; 76 sigset_t newset;
83 sigset_t __user *unewset; 77 sigset_t __user *unewset;
84 size_t sigsetsize; 78 size_t sigsetsize;
85 79
@@ -94,19 +88,15 @@ _sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
94 sigdelsetmask(&newset, ~_BLOCKABLE); 88 sigdelsetmask(&newset, ~_BLOCKABLE);
95 89
96 spin_lock_irq(&current->sighand->siglock); 90 spin_lock_irq(&current->sighand->siglock);
97 saveset = current->blocked; 91 current->saved_sigmask = current->blocked;
98 current->blocked = newset; 92 current->blocked = newset;
99 recalc_sigpending(); 93 recalc_sigpending();
100 spin_unlock_irq(&current->sighand->siglock); 94 spin_unlock_irq(&current->sighand->siglock);
101 95
102 regs.regs[2] = EINTR; 96 current->state = TASK_INTERRUPTIBLE;
103 regs.regs[7] = 1; 97 schedule();
104 while (1) { 98 set_thread_flag(TIF_RESTORE_SIGMASK);
105 current->state = TASK_INTERRUPTIBLE; 99 return -ERESTARTNOHAND;
106 schedule();
107 if (do_signal(&saveset, &regs))
108 return -EINTR;
109 }
110} 100}
111 101
112#ifdef CONFIG_TRAD_SIGNALS 102#ifdef CONFIG_TRAD_SIGNALS
@@ -315,11 +305,11 @@ int setup_frame(struct k_sigaction * ka, struct pt_regs *regs,
315 current->comm, current->pid, 305 current->comm, current->pid,
316 frame, regs->cp0_epc, frame->regs[31]); 306 frame, regs->cp0_epc, frame->regs[31]);
317#endif 307#endif
318 return 1; 308 return 0;
319 309
320give_sigsegv: 310give_sigsegv:
321 force_sigsegv(signr, current); 311 force_sigsegv(signr, current);
322 return 0; 312 return -EFAULT;
323} 313}
324#endif 314#endif
325 315
@@ -375,11 +365,11 @@ int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs,
375 current->comm, current->pid, 365 current->comm, current->pid,
376 frame, regs->cp0_epc, regs->regs[31]); 366 frame, regs->cp0_epc, regs->regs[31]);
377#endif 367#endif
378 return 1; 368 return 0;
379 369
380give_sigsegv: 370give_sigsegv:
381 force_sigsegv(signr, current); 371 force_sigsegv(signr, current);
382 return 0; 372 return -EFAULT;
383} 373}
384 374
385static inline int handle_signal(unsigned long sig, siginfo_t *info, 375static inline int handle_signal(unsigned long sig, siginfo_t *info,
@@ -393,7 +383,7 @@ static inline int handle_signal(unsigned long sig, siginfo_t *info,
393 regs->regs[2] = EINTR; 383 regs->regs[2] = EINTR;
394 break; 384 break;
395 case ERESTARTSYS: 385 case ERESTARTSYS:
396 if(!(ka->sa.sa_flags & SA_RESTART)) { 386 if (!(ka->sa.sa_flags & SA_RESTART)) {
397 regs->regs[2] = EINTR; 387 regs->regs[2] = EINTR;
398 break; 388 break;
399 } 389 }
@@ -420,9 +410,10 @@ static inline int handle_signal(unsigned long sig, siginfo_t *info,
420 return ret; 410 return ret;
421} 411}
422 412
423int do_signal(sigset_t *oldset, struct pt_regs *regs) 413void do_signal(struct pt_regs *regs)
424{ 414{
425 struct k_sigaction ka; 415 struct k_sigaction ka;
416 sigset_t *oldset;
426 siginfo_t info; 417 siginfo_t info;
427 int signr; 418 int signr;
428 419
@@ -432,17 +423,31 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
432 * if so. 423 * if so.
433 */ 424 */
434 if (!user_mode(regs)) 425 if (!user_mode(regs))
435 return 1; 426 return;
436 427
437 if (try_to_freeze()) 428 if (try_to_freeze())
438 goto no_signal; 429 goto no_signal;
439 430
440 if (!oldset) 431 if (test_thread_flag(TIF_RESTORE_SIGMASK))
432 oldset = &current->saved_sigmask;
433 else
441 oldset = &current->blocked; 434 oldset = &current->blocked;
442 435
436
443 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 437 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
444 if (signr > 0) 438 if (signr > 0) {
445 return handle_signal(signr, &info, &ka, oldset, regs); 439 /* Whee! Actually deliver the signal. */
440 if (handle_signal(signr, &info, &ka, oldset, regs) == 0) {
441 /*
442 * A signal was successfully delivered; the saved
443 * sigmask will have been stored in the signal frame,
444 * and will be restored by sigreturn, so we can simply
445 * clear the TIF_RESTORE_SIGMASK flag.
446 */
447 if (test_thread_flag(TIF_RESTORE_SIGMASK))
448 clear_thread_flag(TIF_RESTORE_SIGMASK);
449 }
450 }
446 451
447no_signal: 452no_signal:
448 /* 453 /*
@@ -463,18 +468,25 @@ no_signal:
463 regs->cp0_epc -= 4; 468 regs->cp0_epc -= 4;
464 } 469 }
465 } 470 }
466 return 0; 471
472 /*
473 * If there's no signal to deliver, we just put the saved sigmask
474 * back
475 */
476 if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
477 clear_thread_flag(TIF_RESTORE_SIGMASK);
478 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
479 }
467} 480}
468 481
469/* 482/*
470 * notification of userspace execution resumption 483 * notification of userspace execution resumption
471 * - triggered by current->work.notify_resume 484 * - triggered by the TIF_WORK_MASK flags
472 */ 485 */
473asmlinkage void do_notify_resume(struct pt_regs *regs, sigset_t *oldset, 486asmlinkage void do_notify_resume(struct pt_regs *regs, void *unused,
474 __u32 thread_info_flags) 487 __u32 thread_info_flags)
475{ 488{
476 /* deal with pending signal delivery */ 489 /* deal with pending signal delivery */
477 if (thread_info_flags & _TIF_SIGPENDING) { 490 if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK))
478 current->thread.abi->do_signal(oldset, regs); 491 current->thread.abi->do_signal(regs);
479 }
480} 492}
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index 136260c8f756..da3271e1fdac 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -694,11 +694,11 @@ int setup_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
694 current->comm, current->pid, 694 current->comm, current->pid,
695 frame, regs->cp0_epc, frame->sf_code); 695 frame, regs->cp0_epc, frame->sf_code);
696#endif 696#endif
697 return 1; 697 return 0;
698 698
699give_sigsegv: 699give_sigsegv:
700 force_sigsegv(signr, current); 700 force_sigsegv(signr, current);
701 return 0; 701 return -EFAULT;
702} 702}
703 703
704int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs, 704int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
@@ -765,11 +765,11 @@ int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
765 current->comm, current->pid, 765 current->comm, current->pid,
766 frame, regs->cp0_epc, frame->rs_code); 766 frame, regs->cp0_epc, frame->rs_code);
767#endif 767#endif
768 return 1; 768 return 0;
769 769
770give_sigsegv: 770give_sigsegv:
771 force_sigsegv(signr, current); 771 force_sigsegv(signr, current);
772 return 0; 772 return -EFAULT;
773} 773}
774 774
775static inline int handle_signal(unsigned long sig, siginfo_t *info, 775static inline int handle_signal(unsigned long sig, siginfo_t *info,
diff --git a/arch/mips/kernel/signal_n32.c b/arch/mips/kernel/signal_n32.c
index 9156863c1a5d..384fc4a639a4 100644
--- a/arch/mips/kernel/signal_n32.c
+++ b/arch/mips/kernel/signal_n32.c
@@ -186,9 +186,9 @@ int setup_rt_frame_n32(struct k_sigaction * ka,
186 current->comm, current->pid, 186 current->comm, current->pid,
187 frame, regs->cp0_epc, regs->regs[31]); 187 frame, regs->cp0_epc, regs->regs[31]);
188#endif 188#endif
189 return 1; 189 return 0;
190 190
191give_sigsegv: 191give_sigsegv:
192 force_sigsegv(signr, current); 192 force_sigsegv(signr, current);
193 return 0; 193 return -EFAULT;
194} 194}
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index 332358430ff5..1da2eeb3ef9e 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -212,12 +212,12 @@ asmlinkage int sys_execve(nabi_no_regargs struct pt_regs regs)
212 int error; 212 int error;
213 char * filename; 213 char * filename;
214 214
215 filename = getname((char *) (long)regs.regs[4]); 215 filename = getname((char __user *) (long)regs.regs[4]);
216 error = PTR_ERR(filename); 216 error = PTR_ERR(filename);
217 if (IS_ERR(filename)) 217 if (IS_ERR(filename))
218 goto out; 218 goto out;
219 error = do_execve(filename, (char **) (long)regs.regs[5], 219 error = do_execve(filename, (char __user *__user *) (long)regs.regs[5],
220 (char **) (long)regs.regs[6], &regs); 220 (char __user *__user *) (long)regs.regs[6], &regs);
221 putname(filename); 221 putname(filename);
222 222
223out: 223out:
@@ -227,7 +227,7 @@ out:
227/* 227/*
228 * Compacrapability ... 228 * Compacrapability ...
229 */ 229 */
230asmlinkage int sys_uname(struct old_utsname * name) 230asmlinkage int sys_uname(struct old_utsname __user * name)
231{ 231{
232 if (name && !copy_to_user(name, &system_utsname, sizeof (*name))) 232 if (name && !copy_to_user(name, &system_utsname, sizeof (*name)))
233 return 0; 233 return 0;
@@ -237,7 +237,7 @@ asmlinkage int sys_uname(struct old_utsname * name)
237/* 237/*
238 * Compacrapability ... 238 * Compacrapability ...
239 */ 239 */
240asmlinkage int sys_olduname(struct oldold_utsname * name) 240asmlinkage int sys_olduname(struct oldold_utsname __user * name)
241{ 241{
242 int error; 242 int error;
243 243
@@ -274,7 +274,7 @@ void sys_set_thread_area(unsigned long addr)
274asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3) 274asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3)
275{ 275{
276 int tmp, len; 276 int tmp, len;
277 char *name; 277 char __user *name;
278 278
279 switch(cmd) { 279 switch(cmd) {
280 case SETNAME: { 280 case SETNAME: {
@@ -283,7 +283,7 @@ asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3)
283 if (!capable(CAP_SYS_ADMIN)) 283 if (!capable(CAP_SYS_ADMIN))
284 return -EPERM; 284 return -EPERM;
285 285
286 name = (char *) arg1; 286 name = (char __user *) arg1;
287 287
288 len = strncpy_from_user(nodename, name, __NEW_UTS_LEN); 288 len = strncpy_from_user(nodename, name, __NEW_UTS_LEN);
289 if (len < 0) 289 if (len < 0)
@@ -324,7 +324,7 @@ asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3)
324 * This is really horribly ugly. 324 * This is really horribly ugly.
325 */ 325 */
326asmlinkage int sys_ipc (uint call, int first, int second, 326asmlinkage int sys_ipc (uint call, int first, int second,
327 unsigned long third, void *ptr, long fifth) 327 unsigned long third, void __user *ptr, long fifth)
328{ 328{
329 int version, ret; 329 int version, ret;
330 330
@@ -333,24 +333,25 @@ asmlinkage int sys_ipc (uint call, int first, int second,
333 333
334 switch (call) { 334 switch (call) {
335 case SEMOP: 335 case SEMOP:
336 return sys_semtimedop (first, (struct sembuf *)ptr, second, 336 return sys_semtimedop (first, (struct sembuf __user *)ptr,
337 NULL); 337 second, NULL);
338 case SEMTIMEDOP: 338 case SEMTIMEDOP:
339 return sys_semtimedop (first, (struct sembuf *)ptr, second, 339 return sys_semtimedop (first, (struct sembuf __user *)ptr,
340 (const struct timespec __user *)fifth); 340 second,
341 (const struct timespec __user *)fifth);
341 case SEMGET: 342 case SEMGET:
342 return sys_semget (first, second, third); 343 return sys_semget (first, second, third);
343 case SEMCTL: { 344 case SEMCTL: {
344 union semun fourth; 345 union semun fourth;
345 if (!ptr) 346 if (!ptr)
346 return -EINVAL; 347 return -EINVAL;
347 if (get_user(fourth.__pad, (void **) ptr)) 348 if (get_user(fourth.__pad, (void *__user *) ptr))
348 return -EFAULT; 349 return -EFAULT;
349 return sys_semctl (first, second, third, fourth); 350 return sys_semctl (first, second, third, fourth);
350 } 351 }
351 352
352 case MSGSND: 353 case MSGSND:
353 return sys_msgsnd (first, (struct msgbuf *) ptr, 354 return sys_msgsnd (first, (struct msgbuf __user *) ptr,
354 second, third); 355 second, third);
355 case MSGRCV: 356 case MSGRCV:
356 switch (version) { 357 switch (version) {
@@ -360,7 +361,7 @@ asmlinkage int sys_ipc (uint call, int first, int second,
360 return -EINVAL; 361 return -EINVAL;
361 362
362 if (copy_from_user(&tmp, 363 if (copy_from_user(&tmp,
363 (struct ipc_kludge *) ptr, 364 (struct ipc_kludge __user *) ptr,
364 sizeof (tmp))) 365 sizeof (tmp)))
365 return -EFAULT; 366 return -EFAULT;
366 return sys_msgrcv (first, tmp.msgp, second, 367 return sys_msgrcv (first, tmp.msgp, second,
@@ -368,35 +369,38 @@ asmlinkage int sys_ipc (uint call, int first, int second,
368 } 369 }
369 default: 370 default:
370 return sys_msgrcv (first, 371 return sys_msgrcv (first,
371 (struct msgbuf *) ptr, 372 (struct msgbuf __user *) ptr,
372 second, fifth, third); 373 second, fifth, third);
373 } 374 }
374 case MSGGET: 375 case MSGGET:
375 return sys_msgget ((key_t) first, second); 376 return sys_msgget ((key_t) first, second);
376 case MSGCTL: 377 case MSGCTL:
377 return sys_msgctl (first, second, (struct msqid_ds *) ptr); 378 return sys_msgctl (first, second,
379 (struct msqid_ds __user *) ptr);
378 380
379 case SHMAT: 381 case SHMAT:
380 switch (version) { 382 switch (version) {
381 default: { 383 default: {
382 ulong raddr; 384 ulong raddr;
383 ret = do_shmat (first, (char *) ptr, second, &raddr); 385 ret = do_shmat (first, (char __user *) ptr, second,
386 &raddr);
384 if (ret) 387 if (ret)
385 return ret; 388 return ret;
386 return put_user (raddr, (ulong *) third); 389 return put_user (raddr, (ulong __user *) third);
387 } 390 }
388 case 1: /* iBCS2 emulator entry point */ 391 case 1: /* iBCS2 emulator entry point */
389 if (!segment_eq(get_fs(), get_ds())) 392 if (!segment_eq(get_fs(), get_ds()))
390 return -EINVAL; 393 return -EINVAL;
391 return do_shmat (first, (char *) ptr, second, (ulong *) third); 394 return do_shmat (first, (char __user *) ptr, second,
395 (ulong *) third);
392 } 396 }
393 case SHMDT: 397 case SHMDT:
394 return sys_shmdt ((char *)ptr); 398 return sys_shmdt ((char __user *)ptr);
395 case SHMGET: 399 case SHMGET:
396 return sys_shmget (first, second, third); 400 return sys_shmget (first, second, third);
397 case SHMCTL: 401 case SHMCTL:
398 return sys_shmctl (first, second, 402 return sys_shmctl (first, second,
399 (struct shmid_ds *) ptr); 403 (struct shmid_ds __user *) ptr);
400 default: 404 default:
401 return -ENOSYS; 405 return -ENOSYS;
402 } 406 }
diff --git a/include/asm-mips/abi.h b/include/asm-mips/abi.h
index 2e7e651c3e3f..1ce0518ace2e 100644
--- a/include/asm-mips/abi.h
+++ b/include/asm-mips/abi.h
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2005 by Ralf Baechle 6 * Copyright (C) 2005, 06 by Ralf Baechle (ralf@linux-mips.org)
7 * Copyright (C) 2005 MIPS Technologies, Inc. 7 * Copyright (C) 2005 MIPS Technologies, Inc.
8 */ 8 */
9#ifndef _ASM_ABI_H 9#ifndef _ASM_ABI_H
@@ -13,7 +13,7 @@
13#include <asm/siginfo.h> 13#include <asm/siginfo.h>
14 14
15struct mips_abi { 15struct mips_abi {
16 int (* const do_signal)(sigset_t *oldset, struct pt_regs *regs); 16 void (* const do_signal)(struct pt_regs *regs);
17 int (* const setup_frame)(struct k_sigaction * ka, 17 int (* const setup_frame)(struct k_sigaction * ka,
18 struct pt_regs *regs, int signr, 18 struct pt_regs *regs, int signr,
19 sigset_t *set); 19 sigset_t *set);
diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
index 6c0aae5151a6..5a4c8a54b8f4 100644
--- a/include/asm-mips/io.h
+++ b/include/asm-mips/io.h
@@ -342,7 +342,7 @@ static inline void pfx##write##bwlq(type val, \
342 BUG(); \ 342 BUG(); \
343} \ 343} \
344 \ 344 \
345static inline type pfx##read##bwlq(volatile void __iomem *mem) \ 345static inline type pfx##read##bwlq(const volatile void __iomem *mem) \
346{ \ 346{ \
347 volatile type *__mem; \ 347 volatile type *__mem; \
348 type __val; \ 348 type __val; \
diff --git a/include/asm-mips/thread_info.h b/include/asm-mips/thread_info.h
index 1612b3fe1080..fa193f861e71 100644
--- a/include/asm-mips/thread_info.h
+++ b/include/asm-mips/thread_info.h
@@ -114,6 +114,7 @@ register struct thread_info *__current_thread_info __asm__("$28");
114#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ 114#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
115#define TIF_SYSCALL_AUDIT 4 /* syscall auditing active */ 115#define TIF_SYSCALL_AUDIT 4 /* syscall auditing active */
116#define TIF_SECCOMP 5 /* secure computing */ 116#define TIF_SECCOMP 5 /* secure computing */
117#define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */
117#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ 118#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */
118#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 119#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */
119#define TIF_MEMDIE 18 120#define TIF_MEMDIE 18
@@ -125,6 +126,7 @@ register struct thread_info *__current_thread_info __asm__("$28");
125#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 126#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
126#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 127#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
127#define _TIF_SECCOMP (1<<TIF_SECCOMP) 128#define _TIF_SECCOMP (1<<TIF_SECCOMP)
129#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
128#define _TIF_USEDFPU (1<<TIF_USEDFPU) 130#define _TIF_USEDFPU (1<<TIF_USEDFPU)
129#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 131#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
130 132
diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h
index 89ea8b60e945..e7ff9b187783 100644
--- a/include/asm-mips/unistd.h
+++ b/include/asm-mips/unistd.h
@@ -307,17 +307,33 @@
307#define __NR_inotify_init (__NR_Linux + 284) 307#define __NR_inotify_init (__NR_Linux + 284)
308#define __NR_inotify_add_watch (__NR_Linux + 285) 308#define __NR_inotify_add_watch (__NR_Linux + 285)
309#define __NR_inotify_rm_watch (__NR_Linux + 286) 309#define __NR_inotify_rm_watch (__NR_Linux + 286)
310 310#define __NR_migrate_pages (__NR_Linux + 287)
311#define __NR_openat (__NR_Linux + 288)
312#define __NR_mkdirat (__NR_Linux + 289)
313#define __NR_mknodat (__NR_Linux + 290)
314#define __NR_fchownat (__NR_Linux + 291)
315#define __NR_futimesat (__NR_Linux + 292)
316#define __NR_newfstatat (__NR_Linux + 293)
317#define __NR_unlinkat (__NR_Linux + 294)
318#define __NR_renameat (__NR_Linux + 295)
319#define __NR_linkat (__NR_Linux + 296)
320#define __NR_symlinkat (__NR_Linux + 297)
321#define __NR_readlinkat (__NR_Linux + 298)
322#define __NR_fchmodat (__NR_Linux + 299)
323#define __NR_faccessat (__NR_Linux + 300)
324#define __NR_pselect6 (__NR_Linux + 301)
325#define __NR_ppoll (__NR_Linux + 302)
326#define __NR_unshare (__NR_Linux + 303)
311 327
312/* 328/*
313 * Offset of the last Linux o32 flavoured syscall 329 * Offset of the last Linux o32 flavoured syscall
314 */ 330 */
315#define __NR_Linux_syscalls 286 331#define __NR_Linux_syscalls 303
316 332
317#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 333#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
318 334
319#define __NR_O32_Linux 4000 335#define __NR_O32_Linux 4000
320#define __NR_O32_Linux_syscalls 283 336#define __NR_O32_Linux_syscalls 303
321 337
322#if _MIPS_SIM == _MIPS_SIM_ABI64 338#if _MIPS_SIM == _MIPS_SIM_ABI64
323 339
@@ -571,16 +587,33 @@
571#define __NR_inotify_init (__NR_Linux + 243) 587#define __NR_inotify_init (__NR_Linux + 243)
572#define __NR_inotify_add_watch (__NR_Linux + 244) 588#define __NR_inotify_add_watch (__NR_Linux + 244)
573#define __NR_inotify_rm_watch (__NR_Linux + 245) 589#define __NR_inotify_rm_watch (__NR_Linux + 245)
590#define __NR_migrate_pages (__NR_Linux + 246)
591#define __NR_openat (__NR_Linux + 247)
592#define __NR_mkdirat (__NR_Linux + 248)
593#define __NR_mknodat (__NR_Linux + 249)
594#define __NR_fchownat (__NR_Linux + 250)
595#define __NR_futimesat (__NR_Linux + 251)
596#define __NR_newfstatat (__NR_Linux + 252)
597#define __NR_unlinkat (__NR_Linux + 253)
598#define __NR_renameat (__NR_Linux + 254)
599#define __NR_linkat (__NR_Linux + 255)
600#define __NR_symlinkat (__NR_Linux + 256)
601#define __NR_readlinkat (__NR_Linux + 257)
602#define __NR_fchmodat (__NR_Linux + 258)
603#define __NR_faccessat (__NR_Linux + 259)
604#define __NR_pselect6 (__NR_Linux + 260)
605#define __NR_ppoll (__NR_Linux + 261)
606#define __NR_unshare (__NR_Linux + 262)
574 607
575/* 608/*
576 * Offset of the last Linux 64-bit flavoured syscall 609 * Offset of the last Linux 64-bit flavoured syscall
577 */ 610 */
578#define __NR_Linux_syscalls 245 611#define __NR_Linux_syscalls 262
579 612
580#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ 613#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
581 614
582#define __NR_64_Linux 5000 615#define __NR_64_Linux 5000
583#define __NR_64_Linux_syscalls 242 616#define __NR_64_Linux_syscalls 262
584 617
585#if _MIPS_SIM == _MIPS_SIM_NABI32 618#if _MIPS_SIM == _MIPS_SIM_NABI32
586 619
@@ -838,16 +871,33 @@
838#define __NR_inotify_init (__NR_Linux + 247) 871#define __NR_inotify_init (__NR_Linux + 247)
839#define __NR_inotify_add_watch (__NR_Linux + 248) 872#define __NR_inotify_add_watch (__NR_Linux + 248)
840#define __NR_inotify_rm_watch (__NR_Linux + 249) 873#define __NR_inotify_rm_watch (__NR_Linux + 249)
874#define __NR_migrate_pages (__NR_Linux + 250)
875#define __NR_openat (__NR_Linux + 251)
876#define __NR_mkdirat (__NR_Linux + 252)
877#define __NR_mknodat (__NR_Linux + 253)
878#define __NR_fchownat (__NR_Linux + 254)
879#define __NR_futimesat (__NR_Linux + 255)
880#define __NR_newfstatat (__NR_Linux + 256)
881#define __NR_unlinkat (__NR_Linux + 257)
882#define __NR_renameat (__NR_Linux + 258)
883#define __NR_linkat (__NR_Linux + 259)
884#define __NR_symlinkat (__NR_Linux + 260)
885#define __NR_readlinkat (__NR_Linux + 261)
886#define __NR_fchmodat (__NR_Linux + 262)
887#define __NR_faccessat (__NR_Linux + 263)
888#define __NR_pselect6 (__NR_Linux + 264)
889#define __NR_ppoll (__NR_Linux + 265)
890#define __NR_unshare (__NR_Linux + 266)
841 891
842/* 892/*
843 * Offset of the last N32 flavoured syscall 893 * Offset of the last N32 flavoured syscall
844 */ 894 */
845#define __NR_Linux_syscalls 249 895#define __NR_Linux_syscalls 266
846 896
847#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ 897#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
848 898
849#define __NR_N32_Linux 6000 899#define __NR_N32_Linux 6000
850#define __NR_N32_Linux_syscalls 246 900#define __NR_N32_Linux_syscalls 266
851 901
852#ifndef __ASSEMBLY__ 902#ifndef __ASSEMBLY__
853 903