aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/kernel')
-rw-r--r--arch/mips/kernel/cpu-probe.c6
-rw-r--r--arch/mips/kernel/gdb-low.S2
-rw-r--r--arch/mips/kernel/irixsig.c4
-rw-r--r--arch/mips/kernel/irq.c10
-rw-r--r--arch/mips/kernel/linux32.c252
-rw-r--r--arch/mips/kernel/proc.c1
-rw-r--r--arch/mips/kernel/process.c17
-rw-r--r--arch/mips/kernel/scall64-n32.S2
-rw-r--r--arch/mips/kernel/scall64-o32.S2
-rw-r--r--arch/mips/kernel/setup.c20
-rw-r--r--arch/mips/kernel/signal-common.h10
-rw-r--r--arch/mips/kernel/signal.c6
-rw-r--r--arch/mips/kernel/signal32.c46
-rw-r--r--arch/mips/kernel/signal_n32.c5
-rw-r--r--arch/mips/kernel/smp.c4
-rw-r--r--arch/mips/kernel/syscall.c7
-rw-r--r--arch/mips/kernel/sysirix.c22
-rw-r--r--arch/mips/kernel/time.c28
-rw-r--r--arch/mips/kernel/traps.c2
19 files changed, 162 insertions, 284 deletions
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index 292f8b243a5e..58b3b14873cb 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -291,7 +291,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
291 * for documentation. Commented out because it shares 291 * for documentation. Commented out because it shares
292 * it's c0_prid id number with the TX3900. 292 * it's c0_prid id number with the TX3900.
293 */ 293 */
294 c->cputype = CPU_R4650; 294 c->cputype = CPU_R4650;
295 c->isa_level = MIPS_CPU_ISA_III; 295 c->isa_level = MIPS_CPU_ISA_III;
296 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_LLSC; 296 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_LLSC;
297 c->tlbsize = 48; 297 c->tlbsize = 48;
@@ -604,7 +604,7 @@ static inline void cpu_probe_alchemy(struct cpuinfo_mips *c)
604 case PRID_IMP_AU1_REV2: 604 case PRID_IMP_AU1_REV2:
605 switch ((c->processor_id >> 24) & 0xff) { 605 switch ((c->processor_id >> 24) & 0xff) {
606 case 0: 606 case 0:
607 c->cputype = CPU_AU1000; 607 c->cputype = CPU_AU1000;
608 break; 608 break;
609 case 1: 609 case 1:
610 c->cputype = CPU_AU1500; 610 c->cputype = CPU_AU1500;
@@ -705,7 +705,7 @@ __init void cpu_probe(void)
705 break; 705 break;
706 case PRID_COMP_PHILIPS: 706 case PRID_COMP_PHILIPS:
707 cpu_probe_philips(c); 707 cpu_probe_philips(c);
708 break; 708 break;
709 default: 709 default:
710 c->cputype = CPU_UNKNOWN; 710 c->cputype = CPU_UNKNOWN;
711 } 711 }
diff --git a/arch/mips/kernel/gdb-low.S b/arch/mips/kernel/gdb-low.S
index 83b8986f9401..235ad9f6bd35 100644
--- a/arch/mips/kernel/gdb-low.S
+++ b/arch/mips/kernel/gdb-low.S
@@ -41,7 +41,7 @@
41 */ 41 */
42 .align 5 42 .align 5
43 NESTED(trap_low, GDB_FR_SIZE, sp) 43 NESTED(trap_low, GDB_FR_SIZE, sp)
44 .set noat 44 .set noat
45 .set noreorder 45 .set noreorder
46 46
47 mfc0 k0, CP0_STATUS 47 mfc0 k0, CP0_STATUS
diff --git a/arch/mips/kernel/irixsig.c b/arch/mips/kernel/irixsig.c
index 08273a2a501d..8150f071f80a 100644
--- a/arch/mips/kernel/irixsig.c
+++ b/arch/mips/kernel/irixsig.c
@@ -603,7 +603,7 @@ repeat:
603 /* move to end of parent's list to avoid starvation */ 603 /* move to end of parent's list to avoid starvation */
604 write_lock_irq(&tasklist_lock); 604 write_lock_irq(&tasklist_lock);
605 remove_parent(p); 605 remove_parent(p);
606 add_parent(p, p->parent); 606 add_parent(p);
607 write_unlock_irq(&tasklist_lock); 607 write_unlock_irq(&tasklist_lock);
608 retval = ru ? getrusage(p, RUSAGE_BOTH, ru) : 0; 608 retval = ru ? getrusage(p, RUSAGE_BOTH, ru) : 0;
609 if (retval) 609 if (retval)
@@ -643,7 +643,7 @@ repeat:
643 write_lock_irq(&tasklist_lock); 643 write_lock_irq(&tasklist_lock);
644 remove_parent(p); 644 remove_parent(p);
645 p->parent = p->real_parent; 645 p->parent = p->real_parent;
646 add_parent(p, p->parent); 646 add_parent(p);
647 do_notify_parent(p, SIGCHLD); 647 do_notify_parent(p, SIGCHLD);
648 write_unlock_irq(&tasklist_lock); 648 write_unlock_irq(&tasklist_lock);
649 } else 649 } else
diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c
index 7d93992e462c..3dd76b3d2967 100644
--- a/arch/mips/kernel/irq.c
+++ b/arch/mips/kernel/irq.c
@@ -68,9 +68,8 @@ int show_interrupts(struct seq_file *p, void *v)
68 68
69 if (i == 0) { 69 if (i == 0) {
70 seq_printf(p, " "); 70 seq_printf(p, " ");
71 for (j=0; j<NR_CPUS; j++) 71 for_each_online_cpu(j)
72 if (cpu_online(j)) 72 seq_printf(p, "CPU%d ",j);
73 seq_printf(p, "CPU%d ",j);
74 seq_putc(p, '\n'); 73 seq_putc(p, '\n');
75 } 74 }
76 75
@@ -83,9 +82,8 @@ int show_interrupts(struct seq_file *p, void *v)
83#ifndef CONFIG_SMP 82#ifndef CONFIG_SMP
84 seq_printf(p, "%10u ", kstat_irqs(i)); 83 seq_printf(p, "%10u ", kstat_irqs(i));
85#else 84#else
86 for (j = 0; j < NR_CPUS; j++) 85 for_each_online_cpu(j)
87 if (cpu_online(j)) 86 seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
88 seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
89#endif 87#endif
90 seq_printf(p, " %14s", irq_desc[i].handler->typename); 88 seq_printf(p, " %14s", irq_desc[i].handler->typename);
91 seq_printf(p, " %s", action->name); 89 seq_printf(p, " %s", action->name);
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index e00e5f6e7fdd..3f40c37a9ee6 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -30,7 +30,6 @@
30#include <linux/utime.h> 30#include <linux/utime.h>
31#include <linux/utsname.h> 31#include <linux/utsname.h>
32#include <linux/personality.h> 32#include <linux/personality.h>
33#include <linux/timex.h>
34#include <linux/dnotify.h> 33#include <linux/dnotify.h>
35#include <linux/module.h> 34#include <linux/module.h>
36#include <linux/binfmts.h> 35#include <linux/binfmts.h>
@@ -69,7 +68,7 @@
69 * Revalidate the inode. This is required for proper NFS attribute caching. 68 * Revalidate the inode. This is required for proper NFS attribute caching.
70 */ 69 */
71 70
72int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf) 71int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
73{ 72{
74 struct compat_stat tmp; 73 struct compat_stat tmp;
75 74
@@ -106,6 +105,10 @@ sys32_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
106 unsigned long error; 105 unsigned long error;
107 106
108 error = -EINVAL; 107 error = -EINVAL;
108 if (pgoff & (~PAGE_MASK >> 12))
109 goto out;
110 pgoff >>= PAGE_SHIFT-12;
111
109 if (!(flags & MAP_ANONYMOUS)) { 112 if (!(flags & MAP_ANONYMOUS)) {
110 error = -EBADF; 113 error = -EBADF;
111 file = fget(fd); 114 file = fget(fd);
@@ -125,7 +128,7 @@ out:
125} 128}
126 129
127 130
128asmlinkage int sys_truncate64(const char *path, unsigned int high, 131asmlinkage int sys_truncate64(const char __user *path, unsigned int high,
129 unsigned int low) 132 unsigned int low)
130{ 133{
131 if ((int)high < 0) 134 if ((int)high < 0)
@@ -161,12 +164,6 @@ out:
161 return error; 164 return error;
162} 165}
163 166
164asmlinkage int
165sys32_waitpid(compat_pid_t pid, unsigned int *stat_addr, int options)
166{
167 return compat_sys_wait4(pid, stat_addr, options, NULL);
168}
169
170asmlinkage long 167asmlinkage long
171sysn32_waitid(int which, compat_pid_t pid, 168sysn32_waitid(int which, compat_pid_t pid,
172 siginfo_t __user *uinfo, int options, 169 siginfo_t __user *uinfo, int options,
@@ -175,6 +172,7 @@ sysn32_waitid(int which, compat_pid_t pid,
175 struct rusage ru; 172 struct rusage ru;
176 long ret; 173 long ret;
177 mm_segment_t old_fs = get_fs(); 174 mm_segment_t old_fs = get_fs();
175 int si_signo;
178 176
179 if (!access_ok(VERIFY_WRITE, uinfo, sizeof(*uinfo))) 177 if (!access_ok(VERIFY_WRITE, uinfo, sizeof(*uinfo)))
180 return -EFAULT; 178 return -EFAULT;
@@ -184,7 +182,9 @@ sysn32_waitid(int which, compat_pid_t pid,
184 uru ? (struct rusage __user *) &ru : NULL); 182 uru ? (struct rusage __user *) &ru : NULL);
185 set_fs (old_fs); 183 set_fs (old_fs);
186 184
187 if (ret < 0 || uinfo->si_signo == 0) 185 if (__get_user(si_signo, &uinfo->si_signo))
186 return -EFAULT;
187 if (ret < 0 || si_signo == 0)
188 return ret; 188 return ret;
189 189
190 if (uru) 190 if (uru)
@@ -208,14 +208,14 @@ struct sysinfo32 {
208 char _f[8]; 208 char _f[8];
209}; 209};
210 210
211asmlinkage int sys32_sysinfo(struct sysinfo32 *info) 211asmlinkage int sys32_sysinfo(struct sysinfo32 __user *info)
212{ 212{
213 struct sysinfo s; 213 struct sysinfo s;
214 int ret, err; 214 int ret, err;
215 mm_segment_t old_fs = get_fs (); 215 mm_segment_t old_fs = get_fs ();
216 216
217 set_fs (KERNEL_DS); 217 set_fs (KERNEL_DS);
218 ret = sys_sysinfo(&s); 218 ret = sys_sysinfo((struct sysinfo __user *)&s);
219 set_fs (old_fs); 219 set_fs (old_fs);
220 err = put_user (s.uptime, &info->uptime); 220 err = put_user (s.uptime, &info->uptime);
221 err |= __put_user (s.loads[0], &info->loads[0]); 221 err |= __put_user (s.loads[0], &info->loads[0]);
@@ -245,11 +245,11 @@ struct rlimit32 {
245}; 245};
246 246
247#ifdef __MIPSEB__ 247#ifdef __MIPSEB__
248asmlinkage long sys32_truncate64(const char * path, unsigned long __dummy, 248asmlinkage long sys32_truncate64(const char __user * path, unsigned long __dummy,
249 int length_hi, int length_lo) 249 int length_hi, int length_lo)
250#endif 250#endif
251#ifdef __MIPSEL__ 251#ifdef __MIPSEL__
252asmlinkage long sys32_truncate64(const char * path, unsigned long __dummy, 252asmlinkage long sys32_truncate64(const char __user * path, unsigned long __dummy,
253 int length_lo, int length_hi) 253 int length_lo, int length_hi)
254#endif 254#endif
255{ 255{
@@ -277,7 +277,7 @@ asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long __dummy,
277} 277}
278 278
279static inline long 279static inline long
280get_tv32(struct timeval *o, struct compat_timeval *i) 280get_tv32(struct timeval *o, struct compat_timeval __user *i)
281{ 281{
282 return (!access_ok(VERIFY_READ, i, sizeof(*i)) || 282 return (!access_ok(VERIFY_READ, i, sizeof(*i)) ||
283 (__get_user(o->tv_sec, &i->tv_sec) | 283 (__get_user(o->tv_sec, &i->tv_sec) |
@@ -285,7 +285,7 @@ get_tv32(struct timeval *o, struct compat_timeval *i)
285} 285}
286 286
287static inline long 287static inline long
288put_tv32(struct compat_timeval *o, struct timeval *i) 288put_tv32(struct compat_timeval __user *o, struct timeval *i)
289{ 289{
290 return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) || 290 return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
291 (__put_user(i->tv_sec, &o->tv_sec) | 291 (__put_user(i->tv_sec, &o->tv_sec) |
@@ -295,7 +295,7 @@ put_tv32(struct compat_timeval *o, struct timeval *i)
295extern struct timezone sys_tz; 295extern struct timezone sys_tz;
296 296
297asmlinkage int 297asmlinkage int
298sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz) 298sys32_gettimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
299{ 299{
300 if (tv) { 300 if (tv) {
301 struct timeval ktv; 301 struct timeval ktv;
@@ -310,7 +310,7 @@ sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz)
310 return 0; 310 return 0;
311} 311}
312 312
313static inline long get_ts32(struct timespec *o, struct compat_timeval *i) 313static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i)
314{ 314{
315 long usec; 315 long usec;
316 316
@@ -325,7 +325,7 @@ static inline long get_ts32(struct timespec *o, struct compat_timeval *i)
325} 325}
326 326
327asmlinkage int 327asmlinkage int
328sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz) 328sys32_settimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
329{ 329{
330 struct timespec kts; 330 struct timespec kts;
331 struct timezone ktz; 331 struct timezone ktz;
@@ -343,7 +343,7 @@ sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz)
343} 343}
344 344
345asmlinkage int sys32_llseek(unsigned int fd, unsigned int offset_high, 345asmlinkage int sys32_llseek(unsigned int fd, unsigned int offset_high,
346 unsigned int offset_low, loff_t * result, 346 unsigned int offset_low, loff_t __user * result,
347 unsigned int origin) 347 unsigned int origin)
348{ 348{
349 return sys_llseek(fd, offset_high, offset_low, result, origin); 349 return sys_llseek(fd, offset_high, offset_low, result, origin);
@@ -353,12 +353,12 @@ asmlinkage int sys32_llseek(unsigned int fd, unsigned int offset_high,
353 lseek back to original location. They fail just like lseek does on 353 lseek back to original location. They fail just like lseek does on
354 non-seekable files. */ 354 non-seekable files. */
355 355
356asmlinkage ssize_t sys32_pread(unsigned int fd, char * buf, 356asmlinkage ssize_t sys32_pread(unsigned int fd, char __user * buf,
357 size_t count, u32 unused, u64 a4, u64 a5) 357 size_t count, u32 unused, u64 a4, u64 a5)
358{ 358{
359 ssize_t ret; 359 ssize_t ret;
360 struct file * file; 360 struct file * file;
361 ssize_t (*read)(struct file *, char *, size_t, loff_t *); 361 ssize_t (*read)(struct file *, char __user *, size_t, loff_t *);
362 loff_t pos; 362 loff_t pos;
363 363
364 ret = -EBADF; 364 ret = -EBADF;
@@ -388,12 +388,12 @@ bad_file:
388 return ret; 388 return ret;
389} 389}
390 390
391asmlinkage ssize_t sys32_pwrite(unsigned int fd, const char * buf, 391asmlinkage ssize_t sys32_pwrite(unsigned int fd, const char __user * buf,
392 size_t count, u32 unused, u64 a4, u64 a5) 392 size_t count, u32 unused, u64 a4, u64 a5)
393{ 393{
394 ssize_t ret; 394 ssize_t ret;
395 struct file * file; 395 struct file * file;
396 ssize_t (*write)(struct file *, const char *, size_t, loff_t *); 396 ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *);
397 loff_t pos; 397 loff_t pos;
398 398
399 ret = -EBADF; 399 ret = -EBADF;
@@ -426,14 +426,14 @@ bad_file:
426} 426}
427 427
428asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, 428asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid,
429 struct compat_timespec *interval) 429 struct compat_timespec __user *interval)
430{ 430{
431 struct timespec t; 431 struct timespec t;
432 int ret; 432 int ret;
433 mm_segment_t old_fs = get_fs (); 433 mm_segment_t old_fs = get_fs ();
434 434
435 set_fs (KERNEL_DS); 435 set_fs (KERNEL_DS);
436 ret = sys_sched_rr_get_interval(pid, &t); 436 ret = sys_sched_rr_get_interval(pid, (struct timespec __user *)&t);
437 set_fs (old_fs); 437 set_fs (old_fs);
438 if (put_user (t.tv_sec, &interval->tv_sec) || 438 if (put_user (t.tv_sec, &interval->tv_sec) ||
439 __put_user (t.tv_nsec, &interval->tv_nsec)) 439 __put_user (t.tv_nsec, &interval->tv_nsec))
@@ -551,7 +551,7 @@ struct ipc_kludge32 {
551}; 551};
552 552
553static int 553static int
554do_sys32_semctl(int first, int second, int third, void *uptr) 554do_sys32_semctl(int first, int second, int third, void __user *uptr)
555{ 555{
556 union semun fourth; 556 union semun fourth;
557 u32 pad; 557 u32 pad;
@@ -562,12 +562,12 @@ do_sys32_semctl(int first, int second, int third, void *uptr)
562 if (!uptr) 562 if (!uptr)
563 return -EINVAL; 563 return -EINVAL;
564 err = -EFAULT; 564 err = -EFAULT;
565 if (get_user (pad, (u32 *)uptr)) 565 if (get_user (pad, (u32 __user *)uptr))
566 return err; 566 return err;
567 if ((third & ~IPC_64) == SETVAL) 567 if ((third & ~IPC_64) == SETVAL)
568 fourth.val = (int)pad; 568 fourth.val = (int)pad;
569 else 569 else
570 fourth.__pad = (void *)A(pad); 570 fourth.__pad = (void __user *)A(pad);
571 switch (third & ~IPC_64) { 571 switch (third & ~IPC_64) {
572 case IPC_INFO: 572 case IPC_INFO:
573 case IPC_RMID: 573 case IPC_RMID:
@@ -585,14 +585,14 @@ do_sys32_semctl(int first, int second, int third, void *uptr)
585 585
586 case IPC_STAT: 586 case IPC_STAT:
587 case SEM_STAT: 587 case SEM_STAT:
588 fourth.__pad = &s; 588 fourth.__pad = (struct semid64_ds __user *)&s;
589 old_fs = get_fs(); 589 old_fs = get_fs();
590 set_fs(KERNEL_DS); 590 set_fs(KERNEL_DS);
591 err = sys_semctl(first, second, third | IPC_64, fourth); 591 err = sys_semctl(first, second, third | IPC_64, fourth);
592 set_fs(old_fs); 592 set_fs(old_fs);
593 593
594 if (third & IPC_64) { 594 if (third & IPC_64) {
595 struct semid64_ds32 *usp64 = (struct semid64_ds32 *) A(pad); 595 struct semid64_ds32 __user *usp64 = (struct semid64_ds32 __user *) A(pad);
596 596
597 if (!access_ok(VERIFY_WRITE, usp64, sizeof(*usp64))) { 597 if (!access_ok(VERIFY_WRITE, usp64, sizeof(*usp64))) {
598 err = -EFAULT; 598 err = -EFAULT;
@@ -609,7 +609,7 @@ do_sys32_semctl(int first, int second, int third, void *uptr)
609 err2 |= __put_user(s.sem_ctime, &usp64->sem_ctime); 609 err2 |= __put_user(s.sem_ctime, &usp64->sem_ctime);
610 err2 |= __put_user(s.sem_nsems, &usp64->sem_nsems); 610 err2 |= __put_user(s.sem_nsems, &usp64->sem_nsems);
611 } else { 611 } else {
612 struct semid_ds32 *usp32 = (struct semid_ds32 *) A(pad); 612 struct semid_ds32 __user *usp32 = (struct semid_ds32 __user *) A(pad);
613 613
614 if (!access_ok(VERIFY_WRITE, usp32, sizeof(*usp32))) { 614 if (!access_ok(VERIFY_WRITE, usp32, sizeof(*usp32))) {
615 err = -EFAULT; 615 err = -EFAULT;
@@ -639,9 +639,9 @@ do_sys32_semctl(int first, int second, int third, void *uptr)
639} 639}
640 640
641static int 641static int
642do_sys32_msgsnd (int first, int second, int third, void *uptr) 642do_sys32_msgsnd (int first, int second, int third, void __user *uptr)
643{ 643{
644 struct msgbuf32 *up = (struct msgbuf32 *)uptr; 644 struct msgbuf32 __user *up = (struct msgbuf32 __user *)uptr;
645 struct msgbuf *p; 645 struct msgbuf *p;
646 mm_segment_t old_fs; 646 mm_segment_t old_fs;
647 int err; 647 int err;
@@ -660,7 +660,7 @@ do_sys32_msgsnd (int first, int second, int third, void *uptr)
660 goto out; 660 goto out;
661 old_fs = get_fs (); 661 old_fs = get_fs ();
662 set_fs (KERNEL_DS); 662 set_fs (KERNEL_DS);
663 err = sys_msgsnd (first, p, second, third); 663 err = sys_msgsnd (first, (struct msgbuf __user *)p, second, third);
664 set_fs (old_fs); 664 set_fs (old_fs);
665out: 665out:
666 kfree (p); 666 kfree (p);
@@ -670,15 +670,15 @@ out:
670 670
671static int 671static int
672do_sys32_msgrcv (int first, int second, int msgtyp, int third, 672do_sys32_msgrcv (int first, int second, int msgtyp, int third,
673 int version, void *uptr) 673 int version, void __user *uptr)
674{ 674{
675 struct msgbuf32 *up; 675 struct msgbuf32 __user *up;
676 struct msgbuf *p; 676 struct msgbuf *p;
677 mm_segment_t old_fs; 677 mm_segment_t old_fs;
678 int err; 678 int err;
679 679
680 if (!version) { 680 if (!version) {
681 struct ipc_kludge32 *uipck = (struct ipc_kludge32 *)uptr; 681 struct ipc_kludge32 __user *uipck = (struct ipc_kludge32 __user *)uptr;
682 struct ipc_kludge32 ipck; 682 struct ipc_kludge32 ipck;
683 683
684 err = -EINVAL; 684 err = -EINVAL;
@@ -687,7 +687,7 @@ do_sys32_msgrcv (int first, int second, int msgtyp, int third,
687 err = -EFAULT; 687 err = -EFAULT;
688 if (copy_from_user (&ipck, uipck, sizeof (struct ipc_kludge32))) 688 if (copy_from_user (&ipck, uipck, sizeof (struct ipc_kludge32)))
689 goto out; 689 goto out;
690 uptr = (void *)AA(ipck.msgp); 690 uptr = (void __user *)AA(ipck.msgp);
691 msgtyp = ipck.msgtyp; 691 msgtyp = ipck.msgtyp;
692 } 692 }
693 693
@@ -699,11 +699,11 @@ do_sys32_msgrcv (int first, int second, int msgtyp, int third,
699 goto out; 699 goto out;
700 old_fs = get_fs (); 700 old_fs = get_fs ();
701 set_fs (KERNEL_DS); 701 set_fs (KERNEL_DS);
702 err = sys_msgrcv (first, p, second + 4, msgtyp, third); 702 err = sys_msgrcv (first, (struct msgbuf __user *)p, second + 4, msgtyp, third);
703 set_fs (old_fs); 703 set_fs (old_fs);
704 if (err < 0) 704 if (err < 0)
705 goto free_then_out; 705 goto free_then_out;
706 up = (struct msgbuf32 *)uptr; 706 up = (struct msgbuf32 __user *)uptr;
707 if (put_user (p->mtype, &up->mtype) || 707 if (put_user (p->mtype, &up->mtype) ||
708 __copy_to_user (&up->mtext, p->mtext, err)) 708 __copy_to_user (&up->mtext, p->mtext, err))
709 err = -EFAULT; 709 err = -EFAULT;
@@ -714,19 +714,19 @@ out:
714} 714}
715 715
716static int 716static int
717do_sys32_msgctl (int first, int second, void *uptr) 717do_sys32_msgctl (int first, int second, void __user *uptr)
718{ 718{
719 int err = -EINVAL, err2; 719 int err = -EINVAL, err2;
720 struct msqid64_ds m; 720 struct msqid64_ds m;
721 struct msqid_ds32 *up32 = (struct msqid_ds32 *)uptr; 721 struct msqid_ds32 __user *up32 = (struct msqid_ds32 __user *)uptr;
722 struct msqid64_ds32 *up64 = (struct msqid64_ds32 *)uptr; 722 struct msqid64_ds32 __user *up64 = (struct msqid64_ds32 __user *)uptr;
723 mm_segment_t old_fs; 723 mm_segment_t old_fs;
724 724
725 switch (second & ~IPC_64) { 725 switch (second & ~IPC_64) {
726 case IPC_INFO: 726 case IPC_INFO:
727 case IPC_RMID: 727 case IPC_RMID:
728 case MSG_INFO: 728 case MSG_INFO:
729 err = sys_msgctl (first, second, (struct msqid_ds *)uptr); 729 err = sys_msgctl (first, second, (struct msqid_ds __user *)uptr);
730 break; 730 break;
731 731
732 case IPC_SET: 732 case IPC_SET:
@@ -753,7 +753,7 @@ do_sys32_msgctl (int first, int second, void *uptr)
753 break; 753 break;
754 old_fs = get_fs(); 754 old_fs = get_fs();
755 set_fs(KERNEL_DS); 755 set_fs(KERNEL_DS);
756 err = sys_msgctl(first, second | IPC_64, (struct msqid_ds *)&m); 756 err = sys_msgctl(first, second | IPC_64, (struct msqid_ds __user *)&m);
757 set_fs(old_fs); 757 set_fs(old_fs);
758 break; 758 break;
759 759
@@ -761,7 +761,7 @@ do_sys32_msgctl (int first, int second, void *uptr)
761 case MSG_STAT: 761 case MSG_STAT:
762 old_fs = get_fs(); 762 old_fs = get_fs();
763 set_fs(KERNEL_DS); 763 set_fs(KERNEL_DS);
764 err = sys_msgctl(first, second | IPC_64, (struct msqid_ds *)&m); 764 err = sys_msgctl(first, second | IPC_64, (struct msqid_ds __user *)&m);
765 set_fs(old_fs); 765 set_fs(old_fs);
766 if (second & IPC_64) { 766 if (second & IPC_64) {
767 if (!access_ok(VERIFY_WRITE, up64, sizeof(*up64))) { 767 if (!access_ok(VERIFY_WRITE, up64, sizeof(*up64))) {
@@ -815,10 +815,10 @@ do_sys32_msgctl (int first, int second, void *uptr)
815} 815}
816 816
817static int 817static int
818do_sys32_shmat (int first, int second, int third, int version, void *uptr) 818do_sys32_shmat (int first, int second, int third, int version, void __user *uptr)
819{ 819{
820 unsigned long raddr; 820 unsigned long raddr;
821 u32 *uaddr = (u32 *)A((u32)third); 821 u32 __user *uaddr = (u32 __user *)A((u32)third);
822 int err = -EINVAL; 822 int err = -EINVAL;
823 823
824 if (version == 1) 824 if (version == 1)
@@ -837,11 +837,11 @@ struct shm_info32 {
837}; 837};
838 838
839static int 839static int
840do_sys32_shmctl (int first, int second, void *uptr) 840do_sys32_shmctl (int first, int second, void __user *uptr)
841{ 841{
842 struct shmid64_ds32 *up64 = (struct shmid64_ds32 *)uptr; 842 struct shmid64_ds32 __user *up64 = (struct shmid64_ds32 __user *)uptr;
843 struct shmid_ds32 *up32 = (struct shmid_ds32 *)uptr; 843 struct shmid_ds32 __user *up32 = (struct shmid_ds32 __user *)uptr;
844 struct shm_info32 *uip = (struct shm_info32 *)uptr; 844 struct shm_info32 __user *uip = (struct shm_info32 __user *)uptr;
845 int err = -EFAULT, err2; 845 int err = -EFAULT, err2;
846 struct shmid64_ds s64; 846 struct shmid64_ds s64;
847 mm_segment_t old_fs; 847 mm_segment_t old_fs;
@@ -854,7 +854,7 @@ do_sys32_shmctl (int first, int second, void *uptr)
854 case IPC_RMID: 854 case IPC_RMID:
855 case SHM_LOCK: 855 case SHM_LOCK:
856 case SHM_UNLOCK: 856 case SHM_UNLOCK:
857 err = sys_shmctl(first, second, (struct shmid_ds *)uptr); 857 err = sys_shmctl(first, second, (struct shmid_ds __user *)uptr);
858 break; 858 break;
859 case IPC_SET: 859 case IPC_SET:
860 if (second & IPC_64) { 860 if (second & IPC_64) {
@@ -870,7 +870,7 @@ do_sys32_shmctl (int first, int second, void *uptr)
870 break; 870 break;
871 old_fs = get_fs(); 871 old_fs = get_fs();
872 set_fs(KERNEL_DS); 872 set_fs(KERNEL_DS);
873 err = sys_shmctl(first, second & ~IPC_64, &s); 873 err = sys_shmctl(first, second & ~IPC_64, (struct shmid_ds __user *)&s);
874 set_fs(old_fs); 874 set_fs(old_fs);
875 break; 875 break;
876 876
@@ -878,7 +878,7 @@ do_sys32_shmctl (int first, int second, void *uptr)
878 case SHM_STAT: 878 case SHM_STAT:
879 old_fs = get_fs(); 879 old_fs = get_fs();
880 set_fs(KERNEL_DS); 880 set_fs(KERNEL_DS);
881 err = sys_shmctl(first, second | IPC_64, (void *) &s64); 881 err = sys_shmctl(first, second | IPC_64, (void __user *) &s64);
882 set_fs(old_fs); 882 set_fs(old_fs);
883 if (err < 0) 883 if (err < 0)
884 break; 884 break;
@@ -928,7 +928,7 @@ do_sys32_shmctl (int first, int second, void *uptr)
928 case SHM_INFO: 928 case SHM_INFO:
929 old_fs = get_fs(); 929 old_fs = get_fs();
930 set_fs(KERNEL_DS); 930 set_fs(KERNEL_DS);
931 err = sys_shmctl(first, second, (void *)&si); 931 err = sys_shmctl(first, second, (void __user *)&si);
932 set_fs(old_fs); 932 set_fs(old_fs);
933 if (err < 0) 933 if (err < 0)
934 break; 934 break;
@@ -950,11 +950,11 @@ do_sys32_shmctl (int first, int second, void *uptr)
950 return err; 950 return err;
951} 951}
952 952
953static int sys32_semtimedop(int semid, struct sembuf *tsems, int nsems, 953static int sys32_semtimedop(int semid, struct sembuf __user *tsems, int nsems,
954 const struct compat_timespec *timeout32) 954 const struct compat_timespec __user *timeout32)
955{ 955{
956 struct compat_timespec t32; 956 struct compat_timespec t32;
957 struct timespec *t64 = compat_alloc_user_space(sizeof(*t64)); 957 struct timespec __user *t64 = compat_alloc_user_space(sizeof(*t64));
958 958
959 if (copy_from_user(&t32, timeout32, sizeof(t32))) 959 if (copy_from_user(&t32, timeout32, sizeof(t32)))
960 return -EFAULT; 960 return -EFAULT;
@@ -977,11 +977,11 @@ sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth)
977 switch (call) { 977 switch (call) {
978 case SEMOP: 978 case SEMOP:
979 /* struct sembuf is the same on 32 and 64bit :)) */ 979 /* struct sembuf is the same on 32 and 64bit :)) */
980 err = sys_semtimedop (first, (struct sembuf *)AA(ptr), second, 980 err = sys_semtimedop (first, (struct sembuf __user *)AA(ptr), second,
981 NULL); 981 NULL);
982 break; 982 break;
983 case SEMTIMEDOP: 983 case SEMTIMEDOP:
984 err = sys32_semtimedop (first, (struct sembuf *)AA(ptr), second, 984 err = sys32_semtimedop (first, (struct sembuf __user *)AA(ptr), second,
985 (const struct compat_timespec __user *)AA(fifth)); 985 (const struct compat_timespec __user *)AA(fifth));
986 break; 986 break;
987 case SEMGET: 987 case SEMGET:
@@ -989,36 +989,36 @@ sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth)
989 break; 989 break;
990 case SEMCTL: 990 case SEMCTL:
991 err = do_sys32_semctl (first, second, third, 991 err = do_sys32_semctl (first, second, third,
992 (void *)AA(ptr)); 992 (void __user *)AA(ptr));
993 break; 993 break;
994 994
995 case MSGSND: 995 case MSGSND:
996 err = do_sys32_msgsnd (first, second, third, 996 err = do_sys32_msgsnd (first, second, third,
997 (void *)AA(ptr)); 997 (void __user *)AA(ptr));
998 break; 998 break;
999 case MSGRCV: 999 case MSGRCV:
1000 err = do_sys32_msgrcv (first, second, fifth, third, 1000 err = do_sys32_msgrcv (first, second, fifth, third,
1001 version, (void *)AA(ptr)); 1001 version, (void __user *)AA(ptr));
1002 break; 1002 break;
1003 case MSGGET: 1003 case MSGGET:
1004 err = sys_msgget ((key_t) first, second); 1004 err = sys_msgget ((key_t) first, second);
1005 break; 1005 break;
1006 case MSGCTL: 1006 case MSGCTL:
1007 err = do_sys32_msgctl (first, second, (void *)AA(ptr)); 1007 err = do_sys32_msgctl (first, second, (void __user *)AA(ptr));
1008 break; 1008 break;
1009 1009
1010 case SHMAT: 1010 case SHMAT:
1011 err = do_sys32_shmat (first, second, third, 1011 err = do_sys32_shmat (first, second, third,
1012 version, (void *)AA(ptr)); 1012 version, (void __user *)AA(ptr));
1013 break; 1013 break;
1014 case SHMDT: 1014 case SHMDT:
1015 err = sys_shmdt ((char *)A(ptr)); 1015 err = sys_shmdt ((char __user *)A(ptr));
1016 break; 1016 break;
1017 case SHMGET: 1017 case SHMGET:
1018 err = sys_shmget (first, (unsigned)second, third); 1018 err = sys_shmget (first, (unsigned)second, third);
1019 break; 1019 break;
1020 case SHMCTL: 1020 case SHMCTL:
1021 err = do_sys32_shmctl (first, second, (void *)AA(ptr)); 1021 err = do_sys32_shmctl (first, second, (void __user *)AA(ptr));
1022 break; 1022 break;
1023 default: 1023 default:
1024 err = -EINVAL; 1024 err = -EINVAL;
@@ -1029,7 +1029,7 @@ sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth)
1029} 1029}
1030 1030
1031asmlinkage long sys32_shmat(int shmid, char __user *shmaddr, 1031asmlinkage long sys32_shmat(int shmid, char __user *shmaddr,
1032 int shmflg, int32_t *addr) 1032 int shmflg, int32_t __user *addr)
1033{ 1033{
1034 unsigned long raddr; 1034 unsigned long raddr;
1035 int err; 1035 int err;
@@ -1054,12 +1054,13 @@ struct sysctl_args32
1054 1054
1055#ifdef CONFIG_SYSCTL 1055#ifdef CONFIG_SYSCTL
1056 1056
1057asmlinkage long sys32_sysctl(struct sysctl_args32 *args) 1057asmlinkage long sys32_sysctl(struct sysctl_args32 __user *args)
1058{ 1058{
1059 struct sysctl_args32 tmp; 1059 struct sysctl_args32 tmp;
1060 int error; 1060 int error;
1061 size_t oldlen, *oldlenp = NULL; 1061 size_t oldlen;
1062 unsigned long addr = (((long)&args->__unused[0]) + 7) & ~7; 1062 size_t __user *oldlenp = NULL;
1063 unsigned long addr = (((unsigned long)&args->__unused[0]) + 7) & ~7;
1063 1064
1064 if (copy_from_user(&tmp, args, sizeof(tmp))) 1065 if (copy_from_user(&tmp, args, sizeof(tmp)))
1065 return -EFAULT; 1066 return -EFAULT;
@@ -1071,20 +1072,20 @@ asmlinkage long sys32_sysctl(struct sysctl_args32 *args)
1071 basically copy the whole sysctl.c here, and 1072 basically copy the whole sysctl.c here, and
1072 glibc's __sysctl uses rw memory for the structure 1073 glibc's __sysctl uses rw memory for the structure
1073 anyway. */ 1074 anyway. */
1074 if (get_user(oldlen, (u32 *)A(tmp.oldlenp)) || 1075 if (get_user(oldlen, (u32 __user *)A(tmp.oldlenp)) ||
1075 put_user(oldlen, (size_t *)addr)) 1076 put_user(oldlen, (size_t __user *)addr))
1076 return -EFAULT; 1077 return -EFAULT;
1077 oldlenp = (size_t *)addr; 1078 oldlenp = (size_t __user *)addr;
1078 } 1079 }
1079 1080
1080 lock_kernel(); 1081 lock_kernel();
1081 error = do_sysctl((int *)A(tmp.name), tmp.nlen, (void *)A(tmp.oldval), 1082 error = do_sysctl((int __user *)A(tmp.name), tmp.nlen, (void __user *)A(tmp.oldval),
1082 oldlenp, (void *)A(tmp.newval), tmp.newlen); 1083 oldlenp, (void __user *)A(tmp.newval), tmp.newlen);
1083 unlock_kernel(); 1084 unlock_kernel();
1084 if (oldlenp) { 1085 if (oldlenp) {
1085 if (!error) { 1086 if (!error) {
1086 if (get_user(oldlen, (size_t *)addr) || 1087 if (get_user(oldlen, (size_t __user *)addr) ||
1087 put_user(oldlen, (u32 *)A(tmp.oldlenp))) 1088 put_user(oldlen, (u32 __user *)A(tmp.oldlenp)))
1088 error = -EFAULT; 1089 error = -EFAULT;
1089 } 1090 }
1090 copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused)); 1091 copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused));
@@ -1094,7 +1095,7 @@ asmlinkage long sys32_sysctl(struct sysctl_args32 *args)
1094 1095
1095#endif /* CONFIG_SYSCTL */ 1096#endif /* CONFIG_SYSCTL */
1096 1097
1097asmlinkage long sys32_newuname(struct new_utsname * name) 1098asmlinkage long sys32_newuname(struct new_utsname __user * name)
1098{ 1099{
1099 int ret = 0; 1100 int ret = 0;
1100 1101
@@ -1129,9 +1130,9 @@ struct ustat32 {
1129 char f_fpack[6]; 1130 char f_fpack[6];
1130}; 1131};
1131 1132
1132extern asmlinkage long sys_ustat(dev_t dev, struct ustat * ubuf); 1133extern asmlinkage long sys_ustat(dev_t dev, struct ustat __user * ubuf);
1133 1134
1134asmlinkage int sys32_ustat(dev_t dev, struct ustat32 * ubuf32) 1135asmlinkage int sys32_ustat(dev_t dev, struct ustat32 __user * ubuf32)
1135{ 1136{
1136 int err; 1137 int err;
1137 struct ustat tmp; 1138 struct ustat tmp;
@@ -1139,7 +1140,7 @@ asmlinkage int sys32_ustat(dev_t dev, struct ustat32 * ubuf32)
1139 mm_segment_t old_fs = get_fs(); 1140 mm_segment_t old_fs = get_fs();
1140 1141
1141 set_fs(KERNEL_DS); 1142 set_fs(KERNEL_DS);
1142 err = sys_ustat(dev, &tmp); 1143 err = sys_ustat(dev, (struct ustat __user *)&tmp);
1143 set_fs (old_fs); 1144 set_fs (old_fs);
1144 1145
1145 if (err) 1146 if (err)
@@ -1155,80 +1156,7 @@ out:
1155 return err; 1156 return err;
1156} 1157}
1157 1158
1158/* Handle adjtimex compatibility. */ 1159asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset,
1159
1160struct timex32 {
1161 u32 modes;
1162 s32 offset, freq, maxerror, esterror;
1163 s32 status, constant, precision, tolerance;
1164 struct compat_timeval time;
1165 s32 tick;
1166 s32 ppsfreq, jitter, shift, stabil;
1167 s32 jitcnt, calcnt, errcnt, stbcnt;
1168 s32 :32; s32 :32; s32 :32; s32 :32;
1169 s32 :32; s32 :32; s32 :32; s32 :32;
1170 s32 :32; s32 :32; s32 :32; s32 :32;
1171};
1172
1173extern int do_adjtimex(struct timex *);
1174
1175asmlinkage int sys32_adjtimex(struct timex32 *utp)
1176{
1177 struct timex txc;
1178 int ret;
1179
1180 memset(&txc, 0, sizeof(struct timex));
1181
1182 if (get_user(txc.modes, &utp->modes) ||
1183 __get_user(txc.offset, &utp->offset) ||
1184 __get_user(txc.freq, &utp->freq) ||
1185 __get_user(txc.maxerror, &utp->maxerror) ||
1186 __get_user(txc.esterror, &utp->esterror) ||
1187 __get_user(txc.status, &utp->status) ||
1188 __get_user(txc.constant, &utp->constant) ||
1189 __get_user(txc.precision, &utp->precision) ||
1190 __get_user(txc.tolerance, &utp->tolerance) ||
1191 __get_user(txc.time.tv_sec, &utp->time.tv_sec) ||
1192 __get_user(txc.time.tv_usec, &utp->time.tv_usec) ||
1193 __get_user(txc.tick, &utp->tick) ||
1194 __get_user(txc.ppsfreq, &utp->ppsfreq) ||
1195 __get_user(txc.jitter, &utp->jitter) ||
1196 __get_user(txc.shift, &utp->shift) ||
1197 __get_user(txc.stabil, &utp->stabil) ||
1198 __get_user(txc.jitcnt, &utp->jitcnt) ||
1199 __get_user(txc.calcnt, &utp->calcnt) ||
1200 __get_user(txc.errcnt, &utp->errcnt) ||
1201 __get_user(txc.stbcnt, &utp->stbcnt))
1202 return -EFAULT;
1203
1204 ret = do_adjtimex(&txc);
1205
1206 if (put_user(txc.modes, &utp->modes) ||
1207 __put_user(txc.offset, &utp->offset) ||
1208 __put_user(txc.freq, &utp->freq) ||
1209 __put_user(txc.maxerror, &utp->maxerror) ||
1210 __put_user(txc.esterror, &utp->esterror) ||
1211 __put_user(txc.status, &utp->status) ||
1212 __put_user(txc.constant, &utp->constant) ||
1213 __put_user(txc.precision, &utp->precision) ||
1214 __put_user(txc.tolerance, &utp->tolerance) ||
1215 __put_user(txc.time.tv_sec, &utp->time.tv_sec) ||
1216 __put_user(txc.time.tv_usec, &utp->time.tv_usec) ||
1217 __put_user(txc.tick, &utp->tick) ||
1218 __put_user(txc.ppsfreq, &utp->ppsfreq) ||
1219 __put_user(txc.jitter, &utp->jitter) ||
1220 __put_user(txc.shift, &utp->shift) ||
1221 __put_user(txc.stabil, &utp->stabil) ||
1222 __put_user(txc.jitcnt, &utp->jitcnt) ||
1223 __put_user(txc.calcnt, &utp->calcnt) ||
1224 __put_user(txc.errcnt, &utp->errcnt) ||
1225 __put_user(txc.stbcnt, &utp->stbcnt))
1226 ret = -EFAULT;
1227
1228 return ret;
1229}
1230
1231asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset,
1232 s32 count) 1160 s32 count)
1233{ 1161{
1234 mm_segment_t old_fs = get_fs(); 1162 mm_segment_t old_fs = get_fs();
@@ -1239,7 +1167,7 @@ asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset,
1239 return -EFAULT; 1167 return -EFAULT;
1240 1168
1241 set_fs(KERNEL_DS); 1169 set_fs(KERNEL_DS);
1242 ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count); 1170 ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *)&of : NULL, count);
1243 set_fs(old_fs); 1171 set_fs(old_fs);
1244 1172
1245 if (offset && put_user(of, offset)) 1173 if (offset && put_user(of, offset))
@@ -1269,7 +1197,7 @@ static unsigned char socketcall_nargs[18]={AL(0),AL(3),AL(3),AL(3),AL(2),AL(3),
1269 * it is set by the callees. 1197 * it is set by the callees.
1270 */ 1198 */
1271 1199
1272asmlinkage long sys32_socketcall(int call, unsigned int *args32) 1200asmlinkage long sys32_socketcall(int call, unsigned int __user *args32)
1273{ 1201{
1274 unsigned int a[6]; 1202 unsigned int a[6];
1275 unsigned int a0,a1; 1203 unsigned int a0,a1;
@@ -1291,7 +1219,7 @@ asmlinkage long sys32_socketcall(int call, unsigned int *args32)
1291 struct sockaddr __user *addr, int __user *addr_len); 1219 struct sockaddr __user *addr, int __user *addr_len);
1292 extern asmlinkage long sys_shutdown(int fd, int how); 1220 extern asmlinkage long sys_shutdown(int fd, int how);
1293 extern asmlinkage long sys_setsockopt(int fd, int level, int optname, char __user *optval, int optlen); 1221 extern asmlinkage long sys_setsockopt(int fd, int level, int optname, char __user *optval, int optlen);
1294 extern asmlinkage long sys_getsockopt(int fd, int level, int optname, char __user *optval, int *optlen); 1222 extern asmlinkage long sys_getsockopt(int fd, int level, int optname, char __user *optval, int __user *optlen);
1295 extern asmlinkage long sys_sendmsg(int fd, struct msghdr __user *msg, unsigned flags); 1223 extern asmlinkage long sys_sendmsg(int fd, struct msghdr __user *msg, unsigned flags);
1296 extern asmlinkage long sys_recvmsg(int fd, struct msghdr __user *msg, unsigned int flags); 1224 extern asmlinkage long sys_recvmsg(int fd, struct msghdr __user *msg, unsigned int flags);
1297 1225
@@ -1411,7 +1339,7 @@ _sys32_clone(nabi_no_regargs struct pt_regs regs)
1411 newsp = regs.regs[5]; 1339 newsp = regs.regs[5];
1412 if (!newsp) 1340 if (!newsp)
1413 newsp = regs.regs[29]; 1341 newsp = regs.regs[29];
1414 parent_tidptr = (int *) regs.regs[6]; 1342 parent_tidptr = (int __user *) regs.regs[6];
1415 1343
1416 /* Use __dummy4 instead of getting it off the stack, so that 1344 /* Use __dummy4 instead of getting it off the stack, so that
1417 syscall() works. */ 1345 syscall() works. */
diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c
index 86fe15b273cd..84ab959f924a 100644
--- a/arch/mips/kernel/proc.c
+++ b/arch/mips/kernel/proc.c
@@ -135,6 +135,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
135 cpu_has_vce ? "%u" : "not available"); 135 cpu_has_vce ? "%u" : "not available");
136 seq_printf(m, fmt, 'D', vced_count); 136 seq_printf(m, fmt, 'D', vced_count);
137 seq_printf(m, fmt, 'I', vcei_count); 137 seq_printf(m, fmt, 'I', vcei_count);
138 seq_printf(m, "\n");
138 139
139 return 0; 140 return 0;
140} 141}
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index 092679c2dca9..c66db5e5ab62 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -60,17 +60,9 @@ ATTRIB_NORET void cpu_idle(void)
60 } 60 }
61} 61}
62 62
63extern void do_signal(struct pt_regs *regs);
64extern void do_signal32(struct pt_regs *regs);
65
66/* 63/*
67 * Native o32 and N64 ABI without DSP ASE 64 * Native o32 and N64 ABI without DSP ASE
68 */ 65 */
69extern int setup_frame(struct k_sigaction * ka, struct pt_regs *regs,
70 int signr, sigset_t *set);
71extern int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs,
72 int signr, sigset_t *set, siginfo_t *info);
73
74struct mips_abi mips_abi = { 66struct mips_abi mips_abi = {
75 .do_signal = do_signal, 67 .do_signal = do_signal,
76#ifdef CONFIG_TRAD_SIGNALS 68#ifdef CONFIG_TRAD_SIGNALS
@@ -83,11 +75,6 @@ struct mips_abi mips_abi = {
83/* 75/*
84 * o32 compatibility on 64-bit kernels, without DSP ASE 76 * o32 compatibility on 64-bit kernels, without DSP ASE
85 */ 77 */
86extern int setup_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
87 int signr, sigset_t *set);
88extern int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
89 int signr, sigset_t *set, siginfo_t *info);
90
91struct mips_abi mips_abi_32 = { 78struct mips_abi mips_abi_32 = {
92 .do_signal = do_signal32, 79 .do_signal = do_signal32,
93 .setup_frame = setup_frame_32, 80 .setup_frame = setup_frame_32,
@@ -99,9 +86,6 @@ struct mips_abi mips_abi_32 = {
99/* 86/*
100 * N32 on 64-bit kernels, without DSP ASE 87 * N32 on 64-bit kernels, without DSP ASE
101 */ 88 */
102extern int setup_rt_frame_n32(struct k_sigaction * ka, struct pt_regs *regs,
103 int signr, sigset_t *set, siginfo_t *info);
104
105struct mips_abi mips_abi_n32 = { 89struct mips_abi mips_abi_n32 = {
106 .do_signal = do_signal, 90 .do_signal = do_signal,
107 .setup_rt_frame = setup_rt_frame_n32 91 .setup_rt_frame = setup_rt_frame_n32
@@ -435,4 +419,3 @@ unsigned long get_wchan(struct task_struct *p)
435 return pc; 419 return pc;
436} 420}
437 421
438EXPORT_SYMBOL(get_wchan);
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 02c8267e45e7..05a2c0567dae 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -273,7 +273,7 @@ EXPORT(sysn32_call_table)
273 PTR sys_pivot_root 273 PTR sys_pivot_root
274 PTR sys32_sysctl 274 PTR sys32_sysctl
275 PTR sys_prctl 275 PTR sys_prctl
276 PTR sys32_adjtimex 276 PTR compat_sys_adjtimex
277 PTR compat_sys_setrlimit /* 6155 */ 277 PTR compat_sys_setrlimit /* 6155 */
278 PTR sys_chroot 278 PTR sys_chroot
279 PTR sys_sync 279 PTR sys_sync
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 797e0d874889..19c4ca481b02 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -328,7 +328,7 @@ sys_call_table:
328 PTR sys_setdomainname 328 PTR sys_setdomainname
329 PTR sys32_newuname 329 PTR sys32_newuname
330 PTR sys_ni_syscall /* sys_modify_ldt */ 330 PTR sys_ni_syscall /* sys_modify_ldt */
331 PTR sys32_adjtimex 331 PTR compat_sys_adjtimex
332 PTR sys_mprotect /* 4125 */ 332 PTR sys_mprotect /* 4125 */
333 PTR compat_sys_sigprocmask 333 PTR compat_sys_sigprocmask
334 PTR sys_ni_syscall /* was creat_module */ 334 PTR sys_ni_syscall /* was creat_module */
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index d9293c558e41..dcbfd27071f0 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -34,6 +34,7 @@
34#include <linux/highmem.h> 34#include <linux/highmem.h>
35#include <linux/console.h> 35#include <linux/console.h>
36#include <linux/mmzone.h> 36#include <linux/mmzone.h>
37#include <linux/pfn.h>
37 38
38#include <asm/addrspace.h> 39#include <asm/addrspace.h>
39#include <asm/bootinfo.h> 40#include <asm/bootinfo.h>
@@ -257,10 +258,6 @@ static inline int parse_rd_cmdline(unsigned long* rd_start, unsigned long* rd_en
257 return 0; 258 return 0;
258} 259}
259 260
260#define PFN_UP(x) (((x) + PAGE_SIZE - 1) >> PAGE_SHIFT)
261#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
262#define PFN_PHYS(x) ((x) << PAGE_SHIFT)
263
264#define MAXMEM HIGHMEM_START 261#define MAXMEM HIGHMEM_START
265#define MAXMEM_PFN PFN_DOWN(MAXMEM) 262#define MAXMEM_PFN PFN_DOWN(MAXMEM)
266 263
@@ -447,21 +444,10 @@ static inline void resource_init(void)
447{ 444{
448 int i; 445 int i;
449 446
450#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64)
451 /*
452 * The 64bit code in 32bit object format trick can't represent
453 * 64bit wide relocations for linker script symbols.
454 */
455 code_resource.start = CPHYSADDR(&_text);
456 code_resource.end = CPHYSADDR(&_etext) - 1;
457 data_resource.start = CPHYSADDR(&_etext);
458 data_resource.end = CPHYSADDR(&_edata) - 1;
459#else
460 code_resource.start = virt_to_phys(&_text); 447 code_resource.start = virt_to_phys(&_text);
461 code_resource.end = virt_to_phys(&_etext) - 1; 448 code_resource.end = virt_to_phys(&_etext) - 1;
462 data_resource.start = virt_to_phys(&_etext); 449 data_resource.start = virt_to_phys(&_etext);
463 data_resource.end = virt_to_phys(&_edata) - 1; 450 data_resource.end = virt_to_phys(&_edata) - 1;
464#endif
465 451
466 /* 452 /*
467 * Request address space for all standard RAM. 453 * Request address space for all standard RAM.
@@ -504,10 +490,6 @@ static inline void resource_init(void)
504 } 490 }
505} 491}
506 492
507#undef PFN_UP
508#undef PFN_DOWN
509#undef PFN_PHYS
510
511#undef MAXMEM 493#undef MAXMEM
512#undef MAXMEM_PFN 494#undef MAXMEM_PFN
513 495
diff --git a/arch/mips/kernel/signal-common.h b/arch/mips/kernel/signal-common.h
index 36bfc2588aa3..3ca786215d48 100644
--- a/arch/mips/kernel/signal-common.h
+++ b/arch/mips/kernel/signal-common.h
@@ -166,11 +166,11 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
166 sp = regs->regs[29]; 166 sp = regs->regs[29];
167 167
168 /* 168 /*
169 * FPU emulator may have it's own trampoline active just 169 * FPU emulator may have it's own trampoline active just
170 * above the user stack, 16-bytes before the next lowest 170 * above the user stack, 16-bytes before the next lowest
171 * 16 byte boundary. Try to avoid trashing it. 171 * 16 byte boundary. Try to avoid trashing it.
172 */ 172 */
173 sp -= 32; 173 sp -= 32;
174 174
175 /* This is the X/Open sanctioned signal stack switching. */ 175 /* This is the X/Open sanctioned signal stack switching. */
176 if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0)) 176 if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0))
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index c974cc9b30eb..402efd27c79e 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -100,8 +100,8 @@ _sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
100} 100}
101 101
102#ifdef CONFIG_TRAD_SIGNALS 102#ifdef CONFIG_TRAD_SIGNALS
103asmlinkage int sys_sigaction(int sig, const struct sigaction *act, 103asmlinkage int sys_sigaction(int sig, const struct sigaction __user *act,
104 struct sigaction *oact) 104 struct sigaction __user *oact)
105{ 105{
106 struct k_sigaction new_ka, old_ka; 106 struct k_sigaction new_ka, old_ka;
107 int ret; 107 int ret;
@@ -331,7 +331,7 @@ int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs,
331 /* Create the ucontext. */ 331 /* Create the ucontext. */
332 err |= __put_user(0, &frame->rs_uc.uc_flags); 332 err |= __put_user(0, &frame->rs_uc.uc_flags);
333 err |= __put_user(NULL, &frame->rs_uc.uc_link); 333 err |= __put_user(NULL, &frame->rs_uc.uc_link);
334 err |= __put_user((void *)current->sas_ss_sp, 334 err |= __put_user((void __user *)current->sas_ss_sp,
335 &frame->rs_uc.uc_stack.ss_sp); 335 &frame->rs_uc.uc_stack.ss_sp);
336 err |= __put_user(sas_ss_flags(regs->regs[29]), 336 err |= __put_user(sas_ss_flags(regs->regs[29]),
337 &frame->rs_uc.uc_stack.ss_flags); 337 &frame->rs_uc.uc_stack.ss_flags);
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index 237cd8a2cd32..f32a22997c3d 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -163,7 +163,7 @@ static inline int put_sigset(const sigset_t *kbuf, compat_sigset_t __user *ubuf)
163 return err; 163 return err;
164} 164}
165 165
166static inline int get_sigset(sigset_t *kbuf, const compat_sigset_t *ubuf) 166static inline int get_sigset(sigset_t *kbuf, const compat_sigset_t __user *ubuf)
167{ 167{
168 int err = 0; 168 int err = 0;
169 unsigned long sig[4]; 169 unsigned long sig[4];
@@ -195,10 +195,10 @@ save_static_function(sys32_sigsuspend);
195__attribute_used__ noinline static int 195__attribute_used__ noinline static int
196_sys32_sigsuspend(nabi_no_regargs struct pt_regs regs) 196_sys32_sigsuspend(nabi_no_regargs struct pt_regs regs)
197{ 197{
198 compat_sigset_t *uset; 198 compat_sigset_t __user *uset;
199 sigset_t newset; 199 sigset_t newset;
200 200
201 uset = (compat_sigset_t *) regs.regs[4]; 201 uset = (compat_sigset_t __user *) regs.regs[4];
202 if (get_sigset(&newset, uset)) 202 if (get_sigset(&newset, uset))
203 return -EFAULT; 203 return -EFAULT;
204 sigdelsetmask(&newset, ~_BLOCKABLE); 204 sigdelsetmask(&newset, ~_BLOCKABLE);
@@ -219,7 +219,7 @@ save_static_function(sys32_rt_sigsuspend);
219__attribute_used__ noinline static int 219__attribute_used__ noinline static int
220_sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) 220_sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
221{ 221{
222 compat_sigset_t *uset; 222 compat_sigset_t __user *uset;
223 sigset_t newset; 223 sigset_t newset;
224 size_t sigsetsize; 224 size_t sigsetsize;
225 225
@@ -228,7 +228,7 @@ _sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
228 if (sigsetsize != sizeof(compat_sigset_t)) 228 if (sigsetsize != sizeof(compat_sigset_t))
229 return -EINVAL; 229 return -EINVAL;
230 230
231 uset = (compat_sigset_t *) regs.regs[4]; 231 uset = (compat_sigset_t __user *) regs.regs[4];
232 if (get_sigset(&newset, uset)) 232 if (get_sigset(&newset, uset))
233 return -EFAULT; 233 return -EFAULT;
234 sigdelsetmask(&newset, ~_BLOCKABLE); 234 sigdelsetmask(&newset, ~_BLOCKABLE);
@@ -236,7 +236,7 @@ _sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
236 spin_lock_irq(&current->sighand->siglock); 236 spin_lock_irq(&current->sighand->siglock);
237 current->saved_sigmask = current->blocked; 237 current->saved_sigmask = current->blocked;
238 current->blocked = newset; 238 current->blocked = newset;
239 recalc_sigpending(); 239 recalc_sigpending();
240 spin_unlock_irq(&current->sighand->siglock); 240 spin_unlock_irq(&current->sighand->siglock);
241 241
242 current->state = TASK_INTERRUPTIBLE; 242 current->state = TASK_INTERRUPTIBLE;
@@ -245,8 +245,8 @@ _sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
245 return -ERESTARTNOHAND; 245 return -ERESTARTNOHAND;
246} 246}
247 247
248asmlinkage int sys32_sigaction(int sig, const struct sigaction32 *act, 248asmlinkage int sys32_sigaction(int sig, const struct sigaction32 __user *act,
249 struct sigaction32 *oact) 249 struct sigaction32 __user *oact)
250{ 250{
251 struct k_sigaction new_ka, old_ka; 251 struct k_sigaction new_ka, old_ka;
252 int ret; 252 int ret;
@@ -272,15 +272,15 @@ asmlinkage int sys32_sigaction(int sig, const struct sigaction32 *act,
272 272
273 if (!ret && oact) { 273 if (!ret && oact) {
274 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact))) 274 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)))
275 return -EFAULT; 275 return -EFAULT;
276 err |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags); 276 err |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
277 err |= __put_user((u32)(u64)old_ka.sa.sa_handler, 277 err |= __put_user((u32)(u64)old_ka.sa.sa_handler,
278 &oact->sa_handler); 278 &oact->sa_handler);
279 err |= __put_user(old_ka.sa.sa_mask.sig[0], oact->sa_mask.sig); 279 err |= __put_user(old_ka.sa.sa_mask.sig[0], oact->sa_mask.sig);
280 err |= __put_user(0, &oact->sa_mask.sig[1]); 280 err |= __put_user(0, &oact->sa_mask.sig[1]);
281 err |= __put_user(0, &oact->sa_mask.sig[2]); 281 err |= __put_user(0, &oact->sa_mask.sig[2]);
282 err |= __put_user(0, &oact->sa_mask.sig[3]); 282 err |= __put_user(0, &oact->sa_mask.sig[3]);
283 if (err) 283 if (err)
284 return -EFAULT; 284 return -EFAULT;
285 } 285 }
286 286
@@ -301,7 +301,7 @@ asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs)
301 if (!access_ok(VERIFY_READ, uss, sizeof(*uss))) 301 if (!access_ok(VERIFY_READ, uss, sizeof(*uss)))
302 return -EFAULT; 302 return -EFAULT;
303 err |= __get_user(sp, &uss->ss_sp); 303 err |= __get_user(sp, &uss->ss_sp);
304 kss.ss_sp = (void *) (long) sp; 304 kss.ss_sp = (void __user *) (long) sp;
305 err |= __get_user(kss.ss_size, &uss->ss_size); 305 err |= __get_user(kss.ss_size, &uss->ss_size);
306 err |= __get_user(kss.ss_flags, &uss->ss_flags); 306 err |= __get_user(kss.ss_flags, &uss->ss_flags);
307 if (err) 307 if (err)
@@ -316,7 +316,7 @@ asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs)
316 if (!ret && uoss) { 316 if (!ret && uoss) {
317 if (!access_ok(VERIFY_WRITE, uoss, sizeof(*uoss))) 317 if (!access_ok(VERIFY_WRITE, uoss, sizeof(*uoss)))
318 return -EFAULT; 318 return -EFAULT;
319 sp = (int) (long) koss.ss_sp; 319 sp = (int) (unsigned long) koss.ss_sp;
320 err |= __put_user(sp, &uoss->ss_sp); 320 err |= __put_user(sp, &uoss->ss_sp);
321 err |= __put_user(koss.ss_size, &uoss->ss_size); 321 err |= __put_user(koss.ss_size, &uoss->ss_size);
322 err |= __put_user(koss.ss_flags, &uoss->ss_flags); 322 err |= __put_user(koss.ss_flags, &uoss->ss_flags);
@@ -527,7 +527,7 @@ _sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
527 /* The ucontext contains a stack32_t, so we must convert! */ 527 /* The ucontext contains a stack32_t, so we must convert! */
528 if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp)) 528 if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp))
529 goto badframe; 529 goto badframe;
530 st.ss_sp = (void *)(long) sp; 530 st.ss_sp = (void __user *)(long) sp;
531 if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size)) 531 if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size))
532 goto badframe; 532 goto badframe;
533 if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags)) 533 if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags))
@@ -624,11 +624,11 @@ static inline void __user *get_sigframe(struct k_sigaction *ka,
624 sp = regs->regs[29]; 624 sp = regs->regs[29];
625 625
626 /* 626 /*
627 * FPU emulator may have it's own trampoline active just 627 * FPU emulator may have it's own trampoline active just
628 * above the user stack, 16-bytes before the next lowest 628 * above the user stack, 16-bytes before the next lowest
629 * 16 byte boundary. Try to avoid trashing it. 629 * 16 byte boundary. Try to avoid trashing it.
630 */ 630 */
631 sp -= 32; 631 sp -= 32;
632 632
633 /* This is the X/Open sanctioned signal stack switching. */ 633 /* This is the X/Open sanctioned signal stack switching. */
634 if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0)) 634 if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0))
@@ -868,7 +868,7 @@ no_signal:
868 } 868 }
869} 869}
870 870
871asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 *act, 871asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 __user *act,
872 struct sigaction32 __user *oact, 872 struct sigaction32 __user *oact,
873 unsigned int sigsetsize) 873 unsigned int sigsetsize)
874{ 874{
@@ -912,7 +912,7 @@ out:
912 return ret; 912 return ret;
913} 913}
914 914
915asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set, 915asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t __user *set,
916 compat_sigset_t __user *oset, unsigned int sigsetsize) 916 compat_sigset_t __user *oset, unsigned int sigsetsize)
917{ 917{
918 sigset_t old_set, new_set; 918 sigset_t old_set, new_set;
diff --git a/arch/mips/kernel/signal_n32.c b/arch/mips/kernel/signal_n32.c
index 3e168c08a3a8..477c5334ec1b 100644
--- a/arch/mips/kernel/signal_n32.c
+++ b/arch/mips/kernel/signal_n32.c
@@ -87,7 +87,8 @@ save_static_function(sysn32_rt_sigsuspend);
87__attribute_used__ noinline static int 87__attribute_used__ noinline static int
88_sysn32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) 88_sysn32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
89{ 89{
90 compat_sigset_t __user *unewset, uset; 90 compat_sigset_t __user *unewset;
91 compat_sigset_t uset;
91 size_t sigsetsize; 92 size_t sigsetsize;
92 sigset_t newset; 93 sigset_t newset;
93 94
@@ -141,7 +142,7 @@ _sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
141 /* The ucontext contains a stack32_t, so we must convert! */ 142 /* The ucontext contains a stack32_t, so we must convert! */
142 if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp)) 143 if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp))
143 goto badframe; 144 goto badframe;
144 st.ss_sp = (void *)(long) sp; 145 st.ss_sp = (void __user *)(long) sp;
145 if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size)) 146 if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size))
146 goto badframe; 147 goto badframe;
147 if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags)) 148 if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags))
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 06ed90752424..78d171bfa331 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -167,8 +167,8 @@ int smp_call_function (void (*func) (void *info), void *info, int retry,
167 mb(); 167 mb();
168 168
169 /* Send a message to all other CPUs and wait for them to respond */ 169 /* Send a message to all other CPUs and wait for them to respond */
170 for (i = 0; i < NR_CPUS; i++) 170 for_each_online_cpu(i)
171 if (cpu_online(i) && i != cpu) 171 if (i != cpu)
172 core_send_ipi(i, SMP_CALL_FUNCTION); 172 core_send_ipi(i, SMP_CALL_FUNCTION);
173 173
174 /* Wait for response */ 174 /* Wait for response */
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index 1da2eeb3ef9e..2aeaa2fd4b32 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -162,7 +162,10 @@ asmlinkage unsigned long
162sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot, 162sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
163 unsigned long flags, unsigned long fd, unsigned long pgoff) 163 unsigned long flags, unsigned long fd, unsigned long pgoff)
164{ 164{
165 return do_mmap2(addr, len, prot, flags, fd, pgoff); 165 if (pgoff & (~PAGE_MASK >> 12))
166 return -EINVAL;
167
168 return do_mmap2(addr, len, prot, flags, fd, pgoff >> (PAGE_SHIFT-12));
166} 169}
167 170
168save_static_function(sys_fork); 171save_static_function(sys_fork);
@@ -345,7 +348,7 @@ asmlinkage int sys_ipc (uint call, int first, int second,
345 union semun fourth; 348 union semun fourth;
346 if (!ptr) 349 if (!ptr)
347 return -EINVAL; 350 return -EINVAL;
348 if (get_user(fourth.__pad, (void *__user *) ptr)) 351 if (get_user(fourth.__pad, (void __user *__user *) ptr))
349 return -EFAULT; 352 return -EFAULT;
350 return sys_semctl (first, second, third, fourth); 353 return sys_semctl (first, second, third, fourth);
351 } 354 }
diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c
index 0fc3730a294f..5407b784cd01 100644
--- a/arch/mips/kernel/sysirix.c
+++ b/arch/mips/kernel/sysirix.c
@@ -645,27 +645,7 @@ static inline void getitimer_real(struct itimerval *value)
645 645
646asmlinkage unsigned int irix_alarm(unsigned int seconds) 646asmlinkage unsigned int irix_alarm(unsigned int seconds)
647{ 647{
648 struct itimerval it_new, it_old; 648 return alarm_setitimer(seconds);
649 unsigned int oldalarm;
650
651 if (!seconds) {
652 getitimer_real(&it_old);
653 del_timer(&current->real_timer);
654 } else {
655 it_new.it_interval.tv_sec = it_new.it_interval.tv_usec = 0;
656 it_new.it_value.tv_sec = seconds;
657 it_new.it_value.tv_usec = 0;
658 do_setitimer(ITIMER_REAL, &it_new, &it_old);
659 }
660 oldalarm = it_old.it_value.tv_sec;
661 /*
662 * ehhh.. We can't return 0 if we have an alarm pending ...
663 * And we'd better return too much than too little anyway
664 */
665 if (it_old.it_value.tv_usec)
666 oldalarm++;
667
668 return oldalarm;
669} 649}
670 650
671asmlinkage int irix_pause(void) 651asmlinkage int irix_pause(void)
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index 42c94c771afb..5e51a2d8f3f0 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -65,9 +65,9 @@ static int null_rtc_set_time(unsigned long sec)
65 return 0; 65 return 0;
66} 66}
67 67
68unsigned long (*rtc_get_time)(void) = null_rtc_get_time; 68unsigned long (*rtc_mips_get_time)(void) = null_rtc_get_time;
69int (*rtc_set_time)(unsigned long) = null_rtc_set_time; 69int (*rtc_mips_set_time)(unsigned long) = null_rtc_set_time;
70int (*rtc_set_mmss)(unsigned long); 70int (*rtc_mips_set_mmss)(unsigned long);
71 71
72 72
73/* usecs per counter cycle, shifted to left by 32 bits */ 73/* usecs per counter cycle, shifted to left by 32 bits */
@@ -424,6 +424,8 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
424 unsigned long j; 424 unsigned long j;
425 unsigned int count; 425 unsigned int count;
426 426
427 write_seqlock(&xtime_lock);
428
427 count = mips_hpt_read(); 429 count = mips_hpt_read();
428 mips_timer_ack(); 430 mips_timer_ack();
429 431
@@ -438,22 +440,20 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
438 440
439 /* 441 /*
440 * If we have an externally synchronized Linux clock, then update 442 * If we have an externally synchronized Linux clock, then update
441 * CMOS clock accordingly every ~11 minutes. rtc_set_time() has to be 443 * CMOS clock accordingly every ~11 minutes. rtc_mips_set_time() has to be
442 * called as close as possible to 500 ms before the new second starts. 444 * called as close as possible to 500 ms before the new second starts.
443 */ 445 */
444 write_seqlock(&xtime_lock);
445 if (ntp_synced() && 446 if (ntp_synced() &&
446 xtime.tv_sec > last_rtc_update + 660 && 447 xtime.tv_sec > last_rtc_update + 660 &&
447 (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 && 448 (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 &&
448 (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) { 449 (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) {
449 if (rtc_set_mmss(xtime.tv_sec) == 0) { 450 if (rtc_mips_set_mmss(xtime.tv_sec) == 0) {
450 last_rtc_update = xtime.tv_sec; 451 last_rtc_update = xtime.tv_sec;
451 } else { 452 } else {
452 /* do it again in 60 s */ 453 /* do it again in 60 s */
453 last_rtc_update = xtime.tv_sec - 600; 454 last_rtc_update = xtime.tv_sec - 600;
454 } 455 }
455 } 456 }
456 write_sequnlock(&xtime_lock);
457 457
458 /* 458 /*
459 * If jiffies has overflown in this timer_interrupt, we must 459 * If jiffies has overflown in this timer_interrupt, we must
@@ -496,6 +496,8 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
496 } 496 }
497 } 497 }
498 498
499 write_sequnlock(&xtime_lock);
500
499 /* 501 /*
500 * In UP mode, we call local_timer_interrupt() to do profiling 502 * In UP mode, we call local_timer_interrupt() to do profiling
501 * and process accouting. 503 * and process accouting.
@@ -563,7 +565,7 @@ asmlinkage void ll_local_timer_interrupt(int irq, struct pt_regs *regs)
563 * b) (optional) calibrate and set the mips_hpt_frequency 565 * b) (optional) calibrate and set the mips_hpt_frequency
564 * (only needed if you intended to use fixed_rate_gettimeoffset 566 * (only needed if you intended to use fixed_rate_gettimeoffset
565 * or use cpu counter as timer interrupt source) 567 * or use cpu counter as timer interrupt source)
566 * 2) setup xtime based on rtc_get_time(). 568 * 2) setup xtime based on rtc_mips_get_time().
567 * 3) choose a appropriate gettimeoffset routine. 569 * 3) choose a appropriate gettimeoffset routine.
568 * 4) calculate a couple of cached variables for later usage 570 * 4) calculate a couple of cached variables for later usage
569 * 5) board_timer_setup() - 571 * 5) board_timer_setup() -
@@ -631,10 +633,10 @@ void __init time_init(void)
631 if (board_time_init) 633 if (board_time_init)
632 board_time_init(); 634 board_time_init();
633 635
634 if (!rtc_set_mmss) 636 if (!rtc_mips_set_mmss)
635 rtc_set_mmss = rtc_set_time; 637 rtc_mips_set_mmss = rtc_mips_set_time;
636 638
637 xtime.tv_sec = rtc_get_time(); 639 xtime.tv_sec = rtc_mips_get_time();
638 xtime.tv_nsec = 0; 640 xtime.tv_nsec = 0;
639 641
640 set_normalized_timespec(&wall_to_monotonic, 642 set_normalized_timespec(&wall_to_monotonic,
@@ -770,8 +772,8 @@ void to_tm(unsigned long tim, struct rtc_time *tm)
770 772
771EXPORT_SYMBOL(rtc_lock); 773EXPORT_SYMBOL(rtc_lock);
772EXPORT_SYMBOL(to_tm); 774EXPORT_SYMBOL(to_tm);
773EXPORT_SYMBOL(rtc_set_time); 775EXPORT_SYMBOL(rtc_mips_set_time);
774EXPORT_SYMBOL(rtc_get_time); 776EXPORT_SYMBOL(rtc_mips_get_time);
775 777
776unsigned long long sched_clock(void) 778unsigned long long sched_clock(void)
777{ 779{
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 005debbfbe84..bed0eb6cf55d 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -576,7 +576,7 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)
576 } 576 }
577#endif 577#endif
578 /* 578 /*
579 * Unimplemented operation exception. If we've got the full 579 * Unimplemented operation exception. If we've got the full
580 * software emulator on-board, let's use it... 580 * software emulator on-board, let's use it...
581 * 581 *
582 * Force FPU to dump state into task/thread context. We're 582 * Force FPU to dump state into task/thread context. We're