aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/sys_ppc32.c
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2005-10-18 00:51:57 -0400
committerStephen Rothwell <sfr@canb.auug.org.au>2005-10-18 00:51:57 -0400
commitb09a4913b15d2544f8918f05b9937cb4e99a2319 (patch)
treeed8e4764e6358f18e5641f6fba5815ea88ac1f5e /arch/powerpc/kernel/sys_ppc32.c
parent81e7009ea46c951860b8716ee427ff4f54dd26fc (diff)
powerpc: change sys32_ to compat_sys_
This allows us to get rid of one type of entry in systbl.S. In passing we remove the duplicate compat_sys_getdents and compat_sys_utimes for which there are generic versions. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Diffstat (limited to 'arch/powerpc/kernel/sys_ppc32.c')
-rw-r--r--arch/powerpc/kernel/sys_ppc32.c216
1 files changed, 52 insertions, 164 deletions
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index 9babe055356e..501333f89d23 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -113,96 +113,6 @@ out:
113 return error; 113 return error;
114} 114}
115 115
116struct linux_dirent32 {
117 u32 d_ino;
118 u32 d_off;
119 unsigned short d_reclen;
120 char d_name[1];
121};
122
123struct getdents_callback32 {
124 struct linux_dirent32 __user * current_dir;
125 struct linux_dirent32 __user * previous;
126 int count;
127 int error;
128};
129
130static int filldir(void * __buf, const char * name, int namlen, off_t offset,
131 ino_t ino, unsigned int d_type)
132{
133 struct linux_dirent32 __user * dirent;
134 struct getdents_callback32 * buf = (struct getdents_callback32 *) __buf;
135 int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 2);
136
137 buf->error = -EINVAL; /* only used if we fail.. */
138 if (reclen > buf->count)
139 return -EINVAL;
140 dirent = buf->previous;
141 if (dirent) {
142 if (__put_user(offset, &dirent->d_off))
143 goto efault;
144 }
145 dirent = buf->current_dir;
146 if (__put_user(ino, &dirent->d_ino))
147 goto efault;
148 if (__put_user(reclen, &dirent->d_reclen))
149 goto efault;
150 if (copy_to_user(dirent->d_name, name, namlen))
151 goto efault;
152 if (__put_user(0, dirent->d_name + namlen))
153 goto efault;
154 if (__put_user(d_type, (char __user *) dirent + reclen - 1))
155 goto efault;
156 buf->previous = dirent;
157 dirent = (void __user *)dirent + reclen;
158 buf->current_dir = dirent;
159 buf->count -= reclen;
160 return 0;
161efault:
162 buf->error = -EFAULT;
163 return -EFAULT;
164}
165
166asmlinkage long sys32_getdents(unsigned int fd, struct linux_dirent32 __user *dirent,
167 unsigned int count)
168{
169 struct file * file;
170 struct linux_dirent32 __user * lastdirent;
171 struct getdents_callback32 buf;
172 int error;
173
174 error = -EFAULT;
175 if (!access_ok(VERIFY_WRITE, dirent, count))
176 goto out;
177
178 error = -EBADF;
179 file = fget(fd);
180 if (!file)
181 goto out;
182
183 buf.current_dir = dirent;
184 buf.previous = NULL;
185 buf.count = count;
186 buf.error = 0;
187
188 error = vfs_readdir(file, (filldir_t)filldir, &buf);
189 if (error < 0)
190 goto out_putf;
191 error = buf.error;
192 lastdirent = buf.previous;
193 if (lastdirent) {
194 if (put_user(file->f_pos, &lastdirent->d_off))
195 error = -EFAULT;
196 else
197 error = count - buf.count;
198 }
199
200out_putf:
201 fput(file);
202out:
203 return error;
204}
205
206asmlinkage long ppc32_select(u32 n, compat_ulong_t __user *inp, 116asmlinkage long ppc32_select(u32 n, compat_ulong_t __user *inp,
207 compat_ulong_t __user *outp, compat_ulong_t __user *exp, 117 compat_ulong_t __user *outp, compat_ulong_t __user *exp,
208 compat_uptr_t tvp_x) 118 compat_uptr_t tvp_x)
@@ -247,7 +157,7 @@ int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
247 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 157 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
248 * and the register representation of a signed int (msr in 64-bit mode) is performed. 158 * and the register representation of a signed int (msr in 64-bit mode) is performed.
249 */ 159 */
250asmlinkage long sys32_sysfs(u32 option, u32 arg1, u32 arg2) 160asmlinkage long compat_sys_sysfs(u32 option, u32 arg1, u32 arg2)
251{ 161{
252 return sys_sysfs((int)option, arg1, arg2); 162 return sys_sysfs((int)option, arg1, arg2);
253} 163}
@@ -269,7 +179,7 @@ struct timex32 {
269extern int do_adjtimex(struct timex *); 179extern int do_adjtimex(struct timex *);
270extern void ppc_adjtimex(void); 180extern void ppc_adjtimex(void);
271 181
272asmlinkage long sys32_adjtimex(struct timex32 __user *utp) 182asmlinkage long compat_sys_adjtimex(struct timex32 __user *utp)
273{ 183{
274 struct timex txc; 184 struct timex txc;
275 int ret; 185 int ret;
@@ -328,7 +238,7 @@ asmlinkage long sys32_adjtimex(struct timex32 __user *utp)
328 return ret; 238 return ret;
329} 239}
330 240
331asmlinkage long sys32_pause(void) 241asmlinkage long compat_sys_pause(void)
332{ 242{
333 current->state = TASK_INTERRUPTIBLE; 243 current->state = TASK_INTERRUPTIBLE;
334 schedule(); 244 schedule();
@@ -374,7 +284,7 @@ struct sysinfo32 {
374 char _f[20-2*sizeof(int)-sizeof(int)]; 284 char _f[20-2*sizeof(int)-sizeof(int)];
375}; 285};
376 286
377asmlinkage long sys32_sysinfo(struct sysinfo32 __user *info) 287asmlinkage long compat_sys_sysinfo(struct sysinfo32 __user *info)
378{ 288{
379 struct sysinfo s; 289 struct sysinfo s;
380 int ret, err; 290 int ret, err;
@@ -431,7 +341,7 @@ asmlinkage long sys32_sysinfo(struct sysinfo32 __user *info)
431 sorts of things, like timeval and itimerval. */ 341 sorts of things, like timeval and itimerval. */
432extern struct timezone sys_tz; 342extern struct timezone sys_tz;
433 343
434asmlinkage long sys32_gettimeofday(struct compat_timeval __user *tv, struct timezone __user *tz) 344asmlinkage long compat_sys_gettimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
435{ 345{
436 if (tv) { 346 if (tv) {
437 struct timeval ktv; 347 struct timeval ktv;
@@ -449,7 +359,7 @@ asmlinkage long sys32_gettimeofday(struct compat_timeval __user *tv, struct time
449 359
450 360
451 361
452asmlinkage long sys32_settimeofday(struct compat_timeval __user *tv, struct timezone __user *tz) 362asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
453{ 363{
454 struct timespec kts; 364 struct timespec kts;
455 struct timezone ktz; 365 struct timezone ktz;
@@ -467,7 +377,7 @@ asmlinkage long sys32_settimeofday(struct compat_timeval __user *tv, struct time
467} 377}
468 378
469#ifdef CONFIG_SYSVIPC 379#ifdef CONFIG_SYSVIPC
470long sys32_ipc(u32 call, u32 first, u32 second, u32 third, compat_uptr_t ptr, 380long compat_sys_ipc(u32 call, u32 first, u32 second, u32 third, compat_uptr_t ptr,
471 u32 fifth) 381 u32 fifth)
472{ 382{
473 int version; 383 int version;
@@ -538,7 +448,7 @@ long sys32_ipc(u32 call, u32 first, u32 second, u32 third, compat_uptr_t ptr,
538 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 448 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
539 * and the register representation of a signed int (msr in 64-bit mode) is performed. 449 * and the register representation of a signed int (msr in 64-bit mode) is performed.
540 */ 450 */
541asmlinkage long sys32_sendfile(u32 out_fd, u32 in_fd, compat_off_t __user * offset, u32 count) 451asmlinkage long compat_sys_sendfile(u32 out_fd, u32 in_fd, compat_off_t __user * offset, u32 count)
542{ 452{
543 mm_segment_t old_fs = get_fs(); 453 mm_segment_t old_fs = get_fs();
544 int ret; 454 int ret;
@@ -560,7 +470,7 @@ asmlinkage long sys32_sendfile(u32 out_fd, u32 in_fd, compat_off_t __user * offs
560 return ret; 470 return ret;
561} 471}
562 472
563asmlinkage int sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset, s32 count) 473asmlinkage int compat_sys_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset, s32 count)
564{ 474{
565 mm_segment_t old_fs = get_fs(); 475 mm_segment_t old_fs = get_fs();
566 int ret; 476 int ret;
@@ -582,7 +492,7 @@ asmlinkage int sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *off
582 return ret; 492 return ret;
583} 493}
584 494
585long sys32_execve(unsigned long a0, unsigned long a1, unsigned long a2, 495long compat_sys_execve(unsigned long a0, unsigned long a1, unsigned long a2,
586 unsigned long a3, unsigned long a4, unsigned long a5, 496 unsigned long a3, unsigned long a4, unsigned long a5,
587 struct pt_regs *regs) 497 struct pt_regs *regs)
588{ 498{
@@ -614,7 +524,7 @@ out:
614 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 524 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
615 * and the register representation of a signed int (msr in 64-bit mode) is performed. 525 * and the register representation of a signed int (msr in 64-bit mode) is performed.
616 */ 526 */
617asmlinkage long sys32_prctl(u32 option, u32 arg2, u32 arg3, u32 arg4, u32 arg5) 527asmlinkage long compat_sys_prctl(u32 option, u32 arg2, u32 arg3, u32 arg4, u32 arg5)
618{ 528{
619 return sys_prctl((int)option, 529 return sys_prctl((int)option,
620 (unsigned long) arg2, 530 (unsigned long) arg2,
@@ -628,7 +538,7 @@ asmlinkage long sys32_prctl(u32 option, u32 arg2, u32 arg3, u32 arg4, u32 arg5)
628 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 538 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
629 * and the register representation of a signed int (msr in 64-bit mode) is performed. 539 * and the register representation of a signed int (msr in 64-bit mode) is performed.
630 */ 540 */
631asmlinkage long sys32_sched_rr_get_interval(u32 pid, struct compat_timespec __user *interval) 541asmlinkage long compat_sys_sched_rr_get_interval(u32 pid, struct compat_timespec __user *interval)
632{ 542{
633 struct timespec t; 543 struct timespec t;
634 int ret; 544 int ret;
@@ -643,7 +553,7 @@ asmlinkage long sys32_sched_rr_get_interval(u32 pid, struct compat_timespec __us
643 return ret; 553 return ret;
644} 554}
645 555
646asmlinkage int sys32_pciconfig_read(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf) 556asmlinkage int compat_sys_pciconfig_read(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf)
647{ 557{
648 return sys_pciconfig_read((unsigned long) bus, 558 return sys_pciconfig_read((unsigned long) bus,
649 (unsigned long) dfn, 559 (unsigned long) dfn,
@@ -652,7 +562,7 @@ asmlinkage int sys32_pciconfig_read(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf
652 compat_ptr(ubuf)); 562 compat_ptr(ubuf));
653} 563}
654 564
655asmlinkage int sys32_pciconfig_write(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf) 565asmlinkage int compat_sys_pciconfig_write(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf)
656{ 566{
657 return sys_pciconfig_write((unsigned long) bus, 567 return sys_pciconfig_write((unsigned long) bus,
658 (unsigned long) dfn, 568 (unsigned long) dfn,
@@ -661,7 +571,7 @@ asmlinkage int sys32_pciconfig_write(u32 bus, u32 dfn, u32 off, u32 len, u32 ubu
661 compat_ptr(ubuf)); 571 compat_ptr(ubuf));
662} 572}
663 573
664asmlinkage int sys32_pciconfig_iobase(u32 which, u32 in_bus, u32 in_devfn) 574asmlinkage int compat_sys_pciconfig_iobase(u32 which, u32 in_bus, u32 in_devfn)
665{ 575{
666 return sys_pciconfig_iobase(which, in_bus, in_devfn); 576 return sys_pciconfig_iobase(which, in_bus, in_devfn);
667} 577}
@@ -672,7 +582,7 @@ asmlinkage int sys32_pciconfig_iobase(u32 which, u32 in_bus, u32 in_devfn)
672 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 582 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
673 * and the register representation of a signed int (msr in 64-bit mode) is performed. 583 * and the register representation of a signed int (msr in 64-bit mode) is performed.
674 */ 584 */
675asmlinkage long sys32_access(const char __user * filename, u32 mode) 585asmlinkage long compat_sys_access(const char __user * filename, u32 mode)
676{ 586{
677 return sys_access(filename, (int)mode); 587 return sys_access(filename, (int)mode);
678} 588}
@@ -683,7 +593,7 @@ asmlinkage long sys32_access(const char __user * filename, u32 mode)
683 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 593 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
684 * and the register representation of a signed int (msr in 64-bit mode) is performed. 594 * and the register representation of a signed int (msr in 64-bit mode) is performed.
685 */ 595 */
686asmlinkage long sys32_creat(const char __user * pathname, u32 mode) 596asmlinkage long compat_sys_creat(const char __user * pathname, u32 mode)
687{ 597{
688 return sys_creat(pathname, (int)mode); 598 return sys_creat(pathname, (int)mode);
689} 599}
@@ -694,7 +604,7 @@ asmlinkage long sys32_creat(const char __user * pathname, u32 mode)
694 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 604 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
695 * and the register representation of a signed int (msr in 64-bit mode) is performed. 605 * and the register representation of a signed int (msr in 64-bit mode) is performed.
696 */ 606 */
697asmlinkage long sys32_waitpid(u32 pid, unsigned int __user * stat_addr, u32 options) 607asmlinkage long compat_sys_waitpid(u32 pid, unsigned int __user * stat_addr, u32 options)
698{ 608{
699 return sys_waitpid((int)pid, stat_addr, (int)options); 609 return sys_waitpid((int)pid, stat_addr, (int)options);
700} 610}
@@ -705,7 +615,7 @@ asmlinkage long sys32_waitpid(u32 pid, unsigned int __user * stat_addr, u32 opti
705 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 615 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
706 * and the register representation of a signed int (msr in 64-bit mode) is performed. 616 * and the register representation of a signed int (msr in 64-bit mode) is performed.
707 */ 617 */
708asmlinkage long sys32_getgroups(u32 gidsetsize, gid_t __user *grouplist) 618asmlinkage long compat_sys_getgroups(u32 gidsetsize, gid_t __user *grouplist)
709{ 619{
710 return sys_getgroups((int)gidsetsize, grouplist); 620 return sys_getgroups((int)gidsetsize, grouplist);
711} 621}
@@ -716,7 +626,7 @@ asmlinkage long sys32_getgroups(u32 gidsetsize, gid_t __user *grouplist)
716 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 626 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
717 * and the register representation of a signed int (msr in 64-bit mode) is performed. 627 * and the register representation of a signed int (msr in 64-bit mode) is performed.
718 */ 628 */
719asmlinkage long sys32_getpgid(u32 pid) 629asmlinkage long compat_sys_getpgid(u32 pid)
720{ 630{
721 return sys_getpgid((int)pid); 631 return sys_getpgid((int)pid);
722} 632}
@@ -728,7 +638,7 @@ asmlinkage long sys32_getpgid(u32 pid)
728 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 638 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
729 * and the register representation of a signed int (msr in 64-bit mode) is performed. 639 * and the register representation of a signed int (msr in 64-bit mode) is performed.
730 */ 640 */
731asmlinkage long sys32_getsid(u32 pid) 641asmlinkage long compat_sys_getsid(u32 pid)
732{ 642{
733 return sys_getsid((int)pid); 643 return sys_getsid((int)pid);
734} 644}
@@ -739,7 +649,7 @@ asmlinkage long sys32_getsid(u32 pid)
739 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 649 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
740 * and the register representation of a signed int (msr in 64-bit mode) is performed. 650 * and the register representation of a signed int (msr in 64-bit mode) is performed.
741 */ 651 */
742asmlinkage long sys32_kill(u32 pid, u32 sig) 652asmlinkage long compat_sys_kill(u32 pid, u32 sig)
743{ 653{
744 return sys_kill((int)pid, (int)sig); 654 return sys_kill((int)pid, (int)sig);
745} 655}
@@ -750,12 +660,12 @@ asmlinkage long sys32_kill(u32 pid, u32 sig)
750 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 660 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
751 * and the register representation of a signed int (msr in 64-bit mode) is performed. 661 * and the register representation of a signed int (msr in 64-bit mode) is performed.
752 */ 662 */
753asmlinkage long sys32_mkdir(const char __user * pathname, u32 mode) 663asmlinkage long compat_sys_mkdir(const char __user * pathname, u32 mode)
754{ 664{
755 return sys_mkdir(pathname, (int)mode); 665 return sys_mkdir(pathname, (int)mode);
756} 666}
757 667
758long sys32_nice(u32 increment) 668long compat_sys_nice(u32 increment)
759{ 669{
760 /* sign extend increment */ 670 /* sign extend increment */
761 return sys_nice((int)increment); 671 return sys_nice((int)increment);
@@ -772,7 +682,7 @@ off_t ppc32_lseek(unsigned int fd, u32 offset, unsigned int origin)
772 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 682 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
773 * and the register representation of a signed int (msr in 64-bit mode) is performed. 683 * and the register representation of a signed int (msr in 64-bit mode) is performed.
774 */ 684 */
775asmlinkage long sys32_readlink(const char __user * path, char __user * buf, u32 bufsiz) 685asmlinkage long compat_sys_readlink(const char __user * path, char __user * buf, u32 bufsiz)
776{ 686{
777 return sys_readlink(path, buf, (int)bufsiz); 687 return sys_readlink(path, buf, (int)bufsiz);
778} 688}
@@ -782,7 +692,7 @@ asmlinkage long sys32_readlink(const char __user * path, char __user * buf, u32
782 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 692 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
783 * and the register representation of a signed int (msr in 64-bit mode) is performed. 693 * and the register representation of a signed int (msr in 64-bit mode) is performed.
784 */ 694 */
785asmlinkage long sys32_sched_get_priority_max(u32 policy) 695asmlinkage long compat_sys_sched_get_priority_max(u32 policy)
786{ 696{
787 return sys_sched_get_priority_max((int)policy); 697 return sys_sched_get_priority_max((int)policy);
788} 698}
@@ -793,7 +703,7 @@ asmlinkage long sys32_sched_get_priority_max(u32 policy)
793 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 703 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
794 * and the register representation of a signed int (msr in 64-bit mode) is performed. 704 * and the register representation of a signed int (msr in 64-bit mode) is performed.
795 */ 705 */
796asmlinkage long sys32_sched_get_priority_min(u32 policy) 706asmlinkage long compat_sys_sched_get_priority_min(u32 policy)
797{ 707{
798 return sys_sched_get_priority_min((int)policy); 708 return sys_sched_get_priority_min((int)policy);
799} 709}
@@ -804,7 +714,7 @@ asmlinkage long sys32_sched_get_priority_min(u32 policy)
804 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 714 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
805 * and the register representation of a signed int (msr in 64-bit mode) is performed. 715 * and the register representation of a signed int (msr in 64-bit mode) is performed.
806 */ 716 */
807asmlinkage long sys32_sched_getparam(u32 pid, struct sched_param __user *param) 717asmlinkage long compat_sys_sched_getparam(u32 pid, struct sched_param __user *param)
808{ 718{
809 return sys_sched_getparam((int)pid, param); 719 return sys_sched_getparam((int)pid, param);
810} 720}
@@ -815,7 +725,7 @@ asmlinkage long sys32_sched_getparam(u32 pid, struct sched_param __user *param)
815 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 725 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
816 * and the register representation of a signed int (msr in 64-bit mode) is performed. 726 * and the register representation of a signed int (msr in 64-bit mode) is performed.
817 */ 727 */
818asmlinkage long sys32_sched_getscheduler(u32 pid) 728asmlinkage long compat_sys_sched_getscheduler(u32 pid)
819{ 729{
820 return sys_sched_getscheduler((int)pid); 730 return sys_sched_getscheduler((int)pid);
821} 731}
@@ -826,7 +736,7 @@ asmlinkage long sys32_sched_getscheduler(u32 pid)
826 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 736 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
827 * and the register representation of a signed int (msr in 64-bit mode) is performed. 737 * and the register representation of a signed int (msr in 64-bit mode) is performed.
828 */ 738 */
829asmlinkage long sys32_sched_setparam(u32 pid, struct sched_param __user *param) 739asmlinkage long compat_sys_sched_setparam(u32 pid, struct sched_param __user *param)
830{ 740{
831 return sys_sched_setparam((int)pid, param); 741 return sys_sched_setparam((int)pid, param);
832} 742}
@@ -837,7 +747,7 @@ asmlinkage long sys32_sched_setparam(u32 pid, struct sched_param __user *param)
837 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 747 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
838 * and the register representation of a signed int (msr in 64-bit mode) is performed. 748 * and the register representation of a signed int (msr in 64-bit mode) is performed.
839 */ 749 */
840asmlinkage long sys32_sched_setscheduler(u32 pid, u32 policy, struct sched_param __user *param) 750asmlinkage long compat_sys_sched_setscheduler(u32 pid, u32 policy, struct sched_param __user *param)
841{ 751{
842 return sys_sched_setscheduler((int)pid, (int)policy, param); 752 return sys_sched_setscheduler((int)pid, (int)policy, param);
843} 753}
@@ -848,7 +758,7 @@ asmlinkage long sys32_sched_setscheduler(u32 pid, u32 policy, struct sched_param
848 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 758 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
849 * and the register representation of a signed int (msr in 64-bit mode) is performed. 759 * and the register representation of a signed int (msr in 64-bit mode) is performed.
850 */ 760 */
851asmlinkage long sys32_setdomainname(char __user *name, u32 len) 761asmlinkage long compat_sys_setdomainname(char __user *name, u32 len)
852{ 762{
853 return sys_setdomainname(name, (int)len); 763 return sys_setdomainname(name, (int)len);
854} 764}
@@ -859,13 +769,13 @@ asmlinkage long sys32_setdomainname(char __user *name, u32 len)
859 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 769 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
860 * and the register representation of a signed int (msr in 64-bit mode) is performed. 770 * and the register representation of a signed int (msr in 64-bit mode) is performed.
861 */ 771 */
862asmlinkage long sys32_setgroups(u32 gidsetsize, gid_t __user *grouplist) 772asmlinkage long compat_sys_setgroups(u32 gidsetsize, gid_t __user *grouplist)
863{ 773{
864 return sys_setgroups((int)gidsetsize, grouplist); 774 return sys_setgroups((int)gidsetsize, grouplist);
865} 775}
866 776
867 777
868asmlinkage long sys32_sethostname(char __user *name, u32 len) 778asmlinkage long compat_sys_sethostname(char __user *name, u32 len)
869{ 779{
870 /* sign extend len */ 780 /* sign extend len */
871 return sys_sethostname(name, (int)len); 781 return sys_sethostname(name, (int)len);
@@ -877,30 +787,30 @@ asmlinkage long sys32_sethostname(char __user *name, u32 len)
877 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 787 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
878 * and the register representation of a signed int (msr in 64-bit mode) is performed. 788 * and the register representation of a signed int (msr in 64-bit mode) is performed.
879 */ 789 */
880asmlinkage long sys32_setpgid(u32 pid, u32 pgid) 790asmlinkage long compat_sys_setpgid(u32 pid, u32 pgid)
881{ 791{
882 return sys_setpgid((int)pid, (int)pgid); 792 return sys_setpgid((int)pid, (int)pgid);
883} 793}
884 794
885long sys32_getpriority(u32 which, u32 who) 795long compat_sys_getpriority(u32 which, u32 who)
886{ 796{
887 /* sign extend which and who */ 797 /* sign extend which and who */
888 return sys_getpriority((int)which, (int)who); 798 return sys_getpriority((int)which, (int)who);
889} 799}
890 800
891long sys32_setpriority(u32 which, u32 who, u32 niceval) 801long compat_sys_setpriority(u32 which, u32 who, u32 niceval)
892{ 802{
893 /* sign extend which, who and niceval */ 803 /* sign extend which, who and niceval */
894 return sys_setpriority((int)which, (int)who, (int)niceval); 804 return sys_setpriority((int)which, (int)who, (int)niceval);
895} 805}
896 806
897long sys32_ioprio_get(u32 which, u32 who) 807long compat_sys_ioprio_get(u32 which, u32 who)
898{ 808{
899 /* sign extend which and who */ 809 /* sign extend which and who */
900 return sys_ioprio_get((int)which, (int)who); 810 return sys_ioprio_get((int)which, (int)who);
901} 811}
902 812
903long sys32_ioprio_set(u32 which, u32 who, u32 ioprio) 813long compat_sys_ioprio_set(u32 which, u32 who, u32 ioprio)
904{ 814{
905 /* sign extend which, who and ioprio */ 815 /* sign extend which, who and ioprio */
906 return sys_ioprio_set((int)which, (int)who, (int)ioprio); 816 return sys_ioprio_set((int)which, (int)who, (int)ioprio);
@@ -911,12 +821,12 @@ long sys32_ioprio_set(u32 which, u32 who, u32 ioprio)
911 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 821 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
912 * and the register representation of a signed int (msr in 64-bit mode) is performed. 822 * and the register representation of a signed int (msr in 64-bit mode) is performed.
913 */ 823 */
914asmlinkage long sys32_ssetmask(u32 newmask) 824asmlinkage long compat_sys_ssetmask(u32 newmask)
915{ 825{
916 return sys_ssetmask((int) newmask); 826 return sys_ssetmask((int) newmask);
917} 827}
918 828
919asmlinkage long sys32_syslog(u32 type, char __user * buf, u32 len) 829asmlinkage long compat_sys_syslog(u32 type, char __user * buf, u32 len)
920{ 830{
921 /* sign extend len */ 831 /* sign extend len */
922 return sys_syslog(type, buf, (int)len); 832 return sys_syslog(type, buf, (int)len);
@@ -928,7 +838,7 @@ asmlinkage long sys32_syslog(u32 type, char __user * buf, u32 len)
928 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 838 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
929 * and the register representation of a signed int (msr in 64-bit mode) is performed. 839 * and the register representation of a signed int (msr in 64-bit mode) is performed.
930 */ 840 */
931asmlinkage long sys32_umask(u32 mask) 841asmlinkage long compat_sys_umask(u32 mask)
932{ 842{
933 return sys_umask((int)mask); 843 return sys_umask((int)mask);
934} 844}
@@ -944,7 +854,7 @@ struct __sysctl_args32 {
944 u32 __unused[4]; 854 u32 __unused[4];
945}; 855};
946 856
947asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args) 857asmlinkage long compat_sys_sysctl(struct __sysctl_args32 __user *args)
948{ 858{
949 struct __sysctl_args32 tmp; 859 struct __sysctl_args32 tmp;
950 int error; 860 int error;
@@ -985,7 +895,7 @@ asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
985} 895}
986#endif 896#endif
987 897
988unsigned long sys32_mmap2(unsigned long addr, size_t len, 898unsigned long compat_sys_mmap2(unsigned long addr, size_t len,
989 unsigned long prot, unsigned long flags, 899 unsigned long prot, unsigned long flags,
990 unsigned long fd, unsigned long pgoff) 900 unsigned long fd, unsigned long pgoff)
991{ 901{
@@ -993,29 +903,7 @@ unsigned long sys32_mmap2(unsigned long addr, size_t len,
993 return sys_mmap(addr, len, prot, flags, fd, pgoff << 12); 903 return sys_mmap(addr, len, prot, flags, fd, pgoff << 12);
994} 904}
995 905
996int get_compat_timeval(struct timeval *tv, struct compat_timeval __user *ctv) 906long compat_sys_tgkill(u32 tgid, u32 pid, int sig)
997{
998 return (!access_ok(VERIFY_READ, ctv, sizeof(*ctv)) ||
999 __get_user(tv->tv_sec, &ctv->tv_sec) ||
1000 __get_user(tv->tv_usec, &ctv->tv_usec)) ? -EFAULT : 0;
1001}
1002
1003asmlinkage long sys32_utimes(char __user *filename, struct compat_timeval __user *tvs)
1004{
1005 struct timeval ktvs[2], *ptr;
1006
1007 ptr = NULL;
1008 if (tvs) {
1009 if (get_compat_timeval(&ktvs[0], &tvs[0]) ||
1010 get_compat_timeval(&ktvs[1], &tvs[1]))
1011 return -EFAULT;
1012 ptr = ktvs;
1013 }
1014
1015 return do_utimes(filename, ptr);
1016}
1017
1018long sys32_tgkill(u32 tgid, u32 pid, int sig)
1019{ 907{
1020 /* sign extend tgid, pid */ 908 /* sign extend tgid, pid */
1021 return sys_tgkill((int)tgid, (int)pid, sig); 909 return sys_tgkill((int)tgid, (int)pid, sig);
@@ -1026,30 +914,30 @@ long sys32_tgkill(u32 tgid, u32 pid, int sig)
1026 * The 32 bit ABI passes long longs in an odd even register pair. 914 * The 32 bit ABI passes long longs in an odd even register pair.
1027 */ 915 */
1028 916
1029compat_ssize_t sys32_pread64(unsigned int fd, char __user *ubuf, compat_size_t count, 917compat_ssize_t compat_sys_pread64(unsigned int fd, char __user *ubuf, compat_size_t count,
1030 u32 reg6, u32 poshi, u32 poslo) 918 u32 reg6, u32 poshi, u32 poslo)
1031{ 919{
1032 return sys_pread64(fd, ubuf, count, ((loff_t)poshi << 32) | poslo); 920 return sys_pread64(fd, ubuf, count, ((loff_t)poshi << 32) | poslo);
1033} 921}
1034 922
1035compat_ssize_t sys32_pwrite64(unsigned int fd, char __user *ubuf, compat_size_t count, 923compat_ssize_t compat_sys_pwrite64(unsigned int fd, char __user *ubuf, compat_size_t count,
1036 u32 reg6, u32 poshi, u32 poslo) 924 u32 reg6, u32 poshi, u32 poslo)
1037{ 925{
1038 return sys_pwrite64(fd, ubuf, count, ((loff_t)poshi << 32) | poslo); 926 return sys_pwrite64(fd, ubuf, count, ((loff_t)poshi << 32) | poslo);
1039} 927}
1040 928
1041compat_ssize_t sys32_readahead(int fd, u32 r4, u32 offhi, u32 offlo, u32 count) 929compat_ssize_t compat_sys_readahead(int fd, u32 r4, u32 offhi, u32 offlo, u32 count)
1042{ 930{
1043 return sys_readahead(fd, ((loff_t)offhi << 32) | offlo, count); 931 return sys_readahead(fd, ((loff_t)offhi << 32) | offlo, count);
1044} 932}
1045 933
1046asmlinkage int sys32_truncate64(const char __user * path, u32 reg4, 934asmlinkage int compat_sys_truncate64(const char __user * path, u32 reg4,
1047 unsigned long high, unsigned long low) 935 unsigned long high, unsigned long low)
1048{ 936{
1049 return sys_truncate(path, (high << 32) | low); 937 return sys_truncate(path, (high << 32) | low);
1050} 938}
1051 939
1052asmlinkage int sys32_ftruncate64(unsigned int fd, u32 reg4, unsigned long high, 940asmlinkage int compat_sys_ftruncate64(unsigned int fd, u32 reg4, unsigned long high,
1053 unsigned long low) 941 unsigned long low)
1054{ 942{
1055 return sys_ftruncate(fd, (high << 32) | low); 943 return sys_ftruncate(fd, (high << 32) | low);
@@ -1108,7 +996,7 @@ long ppc32_timer_create(clockid_t clock,
1108 return err; 996 return err;
1109} 997}
1110 998
1111asmlinkage long sys32_add_key(const char __user *_type, 999asmlinkage long compat_sys_add_key(const char __user *_type,
1112 const char __user *_description, 1000 const char __user *_description,
1113 const void __user *_payload, 1001 const void __user *_payload,
1114 u32 plen, 1002 u32 plen,
@@ -1117,7 +1005,7 @@ asmlinkage long sys32_add_key(const char __user *_type,
1117 return sys_add_key(_type, _description, _payload, plen, ringid); 1005 return sys_add_key(_type, _description, _payload, plen, ringid);
1118} 1006}
1119 1007
1120asmlinkage long sys32_request_key(const char __user *_type, 1008asmlinkage long compat_sys_request_key(const char __user *_type,
1121 const char __user *_description, 1009 const char __user *_description,
1122 const char __user *_callout_info, 1010 const char __user *_callout_info,
1123 u32 destringid) 1011 u32 destringid)