Commit b9421625 authored by David S. Miller's avatar David S. Miller

[SPARC64]: Compat syscall overhaul.

1) Make syscall entry zero-extend all arguments.
2) Sign extend those needed in sys32.S
3) Kill the A() AA() macros, replace with compat_ptr() et al.
parent 20e743bb
...@@ -147,7 +147,6 @@ static int aout32_core_dump(long signr, struct pt_regs *regs, struct file *file) ...@@ -147,7 +147,6 @@ static int aout32_core_dump(long signr, struct pt_regs *regs, struct file *file)
* memory and creates the pointer tables from them, and puts their * memory and creates the pointer tables from them, and puts their
* addresses on the "stack", returning the new stack pointer value. * addresses on the "stack", returning the new stack pointer value.
*/ */
#define A(__x) ((unsigned long)(__x))
static u32 *create_aout32_tables(char * p, struct linux_binprm * bprm) static u32 *create_aout32_tables(char * p, struct linux_binprm * bprm)
{ {
...@@ -171,7 +170,7 @@ static u32 *create_aout32_tables(char * p, struct linux_binprm * bprm) ...@@ -171,7 +170,7 @@ static u32 *create_aout32_tables(char * p, struct linux_binprm * bprm)
current->mm->arg_start = (unsigned long) p; current->mm->arg_start = (unsigned long) p;
while (argc-->0) { while (argc-->0) {
char c; char c;
put_user(((u32)A(p)),argv++); put_user(((u32)(unsigned long)(p)),argv++);
do { do {
get_user(c,p++); get_user(c,p++);
} while (c); } while (c);
...@@ -180,7 +179,7 @@ static u32 *create_aout32_tables(char * p, struct linux_binprm * bprm) ...@@ -180,7 +179,7 @@ static u32 *create_aout32_tables(char * p, struct linux_binprm * bprm)
current->mm->arg_end = current->mm->env_start = (unsigned long) p; current->mm->arg_end = current->mm->env_start = (unsigned long) p;
while (envc-->0) { while (envc-->0) {
char c; char c;
put_user(((u32)A(p)),envp++); put_user(((u32)(unsigned long)(p)),envp++);
do { do {
get_user(c,p++); get_user(c,p++);
} while (c); } while (c);
......
...@@ -1697,12 +1697,12 @@ linux_sparc_syscall32: ...@@ -1697,12 +1697,12 @@ linux_sparc_syscall32:
add %sp, PTREGS_OFF, %o0 add %sp, PTREGS_OFF, %o0
srl %i0, 0, %o0 srl %i0, 0, %o0
#endif #endif
mov %i4, %o4 ! IEU1 srl %i4, 0, %o4 ! IEU1
lduw [%l7 + %l4], %l7 ! Load lduw [%l7 + %l4], %l7 ! Load
srl %i1, 0, %o1 ! IEU0 Group srl %i1, 0, %o1 ! IEU0 Group
ldx [%curptr + TI_FLAGS], %l0 ! Load ldx [%curptr + TI_FLAGS], %l0 ! Load
mov %i5, %o5 ! IEU1 srl %i5, 0, %o5 ! IEU1
srl %i2, 0, %o2 ! IEU0 Group srl %i2, 0, %o2 ! IEU0 Group
andcc %l0, _TIF_SYSCALL_TRACE, %g0 ! IEU0 Group andcc %l0, _TIF_SYSCALL_TRACE, %g0 ! IEU0 Group
bne,pn %icc, linux_syscall_trace32 ! CTI bne,pn %icc, linux_syscall_trace32 ! CTI
......
...@@ -579,26 +579,26 @@ void fault_in_user_windows(void) ...@@ -579,26 +579,26 @@ void fault_in_user_windows(void)
do_exit(SIGILL); do_exit(SIGILL);
} }
asmlinkage int sparc_do_fork(unsigned long clone_flags, asmlinkage long sparc_do_fork(unsigned long clone_flags,
unsigned long stack_start, unsigned long stack_start,
struct pt_regs *regs, struct pt_regs *regs,
unsigned long stack_size) unsigned long stack_size)
{ {
unsigned long parent_tid_ptr, child_tid_ptr; int __user *parent_tid_ptr, *child_tid_ptr;
clone_flags &= ~CLONE_IDLETASK; clone_flags &= ~CLONE_IDLETASK;
parent_tid_ptr = regs->u_regs[UREG_I2];
child_tid_ptr = regs->u_regs[UREG_I4];
if (test_thread_flag(TIF_32BIT)) { if (test_thread_flag(TIF_32BIT)) {
parent_tid_ptr &= 0xffffffff; parent_tid_ptr = compat_ptr(regs->u_regs[UREG_I2]);
child_tid_ptr &= 0xffffffff; child_tid_ptr = compat_ptr(regs->u_regs[UREG_I4]);
} else {
parent_tid_ptr = (int __user *) regs->u_regs[UREG_I2];
child_tid_ptr = (int __user *) regs->u_regs[UREG_I4];
} }
return do_fork(clone_flags, stack_start, return do_fork(clone_flags, stack_start,
regs, stack_size, regs, stack_size,
(int __user *) parent_tid_ptr, parent_tid_ptr, child_tid_ptr);
(int __user *) child_tid_ptr);
} }
/* Copy a Sparc thread. The fork() return value conventions /* Copy a Sparc thread. The fork() return value conventions
......
...@@ -1349,7 +1349,7 @@ asmlinkage int do_sys32_sigstack(u32 u_ssptr, u32 u_ossptr, unsigned long sp) ...@@ -1349,7 +1349,7 @@ asmlinkage int do_sys32_sigstack(u32 u_ssptr, u32 u_ossptr, unsigned long sp)
return ret; return ret;
} }
asmlinkage int do_sys32_sigaltstack(u32 ussa, u32 uossa, unsigned long sp) asmlinkage long do_sys32_sigaltstack(u32 ussa, u32 uossa, unsigned long sp)
{ {
stack_t uss, uoss; stack_t uss, uoss;
u32 u_ss_sp = 0; u32 u_ss_sp = 0;
......
...@@ -26,15 +26,6 @@ ...@@ -26,15 +26,6 @@
#include <linux/compat.h> #include <linux/compat.h>
#include <asm/kbio.h> #include <asm/kbio.h>
/* Use this to get at 32-bit user passed pointers. */
#define A(__x) \
({ unsigned long __ret; \
__asm__ ("srl %0, 0, %0" \
: "=r" (__ret) \
: "0" (__x)); \
__ret; \
})
#define SUNOS_NR_OPEN 256 #define SUNOS_NR_OPEN 256
struct rtentry32 { struct rtentry32 {
...@@ -108,7 +99,7 @@ asmlinkage int sunos_ioctl (int fd, u32 cmd, u32 arg) ...@@ -108,7 +99,7 @@ asmlinkage int sunos_ioctl (int fd, u32 cmd, u32 arg)
int ntty = N_TTY; int ntty = N_TTY;
int tmp; int tmp;
p = (int __user *)A(arg); p = (int __user *) (unsigned long) arg;
ret = -EFAULT; ret = -EFAULT;
if(get_user(tmp, p)) if(get_user(tmp, p))
goto out; goto out;
...@@ -241,7 +232,7 @@ asmlinkage int sunos_ioctl (int fd, u32 cmd, u32 arg) ...@@ -241,7 +232,7 @@ asmlinkage int sunos_ioctl (int fd, u32 cmd, u32 arg)
int oldval, newval, __user *ptr; int oldval, newval, __user *ptr;
cmd = TIOCSPGRP; cmd = TIOCSPGRP;
ptr = (int __user *) A(arg); ptr = (int __user *) (unsigned long) arg;
ret = -EFAULT; ret = -EFAULT;
if(get_user(oldval, ptr)) if(get_user(oldval, ptr))
goto out; goto out;
...@@ -260,7 +251,7 @@ asmlinkage int sunos_ioctl (int fd, u32 cmd, u32 arg) ...@@ -260,7 +251,7 @@ asmlinkage int sunos_ioctl (int fd, u32 cmd, u32 arg)
int oldval, newval, __user *ptr; int oldval, newval, __user *ptr;
cmd = TIOCGPGRP; cmd = TIOCGPGRP;
ptr = (int __user *) A(arg); ptr = (int __user *) (unsigned long) arg;
ret = -EFAULT; ret = -EFAULT;
if(get_user(oldval, ptr)) if(get_user(oldval, ptr))
goto out; goto out;
......
...@@ -13,85 +13,135 @@ ...@@ -13,85 +13,135 @@
.text .text
.align 32 #define SIGN1(STUB,SYSCALL,REG1) \
.globl sys32_mmap .align 32; \
sys32_mmap: .globl STUB; \
srl %o4, 0, %o4 STUB: sethi %hi(SYSCALL), %g1; \
sethi %hi(sys_mmap), %g1 jmpl %g1 + %lo(SYSCALL), %g0; \
jmpl %g1 + %lo(sys_mmap), %g0 sra REG1, 0, REG1
srl %o5, 0, %o5
.align 32 #define SIGN2(STUB,SYSCALL,REG1,REG2) \
.globl sys32_lseek .align 32; \
.globl sys32_chmod, sys32_mknod .globl STUB; \
sys32_lseek: STUB: sethi %hi(SYSCALL), %g1; \
sra %o1, 0, %o1 sra REG1, 0, REG1; \
sethi %hi(sys_lseek), %g1 jmpl %g1 + %lo(SYSCALL), %g0; \
jmpl %g1 + %lo(sys_lseek), %g0 sra REG2, 0, REG2
nop
sys32_chmod:
sethi %hi(0xffff), %g2
sethi %hi(sys_chmod), %g1
orcc %g2, %lo(0xffff), %g2
jmpl %g1 + %lo(sys_chmod), %g0
and %o1, %g2, %o1
sys32_mknod:
sethi %hi(0xffff), %g2
sethi %hi(sys_mknod), %g1
orcc %g2, %lo(0xffff), %g2
jmpl %g1 + %lo(sys_mknod), %g0
and %o2, %g2, %o2
.align 32 #define SIGN3(STUB,SYSCALL,REG1,REG2,REG3) \
.globl sys32_sendto, sys32_recvfrom .align 32; \
sys32_sendto: .globl STUB; \
sethi %hi(sys_sendto), %g1 STUB: sra REG1, 0, REG1; \
jmpl %g1 + %lo(sys_sendto), %g0 sethi %hi(SYSCALL), %g1; \
srl %o4, 0, %o4 sra REG2, 0, REG2; \
sys32_recvfrom: jmpl %g1 + %lo(SYSCALL), %g0; \
srl %o4, 0, %o4 sra REG3, 0, REG3
sethi %hi(sys_recvfrom), %g1
jmpl %g1 + %lo(sys_recvfrom), %g0
srl %o5, 0, %o5
.globl sys32_bdflush #define SIGN4(STUB,SYSCALL,REG1,REG2,REG3,REG4) \
sys32_bdflush: .align 32; \
sethi %hi(sys_bdflush), %g1 .globl STUB; \
jmpl %g1 + %lo(sys_bdflush), %g0 STUB: sra REG1, 0, REG1; \
sra %o1, 0, %o1 sethi %hi(SYSCALL), %g1; \
sra REG2, 0, REG2; \
sra REG3, 0, REG3; \
jmpl %g1 + %lo(SYSCALL), %g0; \
sra REG4, 0, REG4
SIGN1(sys32_exit, sparc_exit, %o0)
SIGN1(sys32_exit_group, sys_exit_group, %o0)
SIGN1(sys32_wait4, compat_sys_wait4, %o2)
SIGN1(sys32_creat, sys_creat, %o1)
SIGN1(sys32_mknod, sys_mknod, %o1)
SIGN1(sys32_perfctr, sys_perfctr, %o0)
SIGN1(sys32_umount, sys_umount, %o1)
SIGN1(sys32_signal, sys_signal, %o0)
SIGN1(sys32_access, sys_access, %o1)
SIGN1(sys32_msync, sys_msync, %o2)
SIGN2(sys32_reboot, sys_reboot, %o0, %o1)
SIGN1(sys32_setitimer, compat_sys_setitimer, %o0)
SIGN1(sys32_getitimer, compat_sys_getitimer, %o0)
SIGN1(sys32_sethostname, sys_sethostname, %o1)
SIGN1(sys32_swapon, sys_swapon, %o1)
SIGN1(sys32_sigaction, compat_sys_sigaction, %o0)
SIGN1(sys32_rt_sigaction, compat_sys_rt_sigaction, %o0)
SIGN1(sys32_sigprocmask, compat_sys_sigprocmask, %o0)
SIGN1(sys32_rt_sigprocmask, compat_sys_rt_sigprocmask, %o0)
SIGN2(sys32_rt_sigqueueinfo, compat_sys_rt_sigqueueinfo, %o0, %o1)
SIGN1(sys32_getrusage, compat_sys_getrusage, %o0)
SIGN1(sys32_setxattr, sys_setxattr, %o4)
SIGN1(sys32_lsetxattr, sys_lsetxattr, %o4)
SIGN1(sys32_fsetxattr, sys_fsetxattr, %o4)
SIGN1(sys32_fgetxattr, sys_fgetxattr, %o0)
SIGN1(sys32_flistxattr, sys_flistxattr, %o0)
SIGN1(sys32_fremovexattr, sys_fremovexattr, %o0)
SIGN2(sys32_tkill, sys_tkill, %o0, %o1)
SIGN1(sys32_epoll_create, sys_epoll_create, %o0)
SIGN3(sys32_epoll_ctl, sys_epoll_ctl, %o0, %o1, %o2)
SIGN3(sys32_epoll_wait, sys_epoll_wait, %o0, %o2, %o3)
SIGN1(sys32_readahead, compat_sys_readahead, %o0)
SIGN2(sys32_fadvise64, compat_sys_fadvise64, %o0, %o4)
SIGN2(sys32_fadvise64_64, compat_sys_fadvise64_64, %o0, %o5)
SIGN2(sys32_bdflush, sys_bdflush, %o0, %o1)
SIGN1(sys32_mlockall, sys_mlockall, %o0)
SIGN1(sys32_nfsservctl, compat_sys_nfsservctl, %o0)
SIGN1(sys32_clock_settime, compat_clock_settime, %o1)
SIGN1(sys32_clock_nanosleep, compat_clock_nanosleep, %o1)
SIGN1(sys32_timer_settime, compat_timer_settime, %o1)
SIGN1(sys32_io_submit, compat_sys_io_submit, %o1)
SIGN1(sys32_mq_open, compat_sys_mq_open, %o1)
SIGN1(sys32_select, compat_sys_select, %o0)
SIGN1(sys32_mkdir, sys_mkdir, %o1)
SIGN2(sys32_futex, compat_sys_futex, %o1, %o2)
SIGN1(sys32_sysfs, compat_sys_sysfs, %o0)
SIGN3(sys32_ipc, compat_sys_ipc, %o1, %o2, %o3)
SIGN2(sys32_sendfile, compat_sys_sendfile, %o0, %o1)
SIGN2(sys32_sendfile64, compat_sys_sendfile64, %o0, %o1)
SIGN1(sys32_prctl, sys_prctl, %o0)
SIGN1(sys32_sched_rr_get_interval, compat_sys_sched_rr_get_interval, %o0)
SIGN2(sys32_waitpid, sys_waitpid, %o0, %o2)
SIGN1(sys32_getgroups, sys_getgroups, %o0)
SIGN1(sys32_getpgid, sys_getpgid, %o0)
SIGN2(sys32_getpriority, sys_getpriority, %o0, %o1)
SIGN1(sys32_getsid, sys_getsid, %o0)
SIGN2(sys32_kill, sys_kill, %o0, %o1)
SIGN1(sys32_nice, sys_nice, %o0)
SIGN1(sys32_lseek, sys_lseek, %o1)
SIGN2(sys32_open, sparc32_open, %o1, %o2)
SIGN1(sys32_readlink, sys_readlink, %o2)
SIGN1(sys32_sched_get_priority_max, sys_sched_get_priority_max, %o0)
SIGN1(sys32_sched_get_priority_min, sys_sched_get_priority_min, %o0)
SIGN1(sys32_sched_getparam, sys_sched_getparam, %o0)
SIGN1(sys32_sched_getscheduler, sys_sched_getscheduler, %o0)
SIGN1(sys32_sched_setparam, sys_sched_setparam, %o0)
SIGN2(sys32_sched_setscheduler, sys_sched_setscheduler, %o0, %o1)
SIGN1(sys32_getdomainname, sys_getdomainname, %o1)
SIGN1(sys32_setdomainname, sys_setdomainname, %o1)
SIGN1(sys32_setgroups, sys_setgroups, %o0)
SIGN2(sys32_setpgid, sys_setpgid, %o0, %o1)
SIGN3(sys32_setpriority, sys_setpriority, %o0, %o1, %o2)
SIGN1(sys32_ssetmask, sys_ssetmask, %o0)
SIGN2(sys32_syslog, sys_syslog, %o0, %o1)
SIGN1(sys32_umask, sys_umask, %o0)
SIGN3(sys32_tgkill, sys_tgkill, %o0, %o1, %o2)
SIGN1(sys32_sendto, sys_sendto, %o0)
SIGN1(sys32_recvfrom, sys_recvfrom, %o0)
SIGN3(sys32_socket, sys_socket, %o0, %o1, %o2)
SIGN2(sys32_connect, sys_connect, %o0, %o2)
SIGN2(sys32_bind, sys_bind, %o0, %o2)
SIGN2(sys32_listen, sys_listen, %o0, %o1)
SIGN1(sys32_recvmsg, compat_sys_recvmsg, %o0)
SIGN1(sys32_sendmsg, compat_sys_sendmsg, %o0)
SIGN2(sys32_shutdown, sys_shutdown, %o0, %o1)
SIGN3(sys32_socketpair, sys_socketpair, %o0, %o1, %o2)
SIGN1(sys32_getpeername, sys_getpeername, %o0)
SIGN1(sys32_getsockname, sys_getsockname, %o0)
.align 32
.globl sys32_mmap2 .globl sys32_mmap2
sys32_mmap2: sys32_mmap2:
srl %o4, 0, %o4
sethi %hi(sys_mmap), %g1 sethi %hi(sys_mmap), %g1
srl %o5, 0, %o5
jmpl %g1 + %lo(sys_mmap), %g0 jmpl %g1 + %lo(sys_mmap), %g0
sllx %o5, 12, %o5 sllx %o5, 12, %o5
.globl sys32_mq_timedsend
sys32_mq_timedsend:
sethi %hi(compat_sys_mq_timedsend), %g1
jmpl %g1 + %lo(compat_sys_mq_timedsend), %g0
srl %o4, 0, %o4
.globl sys32_mq_timedreceive
sys32_mq_timedreceive:
sethi %hi(compat_sys_mq_timedreceive), %g1
jmpl %g1 + %lo(compat_sys_mq_timedreceive), %g0
srl %o4, 0, %o4
.globl sys32_select
sys32_select:
sethi %hi(compat_sys_select), %g1
jmpl %g1 + %lo(compat_sys_select), %g0
srl %o4, 0, %o4
.globl sys32_futex
sys32_futex:
sethi %hi(compat_sys_futex), %g1
jmpl %g1 + %lo(compat_sys_futex), %g0
srl %o4, 0, %o4
.align 32 .align 32
.globl sys32_socketcall .globl sys32_socketcall
sys32_socketcall: /* %o0=call, %o1=args */ sys32_socketcall: /* %o0=call, %o1=args */
...@@ -199,23 +249,23 @@ do_sys_recv: /* sys_recv(int, void *, size_t, unsigned int) */ ...@@ -199,23 +249,23 @@ do_sys_recv: /* sys_recv(int, void *, size_t, unsigned int) */
lduwa [%o1 + 0x4] %asi, %o1 lduwa [%o1 + 0x4] %asi, %o1
nop nop
nop nop
do_sys_sendto: /* sys32_sendto(int, u32, compat_size_t, unsigned int, u32, int) */ do_sys_sendto: /* sys_sendto(int, u32, compat_size_t, unsigned int, u32, int) */
ldswa [%o1 + 0x0] %asi, %o0 ldswa [%o1 + 0x0] %asi, %o0
sethi %hi(sys32_sendto), %g1 sethi %hi(sys_sendto), %g1
lduwa [%o1 + 0x8] %asi, %o2 lduwa [%o1 + 0x8] %asi, %o2
lduwa [%o1 + 0xc] %asi, %o3 lduwa [%o1 + 0xc] %asi, %o3
lduwa [%o1 + 0x10] %asi, %o4 lduwa [%o1 + 0x10] %asi, %o4
ldswa [%o1 + 0x14] %asi, %o5 ldswa [%o1 + 0x14] %asi, %o5
jmpl %g1 + %lo(sys32_sendto), %g0 jmpl %g1 + %lo(sys_sendto), %g0
lduwa [%o1 + 0x4] %asi, %o1 lduwa [%o1 + 0x4] %asi, %o1
do_sys_recvfrom: /* sys32_recvfrom(int, u32, compat_size_t, unsigned int, u32, u32) */ do_sys_recvfrom: /* sys_recvfrom(int, u32, compat_size_t, unsigned int, u32, u32) */
ldswa [%o1 + 0x0] %asi, %o0 ldswa [%o1 + 0x0] %asi, %o0
sethi %hi(sys32_recvfrom), %g1 sethi %hi(sys_recvfrom), %g1
lduwa [%o1 + 0x8] %asi, %o2 lduwa [%o1 + 0x8] %asi, %o2
lduwa [%o1 + 0xc] %asi, %o3 lduwa [%o1 + 0xc] %asi, %o3
lduwa [%o1 + 0x10] %asi, %o4 lduwa [%o1 + 0x10] %asi, %o4
lduwa [%o1 + 0x14] %asi, %o5 lduwa [%o1 + 0x14] %asi, %o5
jmpl %g1 + %lo(sys32_recvfrom), %g0 jmpl %g1 + %lo(sys_recvfrom), %g0
lduwa [%o1 + 0x4] %asi, %o1 lduwa [%o1 + 0x4] %asi, %o1
do_sys_shutdown: /* sys_shutdown(int, int) */ do_sys_shutdown: /* sys_shutdown(int, int) */
ldswa [%o1 + 0x0] %asi, %o0 ldswa [%o1 + 0x0] %asi, %o0
......
...@@ -179,7 +179,7 @@ asmlinkage unsigned long sparc_brk(unsigned long brk) ...@@ -179,7 +179,7 @@ asmlinkage unsigned long sparc_brk(unsigned long brk)
* sys_pipe() is the normal C calling standard for creating * sys_pipe() is the normal C calling standard for creating
* a pipe. It's not the way unix traditionally does this, though. * a pipe. It's not the way unix traditionally does this, though.
*/ */
asmlinkage int sparc_pipe(struct pt_regs *regs) asmlinkage long sparc_pipe(struct pt_regs *regs)
{ {
int fd[2]; int fd[2];
int error; int error;
...@@ -199,22 +199,22 @@ asmlinkage int sparc_pipe(struct pt_regs *regs) ...@@ -199,22 +199,22 @@ asmlinkage int sparc_pipe(struct pt_regs *regs)
* This is really horribly ugly. * This is really horribly ugly.
*/ */
asmlinkage int sys_ipc (unsigned call, int first, int second, unsigned long third, void *ptr, long fifth) asmlinkage long sys_ipc(unsigned int call, int first, int second, unsigned long third, void __user *ptr, long fifth)
{ {
int err; int err;
/* No need for backward compatibility. We can start fresh... */ /* No need for backward compatibility. We can start fresh... */
if (call <= SEMCTL) {
if (call <= SEMCTL)
switch (call) { switch (call) {
case SEMOP: case SEMOP:
err = sys_semtimedop (first, (struct sembuf __user *)ptr, second, NULL); err = sys_semtimedop(first, ptr, second, NULL);
goto out; goto out;
case SEMTIMEDOP: case SEMTIMEDOP:
err = sys_semtimedop (first, (struct sembuf __user *)ptr, second, (const struct timespec __user *) fifth); err = sys_semtimedop(first, ptr, second,
(const struct timespec __user *) fifth);
goto out; goto out;
case SEMGET: case SEMGET:
err = sys_semget (first, second, (int)third); err = sys_semget(first, second, (int)third);
goto out; goto out;
case SEMCTL: { case SEMCTL: {
union semun fourth; union semun fourth;
...@@ -222,79 +222,87 @@ asmlinkage int sys_ipc (unsigned call, int first, int second, unsigned long thir ...@@ -222,79 +222,87 @@ asmlinkage int sys_ipc (unsigned call, int first, int second, unsigned long thir
if (!ptr) if (!ptr)
goto out; goto out;
err = -EFAULT; err = -EFAULT;
if (get_user(fourth.__pad, (void __user * __user *)ptr)) if (get_user(fourth.__pad,
(void __user * __user *) ptr))
goto out; goto out;
err = sys_semctl (first, second | IPC_64, (int)third, fourth); err = sys_semctl(first, second | IPC_64,
(int)third, fourth);
goto out; goto out;
} }
default: default:
err = -ENOSYS; err = -ENOSYS;
goto out; goto out;
} };
if (call <= MSGCTL) }
if (call <= MSGCTL) {
switch (call) { switch (call) {
case MSGSND: case MSGSND:
err = sys_msgsnd (first, (struct msgbuf __user *) ptr, err = sys_msgsnd(first, ptr, second, (int)third);
second, (int)third);
goto out; goto out;
case MSGRCV: case MSGRCV:
err = sys_msgrcv (first, (struct msgbuf __user *) ptr, second, fifth, (int)third); err = sys_msgrcv(first, ptr, second, fifth,
(int)third);
goto out; goto out;
case MSGGET: case MSGGET:
err = sys_msgget ((key_t) first, second); err = sys_msgget((key_t) first, second);
goto out; goto out;
case MSGCTL: case MSGCTL:
err = sys_msgctl (first, second | IPC_64, (struct msqid_ds __user *) ptr); err = sys_msgctl(first, second | IPC_64, ptr);
goto out; goto out;
default: default:
err = -ENOSYS; err = -ENOSYS;
goto out; goto out;
} };
if (call <= SHMCTL) }
if (call <= SHMCTL) {
switch (call) { switch (call) {
case SHMAT: { case SHMAT: {
ulong raddr; ulong raddr;
err = do_shmat (first, (char __user *) ptr, second, &raddr); err = do_shmat(first, ptr, second, &raddr);
if (!err) { if (!err) {
if (put_user(raddr, (ulong __user *) third)) if (put_user(raddr,
(ulong __user *) third))
err = -EFAULT; err = -EFAULT;
} }
goto out; goto out;
} }
case SHMDT: case SHMDT:
err = sys_shmdt ((char __user *)ptr); err = sys_shmdt(ptr);
goto out; goto out;
case SHMGET: case SHMGET:
err = sys_shmget (first, second, (int)third); err = sys_shmget(first, second, (int)third);
goto out; goto out;
case SHMCTL: case SHMCTL:
err = sys_shmctl (first, second | IPC_64, (struct shmid_ds __user *) ptr); err = sys_shmctl(first, second | IPC_64, ptr);
goto out; goto out;
default: default:
err = -ENOSYS; err = -ENOSYS;
goto out; goto out;
} };
else } else {
err = -ENOSYS; err = -ENOSYS;
}
out: out:
return err; return err;
} }
asmlinkage int sparc64_newuname(struct new_utsname __user *name) asmlinkage long sparc64_newuname(struct new_utsname __user *name)
{ {
int ret = sys_newuname(name); int ret = sys_newuname(name);
if (current->personality == PER_LINUX32 && !ret) { if (current->personality == PER_LINUX32 && !ret) {
ret = copy_to_user(name->machine, "sparc\0\0", 8) ? -EFAULT : 0; ret = (copy_to_user(name->machine, "sparc\0\0", 8)
? -EFAULT : 0);
} }
return ret; return ret;
} }
asmlinkage int sparc64_personality(unsigned long personality) asmlinkage long sparc64_personality(unsigned long personality)
{ {
int ret; int ret;
if (current->personality == PER_LINUX32 && personality == PER_LINUX) if (current->personality == PER_LINUX32 &&
personality == PER_LINUX)
personality = PER_LINUX32; personality = PER_LINUX32;
ret = sys_personality(personality); ret = sys_personality(personality);
if (ret == PER_LINUX32) if (ret == PER_LINUX32)
...@@ -408,8 +416,7 @@ asmlinkage unsigned long sys64_mremap(unsigned long addr, ...@@ -408,8 +416,7 @@ asmlinkage unsigned long sys64_mremap(unsigned long addr,
} }
/* we come to here via sys_nis_syscall so it can setup the regs argument */ /* we come to here via sys_nis_syscall so it can setup the regs argument */
asmlinkage unsigned long asmlinkage unsigned long c_sys_nis_syscall(struct pt_regs *regs)
c_sys_nis_syscall (struct pt_regs *regs)
{ {
static int count; static int count;
...@@ -427,8 +434,7 @@ c_sys_nis_syscall (struct pt_regs *regs) ...@@ -427,8 +434,7 @@ c_sys_nis_syscall (struct pt_regs *regs)
/* #define DEBUG_SPARC_BREAKPOINT */ /* #define DEBUG_SPARC_BREAKPOINT */
asmlinkage void asmlinkage void sparc_breakpoint(struct pt_regs *regs)
sparc_breakpoint (struct pt_regs *regs)
{ {
siginfo_t info; siginfo_t info;
...@@ -452,7 +458,7 @@ sparc_breakpoint (struct pt_regs *regs) ...@@ -452,7 +458,7 @@ sparc_breakpoint (struct pt_regs *regs)
extern void check_pending(int signum); extern void check_pending(int signum);
asmlinkage int sys_getdomainname(char __user *name, int len) asmlinkage long sys_getdomainname(char __user *name, int len)
{ {
int nlen; int nlen;
int err = -EFAULT; int err = -EFAULT;
...@@ -473,7 +479,7 @@ asmlinkage int sys_getdomainname(char __user *name, int len) ...@@ -473,7 +479,7 @@ asmlinkage int sys_getdomainname(char __user *name, int len)
return err; return err;
} }
asmlinkage int solaris_syscall(struct pt_regs *regs) asmlinkage long solaris_syscall(struct pt_regs *regs)
{ {
static int count; static int count;
...@@ -493,7 +499,7 @@ asmlinkage int solaris_syscall(struct pt_regs *regs) ...@@ -493,7 +499,7 @@ asmlinkage int solaris_syscall(struct pt_regs *regs)
} }
#ifndef CONFIG_SUNOS_EMUL #ifndef CONFIG_SUNOS_EMUL
asmlinkage int sunos_syscall(struct pt_regs *regs) asmlinkage long sunos_syscall(struct pt_regs *regs)
{ {
static int count; static int count;
...@@ -511,11 +517,11 @@ asmlinkage int sunos_syscall(struct pt_regs *regs) ...@@ -511,11 +517,11 @@ asmlinkage int sunos_syscall(struct pt_regs *regs)
} }
#endif #endif
asmlinkage int sys_utrap_install(utrap_entry_t type, asmlinkage long sys_utrap_install(utrap_entry_t type,
utrap_handler_t new_p, utrap_handler_t new_p,
utrap_handler_t new_d, utrap_handler_t new_d,
utrap_handler_t __user *old_p, utrap_handler_t __user *old_p,
utrap_handler_t __user *old_d) utrap_handler_t __user *old_d)
{ {
if (type < UT_INSTRUCTION_EXCEPTION || type > UT_TRAP_INSTRUCTION_31) if (type < UT_INSTRUCTION_EXCEPTION || type > UT_TRAP_INSTRUCTION_31)
return -EINVAL; return -EINVAL;
...@@ -582,12 +588,11 @@ long sparc_memory_ordering(unsigned long model, struct pt_regs *regs) ...@@ -582,12 +588,11 @@ long sparc_memory_ordering(unsigned long model, struct pt_regs *regs)
return 0; return 0;
} }
asmlinkage long asmlinkage long sys_rt_sigaction(int sig,
sys_rt_sigaction(int sig, const struct sigaction __user *act,
const struct sigaction __user *act, struct sigaction __user *oact,
struct sigaction __user *oact, void __user *restorer,
void __user *restorer, size_t sigsetsize)
size_t sigsetsize)
{ {
struct k_sigaction new_ka, old_ka; struct k_sigaction new_ka, old_ka;
int ret; int ret;
...@@ -615,8 +620,7 @@ sys_rt_sigaction(int sig, ...@@ -615,8 +620,7 @@ sys_rt_sigaction(int sig,
/* Invoked by rtrap code to update performance counters in /* Invoked by rtrap code to update performance counters in
* user space. * user space.
*/ */
asmlinkage void asmlinkage void update_perfctrs(void)
update_perfctrs(void)
{ {
unsigned long pic, tmp; unsigned long pic, tmp;
...@@ -628,8 +632,7 @@ update_perfctrs(void) ...@@ -628,8 +632,7 @@ update_perfctrs(void)
reset_pic(); reset_pic();
} }
asmlinkage int asmlinkage long sys_perfctr(int opcode, unsigned long arg0, unsigned long arg1, unsigned long arg2)
sys_perfctr(int opcode, unsigned long arg0, unsigned long arg1, unsigned long arg2)
{ {
int err = 0; int err = 0;
......
...@@ -62,31 +62,6 @@ ...@@ -62,31 +62,6 @@
#include <asm/semaphore.h> #include <asm/semaphore.h>
#include <asm/mmu_context.h> #include <asm/mmu_context.h>
/* Use this to get at 32-bit user passed pointers. */
/* Things to consider: the low-level assembly stub does
srl x, 0, x for first four arguments, so if you have
pointer to something in the first four arguments, just
declare it as a pointer, not u32. On the other side,
arguments from 5th onwards should be declared as u32
for pointers, and need AA() around each usage.
A() macro should be used for places where you e.g.
have some internal variable u32 and just want to get
rid of a compiler warning. AA() has to be used in
places where you want to convert a function argument
to 32bit pointer or when you e.g. access pt_regs
structure and want to consider 32bit registers only.
-jj
*/
#define A(__x) ((unsigned long)(__x))
#define AA(__x) \
({ unsigned long __ret; \
__asm__ ("srl %0, 0, %0" \
: "=r" (__ret) \
: "0" (__x)); \
__ret; \
})
asmlinkage long sys32_chown16(const char __user * filename, u16 user, u16 group) asmlinkage long sys32_chown16(const char __user * filename, u16 user, u16 group)
{ {
return sys_chown(filename, low2highuid(user), low2highgid(group)); return sys_chown(filename, low2highuid(user), low2highgid(group));
...@@ -281,8 +256,7 @@ static inline long put_tv32(struct compat_timeval __user *o, struct timeval *i) ...@@ -281,8 +256,7 @@ static inline long put_tv32(struct compat_timeval __user *o, struct timeval *i)
struct msgbuf32 { s32 mtype; char mtext[1]; }; struct msgbuf32 { s32 mtype; char mtext[1]; };
struct ipc_perm32 struct ipc_perm32 {
{
key_t key; key_t key;
compat_uid_t uid; compat_uid_t uid;
compat_gid_t gid; compat_gid_t gid;
...@@ -383,21 +357,22 @@ struct shmid64_ds32 { ...@@ -383,21 +357,22 @@ struct shmid64_ds32 {
* This is really horribly ugly. * This is really horribly ugly.
*/ */
#define IPCOP_MASK(__x) (1UL << ((__x)&~IPC_64)) #define IPCOP_MASK(__x) (1UL << ((__x)&~IPC_64))
static int do_sys32_semctl(int first, int second, int third, void *uptr) static int do_sys32_semctl(int first, int second, int third,
compat_uptr_t __user *uptr)
{ {
union semun fourth; union semun fourth;
u32 pad; compat_uptr_t pad;
int err = -EINVAL; int err = -EINVAL;
if (!uptr) if (!uptr)
goto out; goto out;
err = -EFAULT; err = -EFAULT;
if (get_user (pad, (u32 __user *)uptr)) if (get_user(pad, uptr))
goto out; goto out;
if ((third & ~IPC_64) == SETVAL) if ((third & ~IPC_64) == SETVAL)
fourth.val = (int)pad; fourth.val = (int)pad;
else else
fourth.__pad = (void __user *)A(pad); fourth.__pad = compat_ptr(pad);
if (IPCOP_MASK (third) & if (IPCOP_MASK (third) &
(IPCOP_MASK (IPC_INFO) | IPCOP_MASK (SEM_INFO) | IPCOP_MASK (GETVAL) | (IPCOP_MASK (IPC_INFO) | IPCOP_MASK (SEM_INFO) | IPCOP_MASK (GETVAL) |
IPCOP_MASK (GETPID) | IPCOP_MASK (GETNCNT) | IPCOP_MASK (GETZCNT) | IPCOP_MASK (GETPID) | IPCOP_MASK (GETNCNT) | IPCOP_MASK (GETZCNT) |
...@@ -405,8 +380,7 @@ static int do_sys32_semctl(int first, int second, int third, void *uptr) ...@@ -405,8 +380,7 @@ static int do_sys32_semctl(int first, int second, int third, void *uptr)
err = sys_semctl (first, second, third, fourth); err = sys_semctl (first, second, third, fourth);
} else if (third & IPC_64) { } else if (third & IPC_64) {
struct semid64_ds s; struct semid64_ds s;
struct semid64_ds32 __user *usp = struct semid64_ds32 __user *usp = compat_ptr(pad);
(struct semid64_ds32 __user *)A(pad);
mm_segment_t old_fs; mm_segment_t old_fs;
int need_back_translation; int need_back_translation;
...@@ -434,8 +408,7 @@ static int do_sys32_semctl(int first, int second, int third, void *uptr) ...@@ -434,8 +408,7 @@ static int do_sys32_semctl(int first, int second, int third, void *uptr)
} }
} else { } else {
struct semid_ds s; struct semid_ds s;
struct semid_ds32 __user *usp = struct semid_ds32 __user *usp = compat_ptr(pad);
(struct semid_ds32 __user *)A(pad);
mm_segment_t old_fs; mm_segment_t old_fs;
int need_back_translation; int need_back_translation;
...@@ -474,13 +447,15 @@ static int do_sys32_semctl(int first, int second, int third, void *uptr) ...@@ -474,13 +447,15 @@ static int do_sys32_semctl(int first, int second, int third, void *uptr)
return err; return err;
} }
static int do_sys32_msgsnd (int first, int second, int third, void *uptr) static int do_sys32_msgsnd(int first, int second, int third,
void __user *uptr)
{ {
struct msgbuf *p = kmalloc (second + sizeof (struct msgbuf), GFP_USER); struct msgbuf32 __user *up = uptr;
struct msgbuf32 __user *up = (struct msgbuf32 __user *) uptr; struct msgbuf *p;
mm_segment_t old_fs; mm_segment_t old_fs;
int err; int err;
p = kmalloc(second + sizeof (struct msgbuf), GFP_USER);
if (!p) if (!p)
return -ENOMEM; return -ENOMEM;
err = -EFAULT; err = -EFAULT;
...@@ -489,15 +464,16 @@ static int do_sys32_msgsnd (int first, int second, int third, void *uptr) ...@@ -489,15 +464,16 @@ static int do_sys32_msgsnd (int first, int second, int third, void *uptr)
goto out; goto out;
old_fs = get_fs (); old_fs = get_fs ();
set_fs (KERNEL_DS); set_fs (KERNEL_DS);
err = sys_msgsnd (first, (struct msgbuf __user *) p, second, third); err = sys_msgsnd (first, (struct msgbuf __user *) p,
second, third);
set_fs (old_fs); set_fs (old_fs);
out: out:
kfree (p); kfree (p);
return err; return err;
} }
static int do_sys32_msgrcv (int first, int second, int msgtyp, int third, static int do_sys32_msgrcv(int first, int second, int msgtyp, int third,
int version, void *uptr) int version, void __user *uptr)
{ {
struct msgbuf32 __user *up; struct msgbuf32 __user *up;
struct msgbuf *p; struct msgbuf *p;
...@@ -505,21 +481,21 @@ static int do_sys32_msgrcv (int first, int second, int msgtyp, int third, ...@@ -505,21 +481,21 @@ static int do_sys32_msgrcv (int first, int second, int msgtyp, int third,
int err; int err;
if (!version) { if (!version) {
struct ipc_kludge __user *uipck = struct ipc_kludge __user *uipck = uptr;
(struct ipc_kludge __user *) uptr;
struct ipc_kludge ipck; struct ipc_kludge ipck;
err = -EINVAL; err = -EINVAL;
if (!uptr) if (!uptr)
goto out; goto out;
err = -EFAULT; err = -EFAULT;
if (copy_from_user (&ipck, uipck, sizeof (struct ipc_kludge))) if (copy_from_user (&ipck, uipck,
sizeof (struct ipc_kludge)))
goto out; goto out;
uptr = (void *)A(ipck.msgp); uptr = compat_ptr(ipck.msgp);
msgtyp = ipck.msgtyp; msgtyp = ipck.msgtyp;
} }
err = -ENOMEM; err = -ENOMEM;
p = kmalloc (second + sizeof (struct msgbuf), GFP_USER); p = kmalloc(second + sizeof (struct msgbuf), GFP_USER);
if (!p) if (!p)
goto out; goto out;
old_fs = get_fs (); old_fs = get_fs ();
...@@ -529,7 +505,7 @@ static int do_sys32_msgrcv (int first, int second, int msgtyp, int third, ...@@ -529,7 +505,7 @@ static int do_sys32_msgrcv (int first, int second, int msgtyp, int third,
set_fs (old_fs); set_fs (old_fs);
if (err < 0) if (err < 0)
goto free_then_out; goto free_then_out;
up = (struct msgbuf32 __user *) uptr; up = uptr;
if (put_user (p->mtype, &up->mtype) || if (put_user (p->mtype, &up->mtype) ||
__copy_to_user (&up->mtext, p->mtext, err)) __copy_to_user (&up->mtext, p->mtext, err))
err = -EFAULT; err = -EFAULT;
...@@ -539,39 +515,46 @@ static int do_sys32_msgrcv (int first, int second, int msgtyp, int third, ...@@ -539,39 +515,46 @@ static int do_sys32_msgrcv (int first, int second, int msgtyp, int third,
return err; return err;
} }
static int do_sys32_msgctl (int first, int second, void *uptr) static int do_sys32_msgctl(int first, int second, void __user *uptr)
{ {
int err; int err;
if (IPCOP_MASK (second) & if (IPCOP_MASK (second) &
(IPCOP_MASK (IPC_INFO) | IPCOP_MASK (MSG_INFO) | (IPCOP_MASK (IPC_INFO) | IPCOP_MASK (MSG_INFO) |
IPCOP_MASK (IPC_RMID))) { IPCOP_MASK (IPC_RMID))) {
err = sys_msgctl (first, second, err = sys_msgctl (first, second, uptr);
(struct msqid_ds __user *)uptr);
} else if (second & IPC_64) { } else if (second & IPC_64) {
struct msqid64_ds m; struct msqid64_ds m;
struct msqid64_ds32 __user *up = struct msqid64_ds32 __user *up = uptr;
(struct msqid64_ds32 __user *) uptr;
mm_segment_t old_fs; mm_segment_t old_fs;
if (second == (IPC_SET|IPC_64)) { if (second == (IPC_SET|IPC_64)) {
err = get_user (m.msg_perm.uid, &up->msg_perm.uid); err = get_user (m.msg_perm.uid,
err |= __get_user (m.msg_perm.gid, &up->msg_perm.gid); &up->msg_perm.uid);
err |= __get_user (m.msg_perm.mode, &up->msg_perm.mode); err |= __get_user (m.msg_perm.gid,
err |= __get_user (m.msg_qbytes, &up->msg_qbytes); &up->msg_perm.gid);
err |= __get_user (m.msg_perm.mode,
&up->msg_perm.mode);
err |= __get_user (m.msg_qbytes,
&up->msg_qbytes);
if (err) if (err)
goto out; goto out;
} }
old_fs = get_fs (); old_fs = get_fs ();
set_fs (KERNEL_DS); set_fs (KERNEL_DS);
err = sys_msgctl (first, second, (struct msqid_ds __user *)&m); err = sys_msgctl(first, second,
(struct msqid_ds __user *)&m);
set_fs (old_fs); set_fs (old_fs);
if (IPCOP_MASK (second) & if (IPCOP_MASK (second) &
(IPCOP_MASK (MSG_STAT) | IPCOP_MASK (IPC_STAT))) { (IPCOP_MASK (MSG_STAT) | IPCOP_MASK (IPC_STAT))) {
int err2 = copy_to_user(&up->msg_perm, &m.msg_perm, sizeof(struct ipc64_perm) + 3*sizeof(time_t)); int err2 = copy_to_user(&up->msg_perm,
err2 |= __put_user (m.msg_cbytes, &up->msg_cbytes); &m.msg_perm,
(sizeof(struct ipc64_perm) + 3*sizeof(time_t)));
err2 |= __put_user (m.msg_cbytes,
&up->msg_cbytes);
err2 |= __put_user (m.msg_qnum, &up->msg_qnum); err2 |= __put_user (m.msg_qnum, &up->msg_qnum);
err2 |= __put_user (m.msg_qbytes, &up->msg_qbytes); err2 |= __put_user (m.msg_qbytes,
&up->msg_qbytes);
err2 |= __put_user (m.msg_lspid, &up->msg_lspid); err2 |= __put_user (m.msg_lspid, &up->msg_lspid);
err2 |= __put_user (m.msg_lrpid, &up->msg_lrpid); err2 |= __put_user (m.msg_lrpid, &up->msg_lrpid);
if (err2) if (err2)
...@@ -579,39 +562,52 @@ static int do_sys32_msgctl (int first, int second, void *uptr) ...@@ -579,39 +562,52 @@ static int do_sys32_msgctl (int first, int second, void *uptr)
} }
} else { } else {
struct msqid_ds m; struct msqid_ds m;
struct msqid_ds32 __user *up = struct msqid_ds32 __user *up = uptr;
(struct msqid_ds32 __user *)uptr;
mm_segment_t old_fs; mm_segment_t old_fs;
if (second == IPC_SET) { if (second == IPC_SET) {
err = get_user (m.msg_perm.uid, &up->msg_perm.uid); err = get_user(m.msg_perm.uid,
err |= __get_user (m.msg_perm.gid, &up->msg_perm.gid); &up->msg_perm.uid);
err |= __get_user (m.msg_perm.mode, &up->msg_perm.mode); err |= __get_user(m.msg_perm.gid,
err |= __get_user (m.msg_qbytes, &up->msg_qbytes); &up->msg_perm.gid);
err |= __get_user(m.msg_perm.mode,
&up->msg_perm.mode);
err |= __get_user(m.msg_qbytes,
&up->msg_qbytes);
if (err) if (err)
goto out; goto out;
} }
old_fs = get_fs (); old_fs = get_fs ();
set_fs (KERNEL_DS); set_fs (KERNEL_DS);
err = sys_msgctl (first, second, (struct msqid_ds __user *) &m); err = sys_msgctl(first, second,
(struct msqid_ds __user *) &m);
set_fs (old_fs); set_fs (old_fs);
if (IPCOP_MASK (second) & if (IPCOP_MASK (second) &
(IPCOP_MASK (MSG_STAT) | IPCOP_MASK (IPC_STAT))) { (IPCOP_MASK (MSG_STAT) | IPCOP_MASK (IPC_STAT))) {
int err2 = put_user (m.msg_perm.key, &up->msg_perm.key); int err2 = put_user(m.msg_perm.key,
err2 |= __put_user (high2lowuid(m.msg_perm.uid), &up->msg_perm.uid); &up->msg_perm.key);
err2 |= __put_user (high2lowgid(m.msg_perm.gid), &up->msg_perm.gid); err2 |= __put_user(high2lowuid(m.msg_perm.uid),
err2 |= __put_user (high2lowuid(m.msg_perm.cuid), &up->msg_perm.cuid); &up->msg_perm.uid);
err2 |= __put_user (high2lowgid(m.msg_perm.cgid), &up->msg_perm.cgid); err2 |= __put_user(high2lowgid(m.msg_perm.gid),
err2 |= __put_user (m.msg_perm.mode, &up->msg_perm.mode); &up->msg_perm.gid);
err2 |= __put_user (m.msg_perm.seq, &up->msg_perm.seq); err2 |= __put_user(high2lowuid(m.msg_perm.cuid),
err2 |= __put_user (m.msg_stime, &up->msg_stime); &up->msg_perm.cuid);
err2 |= __put_user (m.msg_rtime, &up->msg_rtime); err2 |= __put_user(high2lowgid(m.msg_perm.cgid),
err2 |= __put_user (m.msg_ctime, &up->msg_ctime); &up->msg_perm.cgid);
err2 |= __put_user (m.msg_cbytes, &up->msg_cbytes); err2 |= __put_user(m.msg_perm.mode,
err2 |= __put_user (m.msg_qnum, &up->msg_qnum); &up->msg_perm.mode);
err2 |= __put_user (m.msg_qbytes, &up->msg_qbytes); err2 |= __put_user(m.msg_perm.seq,
err2 |= __put_user (m.msg_lspid, &up->msg_lspid); &up->msg_perm.seq);
err2 |= __put_user (m.msg_lrpid, &up->msg_lrpid); err2 |= __put_user(m.msg_stime, &up->msg_stime);
err2 |= __put_user(m.msg_rtime, &up->msg_rtime);
err2 |= __put_user(m.msg_ctime, &up->msg_ctime);
err2 |= __put_user(m.msg_cbytes,
&up->msg_cbytes);
err2 |= __put_user(m.msg_qnum, &up->msg_qnum);
err2 |= __put_user(m.msg_qbytes,
&up->msg_qbytes);
err2 |= __put_user(m.msg_lspid, &up->msg_lspid);
err2 |= __put_user(m.msg_lrpid, &up->msg_lrpid);
if (err2) if (err2)
err = -EFAULT; err = -EFAULT;
} }
...@@ -624,7 +620,7 @@ static int do_sys32_msgctl (int first, int second, void *uptr) ...@@ -624,7 +620,7 @@ static int do_sys32_msgctl (int first, int second, void *uptr)
static int do_sys32_shmat (int first, int second, int third, int version, void __user *uptr) static int do_sys32_shmat (int first, int second, int third, int version, void __user *uptr)
{ {
unsigned long raddr; unsigned long raddr;
u32 __user *uaddr = (u32 __user *)A((u32)third); u32 __user *uaddr = compat_ptr((compat_uptr_t)third);
int err = -EINVAL; int err = -EINVAL;
if (version == 1) if (version == 1)
...@@ -637,66 +633,75 @@ static int do_sys32_shmat (int first, int second, int third, int version, void _ ...@@ -637,66 +633,75 @@ static int do_sys32_shmat (int first, int second, int third, int version, void _
return err; return err;
} }
static int do_sys32_shmctl (int first, int second, void *uptr) static int do_sys32_shmctl(int first, int second, void __user *uptr)
{ {
int err; int err;
if (IPCOP_MASK (second) & if (IPCOP_MASK (second) &
(IPCOP_MASK (IPC_INFO) | IPCOP_MASK (SHM_LOCK) | IPCOP_MASK (SHM_UNLOCK) | (IPCOP_MASK (IPC_INFO) | IPCOP_MASK (SHM_LOCK) |
IPCOP_MASK (IPC_RMID))) { IPCOP_MASK (SHM_UNLOCK) | IPCOP_MASK (IPC_RMID))) {
if (second == (IPC_INFO|IPC_64)) if (second == (IPC_INFO|IPC_64)) {
second = IPC_INFO; /* So that we don't have to translate it */ /* So that we don't have to translate it */
err = sys_shmctl (first, second, second = IPC_INFO;
(struct shmid_ds __user *) uptr); }
err = sys_shmctl(first, second, uptr);
} else if ((second & IPC_64) && second != (SHM_INFO|IPC_64)) { } else if ((second & IPC_64) && second != (SHM_INFO|IPC_64)) {
struct shmid64_ds s; struct shmid64_ds s;
struct shmid64_ds32 __user *up = struct shmid64_ds32 __user *up = uptr;
(struct shmid64_ds32 __user *) uptr;
mm_segment_t old_fs; mm_segment_t old_fs;
if (second == (IPC_SET|IPC_64)) { if (second == (IPC_SET|IPC_64)) {
err = get_user (s.shm_perm.uid, &up->shm_perm.uid); err = get_user(s.shm_perm.uid,
err |= __get_user (s.shm_perm.gid, &up->shm_perm.gid); &up->shm_perm.uid);
err |= __get_user (s.shm_perm.mode, &up->shm_perm.mode); err |= __get_user(s.shm_perm.gid,
&up->shm_perm.gid);
err |= __get_user(s.shm_perm.mode,
&up->shm_perm.mode);
if (err) if (err)
goto out; goto out;
} }
old_fs = get_fs (); old_fs = get_fs();
set_fs (KERNEL_DS); set_fs(KERNEL_DS);
err = sys_shmctl (first, second, (struct shmid_ds __user *)&s); err = sys_shmctl(first, second,
set_fs (old_fs); (struct shmid_ds __user *)&s);
set_fs(old_fs);
if (err < 0) if (err < 0)
goto out; goto out;
/* Mask it even in this case so it becomes a CSE. */ /* Mask it even in this case so it becomes a CSE. */
if (IPCOP_MASK (second) & if (IPCOP_MASK (second) &
(IPCOP_MASK (SHM_STAT) | IPCOP_MASK (IPC_STAT))) { (IPCOP_MASK (SHM_STAT) | IPCOP_MASK (IPC_STAT))) {
int err2 = copy_to_user (&up->shm_perm, &s.shm_perm, sizeof(struct ipc64_perm) + 3*sizeof(time_t)); int err2 = copy_to_user(&up->shm_perm,
err2 |= __put_user (s.shm_segsz, &up->shm_segsz); &s.shm_perm,
err2 |= __put_user (s.shm_nattch, &up->shm_nattch); sizeof(struct ipc64_perm) + 3*sizeof(time_t));
err2 |= __put_user (s.shm_cpid, &up->shm_cpid); err2 |= __put_user(s.shm_segsz, &up->shm_segsz);
err2 |= __put_user (s.shm_lpid, &up->shm_lpid); err2 |= __put_user(s.shm_nattch,&up->shm_nattch);
err2 |= __put_user(s.shm_cpid, &up->shm_cpid);
err2 |= __put_user(s.shm_lpid, &up->shm_lpid);
if (err2) if (err2)
err = -EFAULT; err = -EFAULT;
} }
} else { } else {
struct shmid_ds s; struct shmid_ds s;
struct shmid_ds32 __user *up = struct shmid_ds32 __user *up = uptr;
(struct shmid_ds32 __user *) uptr;
mm_segment_t old_fs; mm_segment_t old_fs;
second &= ~IPC_64; second &= ~IPC_64;
if (second == IPC_SET) { if (second == IPC_SET) {
err = get_user (s.shm_perm.uid, &up->shm_perm.uid); err = get_user(s.shm_perm.uid,
err |= __get_user (s.shm_perm.gid, &up->shm_perm.gid); &up->shm_perm.uid);
err |= __get_user (s.shm_perm.mode, &up->shm_perm.mode); err |= __get_user(s.shm_perm.gid,
&up->shm_perm.gid);
err |= __get_user(s.shm_perm.mode,
&up->shm_perm.mode);
if (err) if (err)
goto out; goto out;
} }
old_fs = get_fs (); old_fs = get_fs();
set_fs (KERNEL_DS); set_fs(KERNEL_DS);
err = sys_shmctl (first, second, (struct shmid_ds __user *) &s); err = sys_shmctl(first, second,
set_fs (old_fs); (struct shmid_ds __user *) &s);
set_fs(old_fs);
if (err < 0) if (err < 0)
goto out; goto out;
...@@ -707,33 +712,45 @@ static int do_sys32_shmctl (int first, int second, void *uptr) ...@@ -707,33 +712,45 @@ static int do_sys32_shmctl (int first, int second, void *uptr)
u32 shm_tot, shm_rss, shm_swp; u32 shm_tot, shm_rss, shm_swp;
u32 swap_attempts, swap_successes; u32 swap_attempts, swap_successes;
}; };
struct shm_info32 __user *uip = struct shm_info32 __user *uip = uptr;
(struct shm_info32 __user *) uptr; struct shm_info *kp = (struct shm_info *) &s;
struct shm_info *kp = (struct shm_info *)&s; int err2 = put_user(kp->used_ids,
int err2 = put_user (kp->used_ids, &uip->used_ids); &uip->used_ids);
err2 |= __put_user (kp->shm_tot, &uip->shm_tot); err2 |= __put_user(kp->shm_tot, &uip->shm_tot);
err2 |= __put_user (kp->shm_rss, &uip->shm_rss); err2 |= __put_user(kp->shm_rss, &uip->shm_rss);
err2 |= __put_user (kp->shm_swp, &uip->shm_swp); err2 |= __put_user(kp->shm_swp, &uip->shm_swp);
err2 |= __put_user (kp->swap_attempts, &uip->swap_attempts); err2 |= __put_user(kp->swap_attempts,
err2 |= __put_user (kp->swap_successes, &uip->swap_successes); &uip->swap_attempts);
err2 |= __put_user(kp->swap_successes,
&uip->swap_successes);
if (err2) if (err2)
err = -EFAULT; err = -EFAULT;
} else if (IPCOP_MASK (second) & } else if (IPCOP_MASK (second) &
(IPCOP_MASK (SHM_STAT) | IPCOP_MASK (IPC_STAT))) { (IPCOP_MASK (SHM_STAT) |
int err2 = put_user (s.shm_perm.key, &up->shm_perm.key); IPCOP_MASK (IPC_STAT))) {
err2 |= __put_user (high2lowuid(s.shm_perm.uid), &up->shm_perm.uid); int err2;
err2 |= __put_user (high2lowuid(s.shm_perm.gid), &up->shm_perm.gid);
err2 |= __put_user (high2lowuid(s.shm_perm.cuid), &up->shm_perm.cuid); err2 = put_user(s.shm_perm.key,
err2 |= __put_user (high2lowuid(s.shm_perm.cgid), &up->shm_perm.cgid); &up->shm_perm.key);
err2 |= __put_user (s.shm_perm.mode, &up->shm_perm.mode); err2 |= __put_user(high2lowuid(s.shm_perm.uid),
err2 |= __put_user (s.shm_perm.seq, &up->shm_perm.seq); &up->shm_perm.uid);
err2 |= __put_user (s.shm_atime, &up->shm_atime); err2 |= __put_user(high2lowuid(s.shm_perm.gid),
err2 |= __put_user (s.shm_dtime, &up->shm_dtime); &up->shm_perm.gid);
err2 |= __put_user (s.shm_ctime, &up->shm_ctime); err2 |= __put_user(high2lowuid(s.shm_perm.cuid),
err2 |= __put_user (s.shm_segsz, &up->shm_segsz); &up->shm_perm.cuid);
err2 |= __put_user (s.shm_nattch, &up->shm_nattch); err2 |= __put_user(high2lowuid(s.shm_perm.cgid),
err2 |= __put_user (s.shm_cpid, &up->shm_cpid); &up->shm_perm.cgid);
err2 |= __put_user (s.shm_lpid, &up->shm_lpid); err2 |= __put_user(s.shm_perm.mode,
&up->shm_perm.mode);
err2 |= __put_user(s.shm_perm.seq,
&up->shm_perm.seq);
err2 |= __put_user(s.shm_atime, &up->shm_atime);
err2 |= __put_user(s.shm_dtime, &up->shm_dtime);
err2 |= __put_user(s.shm_ctime, &up->shm_ctime);
err2 |= __put_user(s.shm_segsz, &up->shm_segsz);
err2 |= __put_user(s.shm_nattch,&up->shm_nattch);
err2 |= __put_user(s.shm_cpid, &up->shm_cpid);
err2 |= __put_user(s.shm_lpid, &up->shm_lpid);
if (err2) if (err2)
err = -EFAULT; err = -EFAULT;
} }
...@@ -742,12 +759,14 @@ static int do_sys32_shmctl (int first, int second, void *uptr) ...@@ -742,12 +759,14 @@ static int do_sys32_shmctl (int first, int second, void *uptr)
return err; return err;
} }
static int sys32_semtimedop(int semid, struct sembuf __user *tsems, int nsems, static int sys32_semtimedop(int semid, struct sembuf __user *tsems,
const struct compat_timespec __user *timeout32) int nsems,
const struct compat_timespec __user *timeout32)
{ {
struct compat_timespec t32; struct compat_timespec t32;
struct timespec __user *t64 = compat_alloc_user_space(sizeof(*t64)); struct timespec __user *t64;
t64 = compat_alloc_user_space(sizeof(*t64));
if (copy_from_user(&t32, timeout32, sizeof(t32))) if (copy_from_user(&t32, timeout32, sizeof(t32)))
return -EFAULT; return -EFAULT;
...@@ -758,77 +777,81 @@ static int sys32_semtimedop(int semid, struct sembuf __user *tsems, int nsems, ...@@ -758,77 +777,81 @@ static int sys32_semtimedop(int semid, struct sembuf __user *tsems, int nsems,
return sys_semtimedop(semid, tsems, nsems, t64); return sys_semtimedop(semid, tsems, nsems, t64);
} }
asmlinkage int sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth) asmlinkage long compat_sys_ipc(u32 call, int first, int second, int third, compat_uptr_t __ptr, u32 fifth)
{ {
int version, err; int version, err;
void __user *ptr = compat_ptr(__ptr);
version = call >> 16; /* hack for backward compatibility */ version = call >> 16; /* hack for backward compatibility */
call &= 0xffff; call &= 0xffff;
if (call <= SEMCTL) if (call <= SEMCTL) {
switch (call) { switch (call) {
case SEMOP: case SEMOP:
/* struct sembuf is the same on 32 and 64bit :)) */ /* struct sembuf is the same on 32 and 64 :)) */
err = sys_semtimedop (first, (struct sembuf __user *)AA(ptr), second, NULL); err = sys_semtimedop (first, ptr, second, NULL);
goto out; goto out;
case SEMTIMEDOP: case SEMTIMEDOP:
err = sys32_semtimedop (first, (struct sembuf __user *)AA(ptr), second, (const struct compat_timespec __user *) AA(fifth)); err = sys32_semtimedop(first, ptr, second,
compat_ptr(fifth));
case SEMGET: case SEMGET:
err = sys_semget (first, second, third); err = sys_semget(first, second, third);
goto out; goto out;
case SEMCTL: case SEMCTL:
err = do_sys32_semctl (first, second, third, (void *)AA(ptr)); err = do_sys32_semctl(first, second, third, ptr);
goto out; goto out;
default: default:
err = -ENOSYS; err = -ENOSYS;
goto out; goto out;
}; };
if (call <= MSGCTL) }
if (call <= MSGCTL) {
switch (call) { switch (call) {
case MSGSND: case MSGSND:
err = do_sys32_msgsnd (first, second, third, (void *)AA(ptr)); err = do_sys32_msgsnd(first, second, third, ptr);
goto out; goto out;
case MSGRCV: case MSGRCV:
err = do_sys32_msgrcv (first, second, fifth, third, err = do_sys32_msgrcv(first, second, fifth,
version, (void *)AA(ptr)); third, version, ptr);
goto out; goto out;
case MSGGET: case MSGGET:
err = sys_msgget ((key_t) first, second); err = sys_msgget((key_t) first, second);
goto out; goto out;
case MSGCTL: case MSGCTL:
err = do_sys32_msgctl (first, second, (void *)AA(ptr)); err = do_sys32_msgctl(first, second, ptr);
goto out; goto out;
default: default:
err = -ENOSYS; err = -ENOSYS;
goto out; goto out;
} };
if (call <= SHMCTL) }
if (call <= SHMCTL) {
switch (call) { switch (call) {
case SHMAT: case SHMAT:
err = do_sys32_shmat (first, second, third, err = do_sys32_shmat(first, second, third,
version, (void __user *)AA(ptr)); version, ptr);
goto out; goto out;
case SHMDT: case SHMDT:
err = sys_shmdt ((char __user *)AA(ptr)); err = sys_shmdt(ptr);
goto out; goto out;
case SHMGET: case SHMGET:
err = sys_shmget (first, second, third); err = sys_shmget(first, second, third);
goto out; goto out;
case SHMCTL: case SHMCTL:
err = do_sys32_shmctl (first, second, (void *)AA(ptr)); err = do_sys32_shmctl(first, second, ptr);
goto out; goto out;
default: default:
err = -ENOSYS; err = -ENOSYS;
goto out; goto out;
} };
}
err = -ENOSYS; err = -ENOSYS;
out: out:
return err; return err;
} }
asmlinkage int sys32_truncate64(const char __user * path, unsigned long high, unsigned long low) asmlinkage long sys32_truncate64(const char __user * path, unsigned long high, unsigned long low)
{ {
if ((int)high < 0) if ((int)high < 0)
return -EINVAL; return -EINVAL;
...@@ -836,7 +859,7 @@ asmlinkage int sys32_truncate64(const char __user * path, unsigned long high, un ...@@ -836,7 +859,7 @@ asmlinkage int sys32_truncate64(const char __user * path, unsigned long high, un
return sys_truncate(path, (high << 32) | low); return sys_truncate(path, (high << 32) | low);
} }
asmlinkage int sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low) asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low)
{ {
if ((int)high < 0) if ((int)high < 0)
return -EINVAL; return -EINVAL;
...@@ -879,7 +902,7 @@ static int fillonedir(void * __buf, const char * name, int namlen, ...@@ -879,7 +902,7 @@ static int fillonedir(void * __buf, const char * name, int namlen,
return 0; return 0;
} }
asmlinkage int old32_readdir(unsigned int fd, struct old_linux_dirent32 __user *dirent, unsigned int count) asmlinkage long old32_readdir(unsigned int fd, struct old_linux_dirent32 __user *dirent, unsigned int count)
{ {
int error = -EBADF; int error = -EBADF;
struct file * file; struct file * file;
...@@ -943,7 +966,7 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset, i ...@@ -943,7 +966,7 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset, i
return 0; return 0;
} }
asmlinkage int sys32_getdents(unsigned int fd, struct linux_dirent32 __user *dirent, unsigned int count) asmlinkage long sys32_getdents(unsigned int fd, struct linux_dirent32 __user *dirent, unsigned int count)
{ {
struct file * file; struct file * file;
struct linux_dirent32 __user *lastdirent; struct linux_dirent32 __user *lastdirent;
...@@ -964,7 +987,7 @@ asmlinkage int sys32_getdents(unsigned int fd, struct linux_dirent32 __user *dir ...@@ -964,7 +987,7 @@ asmlinkage int sys32_getdents(unsigned int fd, struct linux_dirent32 __user *dir
goto out_putf; goto out_putf;
lastdirent = buf.previous; lastdirent = buf.previous;
error = buf.error; error = buf.error;
if(lastdirent) { if (lastdirent) {
put_user(file->f_pos, &lastdirent->d_off); put_user(file->f_pos, &lastdirent->d_off);
error = count - buf.count; error = count - buf.count;
} }
...@@ -1006,7 +1029,7 @@ int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf) ...@@ -1006,7 +1029,7 @@ int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
return err; return err;
} }
asmlinkage int sys32_sysfs(int option, u32 arg1, u32 arg2) asmlinkage long compat_sys_sysfs(int option, u32 arg1, u32 arg2)
{ {
return sys_sysfs(option, arg1, arg2); return sys_sysfs(option, arg1, arg2);
} }
...@@ -1028,7 +1051,7 @@ struct sysinfo32 { ...@@ -1028,7 +1051,7 @@ struct sysinfo32 {
char _f[20-2*sizeof(int)-sizeof(int)]; char _f[20-2*sizeof(int)-sizeof(int)];
}; };
asmlinkage int sys32_sysinfo(struct sysinfo32 __user *info) asmlinkage long sys32_sysinfo(struct sysinfo32 __user *info)
{ {
struct sysinfo s; struct sysinfo s;
int ret, err; int ret, err;
...@@ -1075,7 +1098,7 @@ asmlinkage int sys32_sysinfo(struct sysinfo32 __user *info) ...@@ -1075,7 +1098,7 @@ asmlinkage int sys32_sysinfo(struct sysinfo32 __user *info)
return ret; return ret;
} }
asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec __user *interval) asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec __user *interval)
{ {
struct timespec t; struct timespec t;
int ret; int ret;
...@@ -1089,7 +1112,10 @@ asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_times ...@@ -1089,7 +1112,10 @@ asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_times
return ret; return ret;
} }
asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t __user *set, compat_sigset_t __user *oset, compat_size_t sigsetsize) asmlinkage long compat_sys_rt_sigprocmask(int how,
compat_sigset_t __user *set,
compat_sigset_t __user *oset,
compat_size_t sigsetsize)
{ {
sigset_t s; sigset_t s;
compat_sigset_t s32; compat_sigset_t s32;
...@@ -1126,7 +1152,8 @@ asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t __user *set, compat ...@@ -1126,7 +1152,8 @@ asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t __user *set, compat
return 0; return 0;
} }
asmlinkage int sys32_rt_sigpending(compat_sigset_t __user *set, compat_size_t sigsetsize) asmlinkage long sys32_rt_sigpending(compat_sigset_t __user *set,
compat_size_t sigsetsize)
{ {
sigset_t s; sigset_t s;
compat_sigset_t s32; compat_sigset_t s32;
...@@ -1149,10 +1176,10 @@ asmlinkage int sys32_rt_sigpending(compat_sigset_t __user *set, compat_size_t si ...@@ -1149,10 +1176,10 @@ asmlinkage int sys32_rt_sigpending(compat_sigset_t __user *set, compat_size_t si
return ret; return ret;
} }
asmlinkage int asmlinkage long sys32_rt_sigtimedwait(compat_sigset_t __user *uthese,
sys32_rt_sigtimedwait(compat_sigset_t __user *uthese, siginfo_t32 __user *uinfo, siginfo_t32 __user *uinfo,
struct compat_timespec __user *uts, struct compat_timespec __user *uts,
compat_size_t sigsetsize) compat_size_t sigsetsize)
{ {
int ret, sig; int ret, sig;
sigset_t these; sigset_t these;
...@@ -1234,8 +1261,8 @@ sys32_rt_sigtimedwait(compat_sigset_t __user *uthese, siginfo_t32 __user *uinfo, ...@@ -1234,8 +1261,8 @@ sys32_rt_sigtimedwait(compat_sigset_t __user *uthese, siginfo_t32 __user *uinfo,
return ret; return ret;
} }
asmlinkage int asmlinkage long compat_sys_rt_sigqueueinfo(int pid, int sig,
sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 __user *uinfo) siginfo_t32 __user *uinfo)
{ {
siginfo_t info; siginfo_t info;
int ret; int ret;
...@@ -1250,8 +1277,8 @@ sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 __user *uinfo) ...@@ -1250,8 +1277,8 @@ sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 __user *uinfo)
return ret; return ret;
} }
asmlinkage int sys32_sigaction (int sig, struct old_sigaction32 __user *act, asmlinkage long compat_sys_sigaction(int sig, struct old_sigaction32 __user *act,
struct old_sigaction32 __user *oact) struct old_sigaction32 __user *oact)
{ {
struct k_sigaction new_ka, old_ka; struct k_sigaction new_ka, old_ka;
int ret; int ret;
...@@ -1289,10 +1316,11 @@ asmlinkage int sys32_sigaction (int sig, struct old_sigaction32 __user *act, ...@@ -1289,10 +1316,11 @@ asmlinkage int sys32_sigaction (int sig, struct old_sigaction32 __user *act,
return ret; return ret;
} }
asmlinkage int asmlinkage long compat_sys_rt_sigaction(int sig,
sys32_rt_sigaction(int sig, struct sigaction32 __user *act, struct sigaction32 __user *act,
struct sigaction32 __user *oact, struct sigaction32 __user *oact,
void __user *restorer, compat_size_t sigsetsize) void __user *restorer,
compat_size_t sigsetsize)
{ {
struct k_sigaction new_ka, old_ka; struct k_sigaction new_ka, old_ka;
int ret; int ret;
...@@ -1351,27 +1379,29 @@ sys32_rt_sigaction(int sig, struct sigaction32 __user *act, ...@@ -1351,27 +1379,29 @@ sys32_rt_sigaction(int sig, struct sigaction32 __user *act,
* sparc32_execve() executes a new program after the asm stub has set * sparc32_execve() executes a new program after the asm stub has set
* things up for us. This should basically do what I want it to. * things up for us. This should basically do what I want it to.
*/ */
asmlinkage int sparc32_execve(struct pt_regs *regs) asmlinkage long sparc32_execve(struct pt_regs *regs)
{ {
int error, base = 0; int error, base = 0;
char *filename; char *filename;
/* User register window flush is done by entry.S */ /* User register window flush is done by entry.S */
/* Check for indirect call. */ /* Check for indirect call. */
if((u32)regs->u_regs[UREG_G1] == 0) if ((u32)regs->u_regs[UREG_G1] == 0)
base = 1; base = 1;
filename = getname((char __user *)AA(regs->u_regs[base + UREG_I0])); filename = getname(compat_ptr(regs->u_regs[base + UREG_I0]));
error = PTR_ERR(filename); error = PTR_ERR(filename);
if(IS_ERR(filename)) if (IS_ERR(filename))
goto out; goto out;
error = compat_do_execve(filename,
compat_ptr((u32)regs->u_regs[base + UREG_I1]), error = compat_do_execve(filename,
compat_ptr((u32)regs->u_regs[base + UREG_I2]), regs); compat_ptr(regs->u_regs[base + UREG_I1]),
putname(filename); compat_ptr(regs->u_regs[base + UREG_I2]), regs);
if(!error) { putname(filename);
if (!error) {
fprs_write(0); fprs_write(0);
current_thread_info()->xfsr[0] = 0; current_thread_info()->xfsr[0] = 0;
current_thread_info()->fpsaved[0] = 0; current_thread_info()->fpsaved[0] = 0;
...@@ -1379,33 +1409,32 @@ asmlinkage int sparc32_execve(struct pt_regs *regs) ...@@ -1379,33 +1409,32 @@ asmlinkage int sparc32_execve(struct pt_regs *regs)
current->ptrace &= ~PT_DTRACE; current->ptrace &= ~PT_DTRACE;
} }
out: out:
return error; return error;
} }
#ifdef CONFIG_MODULES #ifdef CONFIG_MODULES
asmlinkage int sys32_init_module(void __user *umod, u32 len, asmlinkage long sys32_init_module(void __user *umod, u32 len,
const char __user *uargs) const char __user *uargs)
{ {
return sys_init_module(umod, len, uargs); return sys_init_module(umod, len, uargs);
} }
asmlinkage int sys32_delete_module(const char __user *name_user, asmlinkage long sys32_delete_module(const char __user *name_user,
unsigned int flags) unsigned int flags)
{ {
return sys_delete_module(name_user, flags); return sys_delete_module(name_user, flags);
} }
#else /* CONFIG_MODULES */ #else /* CONFIG_MODULES */
asmlinkage int asmlinkage long sys32_init_module(const char __user *name_user,
sys32_init_module(const char *name_user, struct module *mod_user) struct module __user *mod_user)
{ {
return -ENOSYS; return -ENOSYS;
} }
asmlinkage int asmlinkage long sys32_delete_module(const char __user *name_user)
sys32_delete_module(const char *name_user)
{ {
return -ENOSYS; return -ENOSYS;
} }
...@@ -1417,8 +1446,8 @@ sys32_delete_module(const char *name_user) ...@@ -1417,8 +1446,8 @@ sys32_delete_module(const char *name_user)
extern struct timezone sys_tz; extern struct timezone sys_tz;
asmlinkage int sys32_gettimeofday(struct compat_timeval __user *tv, asmlinkage long sys32_gettimeofday(struct compat_timeval __user *tv,
struct timezone __user *tz) struct timezone __user *tz)
{ {
if (tv) { if (tv) {
struct timeval ktv; struct timeval ktv;
...@@ -1447,8 +1476,8 @@ static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i) ...@@ -1447,8 +1476,8 @@ static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i)
return 0; return 0;
} }
asmlinkage int sys32_settimeofday(struct compat_timeval __user *tv, asmlinkage long sys32_settimeofday(struct compat_timeval __user *tv,
struct timezone __user *tz) struct timezone __user *tz)
{ {
struct timespec kts; struct timespec kts;
struct timezone ktz; struct timezone ktz;
...@@ -1465,8 +1494,8 @@ asmlinkage int sys32_settimeofday(struct compat_timeval __user *tv, ...@@ -1465,8 +1494,8 @@ asmlinkage int sys32_settimeofday(struct compat_timeval __user *tv,
return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL); return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
} }
asmlinkage int sys32_utimes(char __user *filename, asmlinkage long sys32_utimes(char __user *filename,
struct compat_timeval __user *tvs) struct compat_timeval __user *tvs)
{ {
struct timeval ktvs[2]; struct timeval ktvs[2];
...@@ -1480,74 +1509,61 @@ asmlinkage int sys32_utimes(char __user *filename, ...@@ -1480,74 +1509,61 @@ asmlinkage int sys32_utimes(char __user *filename,
} }
/* These are here just in case some old sparc32 binary calls it. */ /* These are here just in case some old sparc32 binary calls it. */
asmlinkage int sys32_pause(void) asmlinkage long sys32_pause(void)
{ {
current->state = TASK_INTERRUPTIBLE; current->state = TASK_INTERRUPTIBLE;
schedule(); schedule();
return -ERESTARTNOHAND; return -ERESTARTNOHAND;
} }
/* PCI config space poking. */ asmlinkage compat_ssize_t sys32_pread64(unsigned int fd,
char __user *ubuf,
asmlinkage int sys32_pciconfig_read(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf)
{
return sys_pciconfig_read((unsigned long) bus,
(unsigned long) dfn,
(unsigned long) off,
(unsigned long) len,
(unsigned char __user *)AA(ubuf));
}
asmlinkage int sys32_pciconfig_write(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf)
{
return sys_pciconfig_write((unsigned long) bus,
(unsigned long) dfn,
(unsigned long) off,
(unsigned long) len,
(unsigned char __user *)AA(ubuf));
}
asmlinkage int sys32_prctl(int option, u32 arg2, u32 arg3, u32 arg4, u32 arg5)
{
return sys_prctl(option,
(unsigned long) arg2,
(unsigned long) arg3,
(unsigned long) arg4,
(unsigned long) arg5);
}
asmlinkage compat_ssize_t sys32_pread64(unsigned int fd, char __user *ubuf,
compat_size_t count, compat_size_t count,
u32 poshi, u32 poslo) unsigned long poshi,
unsigned long poslo)
{ {
return sys_pread64(fd, ubuf, count, return sys_pread64(fd, ubuf, count, (poshi << 32) | poslo);
((loff_t)AA(poshi) << 32) | AA(poslo));
} }
asmlinkage compat_ssize_t sys32_pwrite64(unsigned int fd, char __user *ubuf, asmlinkage compat_ssize_t sys32_pwrite64(unsigned int fd,
compat_size_t count, u32 poshi, u32 poslo) char __user *ubuf,
compat_size_t count,
unsigned long poshi,
unsigned long poslo)
{ {
return sys_pwrite64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo)); return sys_pwrite64(fd, ubuf, count, (poshi << 32) | poslo);
} }
asmlinkage compat_ssize_t sys32_readahead(int fd, u32 offhi, u32 offlo, s32 count) asmlinkage long compat_sys_readahead(int fd,
unsigned long offhi,
unsigned long offlo,
compat_size_t count)
{ {
return sys_readahead(fd, ((loff_t)AA(offhi) << 32) | AA(offlo), count); return sys_readahead(fd, (offhi << 32) | offlo, count);
} }
long sys32_fadvise64(int fd, u32 offhi, u32 offlo, s32 len, int advice) long compat_sys_fadvise64(int fd,
unsigned long offhi,
unsigned long offlo,
compat_size_t len, int advice)
{ {
return sys_fadvise64_64(fd, ((loff_t)AA(offhi)<<32)|AA(offlo), len, advice); return sys_fadvise64_64(fd, (offhi << 32) | offlo, len, advice);
} }
long sys32_fadvise64_64(int fd, u32 offhi, u32 offlo, u32 lenhi, u32 lenlo, int advice) long compat_sys_fadvise64_64(int fd,
unsigned long offhi, unsigned long offlo,
unsigned long lenhi, unsigned long lenlo,
int advice)
{ {
return sys_fadvise64_64(fd, ((loff_t)AA(offhi)<<32)|AA(offlo), return sys_fadvise64_64(fd,
((loff_t)AA(lenhi)<<32)|AA(lenlo), advice); (offhi << 32) | offlo,
(lenhi << 32) | lenlo,
advice);
} }
asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, s32 count) asmlinkage long compat_sys_sendfile(int out_fd, int in_fd,
compat_off_t __user *offset,
compat_size_t count)
{ {
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
int ret; int ret;
...@@ -1568,7 +1584,9 @@ asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset ...@@ -1568,7 +1584,9 @@ asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset
return ret; return ret;
} }
asmlinkage int sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset, s32 count) asmlinkage long compat_sys_sendfile64(int out_fd, int in_fd,
compat_loff_t __user *offset,
compat_size_t count)
{ {
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
int ret; int ret;
...@@ -1606,57 +1624,57 @@ struct timex32 { ...@@ -1606,57 +1624,57 @@ struct timex32 {
extern int do_adjtimex(struct timex *); extern int do_adjtimex(struct timex *);
asmlinkage int sys32_adjtimex(struct timex32 __user *utp) asmlinkage long sys32_adjtimex(struct timex32 __user *utp)
{ {
struct timex txc; struct timex txc;
int ret; int ret;
memset(&txc, 0, sizeof(struct timex)); memset(&txc, 0, sizeof(struct timex));
if(get_user(txc.modes, &utp->modes) || if (get_user(txc.modes, &utp->modes) ||
__get_user(txc.offset, &utp->offset) || __get_user(txc.offset, &utp->offset) ||
__get_user(txc.freq, &utp->freq) || __get_user(txc.freq, &utp->freq) ||
__get_user(txc.maxerror, &utp->maxerror) || __get_user(txc.maxerror, &utp->maxerror) ||
__get_user(txc.esterror, &utp->esterror) || __get_user(txc.esterror, &utp->esterror) ||
__get_user(txc.status, &utp->status) || __get_user(txc.status, &utp->status) ||
__get_user(txc.constant, &utp->constant) || __get_user(txc.constant, &utp->constant) ||
__get_user(txc.precision, &utp->precision) || __get_user(txc.precision, &utp->precision) ||
__get_user(txc.tolerance, &utp->tolerance) || __get_user(txc.tolerance, &utp->tolerance) ||
__get_user(txc.time.tv_sec, &utp->time.tv_sec) || __get_user(txc.time.tv_sec, &utp->time.tv_sec) ||
__get_user(txc.time.tv_usec, &utp->time.tv_usec) || __get_user(txc.time.tv_usec, &utp->time.tv_usec) ||
__get_user(txc.tick, &utp->tick) || __get_user(txc.tick, &utp->tick) ||
__get_user(txc.ppsfreq, &utp->ppsfreq) || __get_user(txc.ppsfreq, &utp->ppsfreq) ||
__get_user(txc.jitter, &utp->jitter) || __get_user(txc.jitter, &utp->jitter) ||
__get_user(txc.shift, &utp->shift) || __get_user(txc.shift, &utp->shift) ||
__get_user(txc.stabil, &utp->stabil) || __get_user(txc.stabil, &utp->stabil) ||
__get_user(txc.jitcnt, &utp->jitcnt) || __get_user(txc.jitcnt, &utp->jitcnt) ||
__get_user(txc.calcnt, &utp->calcnt) || __get_user(txc.calcnt, &utp->calcnt) ||
__get_user(txc.errcnt, &utp->errcnt) || __get_user(txc.errcnt, &utp->errcnt) ||
__get_user(txc.stbcnt, &utp->stbcnt)) __get_user(txc.stbcnt, &utp->stbcnt))
return -EFAULT; return -EFAULT;
ret = do_adjtimex(&txc); ret = do_adjtimex(&txc);
if(put_user(txc.modes, &utp->modes) || if (put_user(txc.modes, &utp->modes) ||
__put_user(txc.offset, &utp->offset) || __put_user(txc.offset, &utp->offset) ||
__put_user(txc.freq, &utp->freq) || __put_user(txc.freq, &utp->freq) ||
__put_user(txc.maxerror, &utp->maxerror) || __put_user(txc.maxerror, &utp->maxerror) ||
__put_user(txc.esterror, &utp->esterror) || __put_user(txc.esterror, &utp->esterror) ||
__put_user(txc.status, &utp->status) || __put_user(txc.status, &utp->status) ||
__put_user(txc.constant, &utp->constant) || __put_user(txc.constant, &utp->constant) ||
__put_user(txc.precision, &utp->precision) || __put_user(txc.precision, &utp->precision) ||
__put_user(txc.tolerance, &utp->tolerance) || __put_user(txc.tolerance, &utp->tolerance) ||
__put_user(txc.time.tv_sec, &utp->time.tv_sec) || __put_user(txc.time.tv_sec, &utp->time.tv_sec) ||
__put_user(txc.time.tv_usec, &utp->time.tv_usec) || __put_user(txc.time.tv_usec, &utp->time.tv_usec) ||
__put_user(txc.tick, &utp->tick) || __put_user(txc.tick, &utp->tick) ||
__put_user(txc.ppsfreq, &utp->ppsfreq) || __put_user(txc.ppsfreq, &utp->ppsfreq) ||
__put_user(txc.jitter, &utp->jitter) || __put_user(txc.jitter, &utp->jitter) ||
__put_user(txc.shift, &utp->shift) || __put_user(txc.shift, &utp->shift) ||
__put_user(txc.stabil, &utp->stabil) || __put_user(txc.stabil, &utp->stabil) ||
__put_user(txc.jitcnt, &utp->jitcnt) || __put_user(txc.jitcnt, &utp->jitcnt) ||
__put_user(txc.calcnt, &utp->calcnt) || __put_user(txc.calcnt, &utp->calcnt) ||
__put_user(txc.errcnt, &utp->errcnt) || __put_user(txc.errcnt, &utp->errcnt) ||
__put_user(txc.stbcnt, &utp->stbcnt)) __put_user(txc.stbcnt, &utp->stbcnt))
ret = -EFAULT; ret = -EFAULT;
return ret; return ret;
...@@ -1666,7 +1684,8 @@ asmlinkage int sys32_adjtimex(struct timex32 __user *utp) ...@@ -1666,7 +1684,8 @@ asmlinkage int sys32_adjtimex(struct timex32 __user *utp)
* not force O_LARGEFILE on. * not force O_LARGEFILE on.
*/ */
asmlinkage long sparc32_open(const char __user *filename, int flags, int mode) asmlinkage long sparc32_open(const char __user *filename,
int flags, int mode)
{ {
char * tmp; char * tmp;
int fd, error; int fd, error;
...@@ -1703,7 +1722,7 @@ asmlinkage unsigned long sys32_mremap(unsigned long addr, ...@@ -1703,7 +1722,7 @@ asmlinkage unsigned long sys32_mremap(unsigned long addr,
{ {
struct vm_area_struct *vma; struct vm_area_struct *vma;
unsigned long ret = -EINVAL; unsigned long ret = -EINVAL;
unsigned long new_addr = AA(__new_addr); unsigned long new_addr = __new_addr;
if (old_len > 0xf0000000UL || new_len > 0xf0000000UL) if (old_len > 0xf0000000UL || new_len > 0xf0000000UL)
goto out; goto out;
...@@ -1744,13 +1763,6 @@ asmlinkage unsigned long sys32_mremap(unsigned long addr, ...@@ -1744,13 +1763,6 @@ asmlinkage unsigned long sys32_mremap(unsigned long addr,
return ret; return ret;
} }
asmlinkage int sys_setpriority32(u32 which, u32 who, u32 niceval)
{
return sys_setpriority((int) which,
(int) who,
(int) niceval);
}
struct __sysctl_args32 { struct __sysctl_args32 {
u32 name; u32 name;
int nlen; int nlen;
...@@ -1781,21 +1793,24 @@ asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args) ...@@ -1781,21 +1793,24 @@ asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
basically copy the whole sysctl.c here, and basically copy the whole sysctl.c here, and
glibc's __sysctl uses rw memory for the structure glibc's __sysctl uses rw memory for the structure
anyway. */ anyway. */
if (get_user(oldlen, (u32 __user *)A(tmp.oldlenp)) || if (get_user(oldlen, (u32 __user *)(unsigned long)tmp.oldlenp) ||
put_user(oldlen, (size_t __user *)addr)) put_user(oldlen, (size_t __user *)addr))
return -EFAULT; return -EFAULT;
oldlenp = (size_t __user *)addr; oldlenp = (size_t __user *)addr;
} }
lock_kernel(); lock_kernel();
error = do_sysctl((int __user *)A(tmp.name), tmp.nlen, error = do_sysctl((int __user *)(unsigned long) tmp.name,
(void __user *)A(tmp.oldval), tmp.nlen,
oldlenp, (void __user *)A(tmp.newval), tmp.newlen); (void __user *)(unsigned long) tmp.oldval,
oldlenp,
(void __user *)(unsigned long) tmp.newval,
tmp.newlen);
unlock_kernel(); unlock_kernel();
if (oldlenp) { if (oldlenp) {
if (!error) { if (!error) {
if (get_user(oldlen, (size_t __user *)addr) || if (get_user(oldlen, (size_t __user *)addr) ||
put_user(oldlen, (u32 __user *)A(tmp.oldlenp))) put_user(oldlen, (u32 __user *)(unsigned long) tmp.oldlenp))
error = -EFAULT; error = -EFAULT;
} }
copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused)); copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused));
...@@ -1804,10 +1819,11 @@ asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args) ...@@ -1804,10 +1819,11 @@ asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
#endif #endif
} }
long sys32_lookup_dcookie(u32 cookie_high, u32 cookie_low, long sys32_lookup_dcookie(unsigned long cookie_high,
unsigned long cookie_low,
char __user *buf, size_t len) char __user *buf, size_t len)
{ {
return sys_lookup_dcookie((u64)cookie_high << 32 | cookie_low, return sys_lookup_dcookie((cookie_high << 32) | cookie_low,
buf, len); buf, len);
} }
......
...@@ -59,15 +59,6 @@ ...@@ -59,15 +59,6 @@
#include <net/sock.h> #include <net/sock.h>
#include <net/compat.h> #include <net/compat.h>
/* Use this to get at 32-bit user passed pointers. */
#define A(__x) \
({ unsigned long __ret; \
__asm__ ("srl %0, 0, %0" \
: "=r" (__ret) \
: "0" (__x)); \
__ret; \
})
#define SUNOS_NR_OPEN 256 #define SUNOS_NR_OPEN 256
asmlinkage u32 sunos_mmap(u32 addr, u32 len, u32 prot, u32 flags, u32 fd, u32 off) asmlinkage u32 sunos_mmap(u32 addr, u32 len, u32 prot, u32 flags, u32 fd, u32 off)
...@@ -308,13 +299,12 @@ static int sunos_filldir(void * __buf, const char * name, int namlen, ...@@ -308,13 +299,12 @@ static int sunos_filldir(void * __buf, const char * name, int namlen,
return 0; return 0;
} }
asmlinkage int sunos_getdents(unsigned int fd, u32 u_dirent, int cnt) asmlinkage int sunos_getdents(unsigned int fd, void __user *dirent, int cnt)
{ {
struct file * file; struct file * file;
struct sunos_dirent __user *lastdirent; struct sunos_dirent __user *lastdirent;
struct sunos_dirent_callback buf; struct sunos_dirent_callback buf;
int error = -EBADF; int error = -EBADF;
void __user *dirent = (void __user *)A(u_dirent);
if (fd >= SUNOS_NR_OPEN) if (fd >= SUNOS_NR_OPEN)
goto out; goto out;
...@@ -389,11 +379,11 @@ static int sunos_filldirentry(void * __buf, const char * name, int namlen, ...@@ -389,11 +379,11 @@ static int sunos_filldirentry(void * __buf, const char * name, int namlen,
return 0; return 0;
} }
asmlinkage int sunos_getdirentries(unsigned int fd, u32 u_dirent, asmlinkage int sunos_getdirentries(unsigned int fd,
int cnt, u32 u_basep) void __user *dirent,
int cnt,
unsigned int __user *basep)
{ {
void __user *dirent = (void __user *) A(u_dirent);
unsigned int __user *basep = (unsigned int __user *)A(u_basep);
struct file * file; struct file * file;
struct sunos_direntry __user *lastdirent; struct sunos_direntry __user *lastdirent;
int error = -EBADF; int error = -EBADF;
...@@ -813,13 +803,12 @@ asmlinkage int sunos_setpgrp(pid_t pid, pid_t pgid) ...@@ -813,13 +803,12 @@ asmlinkage int sunos_setpgrp(pid_t pid, pid_t pgid)
extern long compat_sys_wait4(compat_pid_t, compat_uint_t *, int, extern long compat_sys_wait4(compat_pid_t, compat_uint_t *, int,
struct compat_rusage *); struct compat_rusage *);
asmlinkage int sunos_wait4(compat_pid_t pid, u32 stat_addr, int options, u32 ru) asmlinkage int sunos_wait4(compat_pid_t pid, compat_uint_t __user *stat_addr, int options, struct compat_rusage __user *ru)
{ {
int ret; int ret;
ret = compat_sys_wait4((pid ? pid : ((compat_pid_t)-1)), ret = compat_sys_wait4((pid ? pid : ((compat_pid_t)-1)),
(compat_uint_t *)A(stat_addr), options, stat_addr, options, ru);
(struct compat_rusage *)A(ru));
return ret; return ret;
} }
...@@ -893,7 +882,7 @@ asmlinkage s32 sunos_sysconf (int name) ...@@ -893,7 +882,7 @@ asmlinkage s32 sunos_sysconf (int name)
return ret; return ret;
} }
asmlinkage int sunos_semsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 ptr) asmlinkage int sunos_semsys(int op, u32 arg1, u32 arg2, u32 arg3, void __user *ptr)
{ {
union semun arg4; union semun arg4;
int ret; int ret;
...@@ -919,7 +908,7 @@ asmlinkage int sunos_semsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 ptr) ...@@ -919,7 +908,7 @@ asmlinkage int sunos_semsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 ptr)
} }
/* sys_semctl(): */ /* sys_semctl(): */
/* value to modify semaphore to */ /* value to modify semaphore to */
arg4.__pad=(void __user *)A(ptr); arg4.__pad = ptr;
ret = sys_semctl((int)arg1, (int)arg2, (int)arg3, arg4); ret = sys_semctl((int)arg1, (int)arg2, (int)arg3, arg4);
break; break;
case 1: case 1:
...@@ -928,7 +917,7 @@ asmlinkage int sunos_semsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 ptr) ...@@ -928,7 +917,7 @@ asmlinkage int sunos_semsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 ptr)
break; break;
case 2: case 2:
/* sys_semop(): */ /* sys_semop(): */
ret = sys_semop((int)arg1, (struct sembuf __user *)A(arg2), ret = sys_semop((int)arg1, (struct sembuf __user *)(unsigned long)arg2,
(unsigned int) arg3); (unsigned int) arg3);
break; break;
default: default:
...@@ -1041,13 +1030,13 @@ asmlinkage int sunos_msgsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 arg4) ...@@ -1041,13 +1030,13 @@ asmlinkage int sunos_msgsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 arg4)
rval = sys_msgget((key_t)arg1, (int)arg2); rval = sys_msgget((key_t)arg1, (int)arg2);
break; break;
case 1: case 1:
if (!sunos_msqid_get((struct msqid_ds32 __user *)A(arg3), &kds)) { if (!sunos_msqid_get((struct msqid_ds32 __user *)(unsigned long)arg3, &kds)) {
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
rval = sys_msgctl((int)arg1, (int)arg2, rval = sys_msgctl((int)arg1, (int)arg2,
(struct msqid_ds __user *)A(arg3)); (struct msqid_ds __user *)(unsigned long)arg3);
set_fs(old_fs); set_fs(old_fs);
if (!rval) if (!rval)
rval = sunos_msqid_put((struct msqid_ds32 __user *)A(arg3), rval = sunos_msqid_put((struct msqid_ds32 __user *)(unsigned long)arg3,
&kds); &kds);
} else } else
rval = -EFAULT; rval = -EFAULT;
...@@ -1071,7 +1060,7 @@ asmlinkage int sunos_msgsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 arg4) ...@@ -1071,7 +1060,7 @@ asmlinkage int sunos_msgsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 arg4)
(long)arg4, (int)arg5); (long)arg4, (int)arg5);
set_fs(old_fs); set_fs(old_fs);
if (!rval) if (!rval)
rval = sunos_msgbuf_put((struct msgbuf32 __user *)A(arg2), rval = sunos_msgbuf_put((struct msgbuf32 __user *)(unsigned long)arg2,
kmbuf, arg3); kmbuf, arg3);
kfree(kmbuf); kfree(kmbuf);
break; break;
...@@ -1079,7 +1068,7 @@ asmlinkage int sunos_msgsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 arg4) ...@@ -1079,7 +1068,7 @@ asmlinkage int sunos_msgsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 arg4)
rval = -EFAULT; rval = -EFAULT;
kmbuf = (struct msgbuf *)kmalloc(sizeof(struct msgbuf) + arg3, kmbuf = (struct msgbuf *)kmalloc(sizeof(struct msgbuf) + arg3,
GFP_KERNEL); GFP_KERNEL);
if (!kmbuf || sunos_msgbuf_get((struct msgbuf32 __user *)A(arg2), if (!kmbuf || sunos_msgbuf_get((struct msgbuf32 __user *)(unsigned long)arg2,
kmbuf, arg3)) kmbuf, arg3))
break; break;
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
...@@ -1154,26 +1143,26 @@ asmlinkage int sunos_shmsys(int op, u32 arg1, u32 arg2, u32 arg3) ...@@ -1154,26 +1143,26 @@ asmlinkage int sunos_shmsys(int op, u32 arg1, u32 arg2, u32 arg3)
switch(op) { switch(op) {
case 0: case 0:
/* do_shmat(): attach a shared memory area */ /* do_shmat(): attach a shared memory area */
rval = do_shmat((int)arg1,(char __user *)A(arg2),(int)arg3,&raddr); rval = do_shmat((int)arg1,(char __user *)(unsigned long)arg2,(int)arg3,&raddr);
if (!rval) if (!rval)
rval = (int) raddr; rval = (int) raddr;
break; break;
case 1: case 1:
/* sys_shmctl(): modify shared memory area attr. */ /* sys_shmctl(): modify shared memory area attr. */
if (!sunos_shmid_get((struct shmid_ds32 __user *)A(arg3), &ksds)) { if (!sunos_shmid_get((struct shmid_ds32 __user *)(unsigned long)arg3, &ksds)) {
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
rval = sys_shmctl((int) arg1,(int) arg2, rval = sys_shmctl((int) arg1,(int) arg2,
(struct shmid_ds __user *) &ksds); (struct shmid_ds __user *) &ksds);
set_fs(old_fs); set_fs(old_fs);
if (!rval) if (!rval)
rval = sunos_shmid_put((struct shmid_ds32 __user *)A(arg3), rval = sunos_shmid_put((struct shmid_ds32 __user *)(unsigned long)arg3,
&ksds); &ksds);
} else } else
rval = -EFAULT; rval = -EFAULT;
break; break;
case 2: case 2:
/* sys_shmdt(): detach a shared memory area */ /* sys_shmdt(): detach a shared memory area */
rval = sys_shmdt((char __user *)A(arg1)); rval = sys_shmdt((char __user *)(unsigned long)arg1);
break; break;
case 3: case 3:
/* sys_shmget(): get a shared memory area */ /* sys_shmget(): get a shared memory area */
...@@ -1215,66 +1204,60 @@ static inline int check_nonblock(int ret, int fd) ...@@ -1215,66 +1204,60 @@ static inline int check_nonblock(int ret, int fd)
return ret; return ret;
} }
asmlinkage int sunos_read(unsigned int fd, u32 buf, u32 count) asmlinkage int sunos_read(unsigned int fd, char __user *buf, u32 count)
{ {
int ret; int ret;
ret = check_nonblock(sys_read(fd, (char __user *)A(buf), count), fd); ret = check_nonblock(sys_read(fd, buf, count), fd);
return ret; return ret;
} }
asmlinkage int sunos_readv(u32 fd, u32 vector, s32 count) asmlinkage int sunos_readv(u32 fd, void __user *vector, s32 count)
{ {
int ret; int ret;
ret = check_nonblock(compat_sys_readv(fd, (void __user *) A(vector), ret = check_nonblock(compat_sys_readv(fd, vector, count), fd);
count), fd);
return ret; return ret;
} }
asmlinkage int sunos_write(unsigned int fd, u32 buf, u32 count) asmlinkage int sunos_write(unsigned int fd, char __user *buf, u32 count)
{ {
int ret; int ret;
ret = check_nonblock(sys_write(fd, (char __user *)A(buf), count), fd); ret = check_nonblock(sys_write(fd, buf, count), fd);
return ret; return ret;
} }
asmlinkage int sunos_writev(u32 fd, u32 vector, s32 count) asmlinkage int sunos_writev(u32 fd, void __user *vector, s32 count)
{ {
int ret; int ret;
ret = check_nonblock(compat_sys_writev(fd, (void __user *)A(vector), ret = check_nonblock(compat_sys_writev(fd, vector, count), fd);
count), fd);
return ret; return ret;
} }
asmlinkage int sunos_recv(int fd, u32 ubuf, int size, unsigned flags) asmlinkage int sunos_recv(u32 __fd, void __user *ubuf, int size, unsigned flags)
{ {
int ret; int ret, fd = (int) __fd;
ret = check_nonblock(sys_recv(fd, (void __user *)A(ubuf), ret = check_nonblock(sys_recv(fd, ubuf, size, flags), fd);
size, flags), fd);
return ret; return ret;
} }
asmlinkage int sunos_send(int fd, u32 buff, int len, unsigned flags) asmlinkage int sunos_send(u32 __fd, void __user *buff, int len, unsigned flags)
{ {
int ret; int ret, fd = (int) __fd;
ret = check_nonblock(sys_send(fd, (void __user *)A(buff), ret = check_nonblock(sys_send(fd, buff, len, flags), fd);
len, flags), fd);
return ret; return ret;
} }
asmlinkage int sunos_accept(int fd, u32 sa, u32 addrlen) asmlinkage int sunos_accept(u32 __fd, struct sockaddr __user *sa, int __user *addrlen)
{ {
int ret; int ret, fd = (int) __fd;
while (1) { while (1) {
ret = check_nonblock(sys_accept(fd, ret = check_nonblock(sys_accept(fd, sa, addrlen), fd);
(struct sockaddr __user *)A(sa),
(int __user *)A(addrlen)), fd);
if (ret != -ENETUNREACH && ret != -EHOSTUNREACH) if (ret != -ENETUNREACH && ret != -EHOSTUNREACH)
break; break;
} }
...@@ -1283,7 +1266,9 @@ asmlinkage int sunos_accept(int fd, u32 sa, u32 addrlen) ...@@ -1283,7 +1266,9 @@ asmlinkage int sunos_accept(int fd, u32 sa, u32 addrlen)
#define SUNOS_SV_INTERRUPT 2 #define SUNOS_SV_INTERRUPT 2
asmlinkage int sunos_sigaction (int sig, u32 act, u32 oact) asmlinkage int sunos_sigaction (int sig,
struct old_sigaction32 __user *act,
struct old_sigaction32 __user *oact)
{ {
struct k_sigaction new_ka, old_ka; struct k_sigaction new_ka, old_ka;
int ret; int ret;
...@@ -1292,11 +1277,11 @@ asmlinkage int sunos_sigaction (int sig, u32 act, u32 oact) ...@@ -1292,11 +1277,11 @@ asmlinkage int sunos_sigaction (int sig, u32 act, u32 oact)
compat_old_sigset_t mask; compat_old_sigset_t mask;
u32 u_handler; u32 u_handler;
if (get_user(u_handler, &((struct old_sigaction32 __user *)A(act))->sa_handler) || if (get_user(u_handler, &act->sa_handler) ||
__get_user(new_ka.sa.sa_flags, &((struct old_sigaction32 __user *)A(act))->sa_flags)) __get_user(new_ka.sa.sa_flags, &act->sa_flags))
return -EFAULT; return -EFAULT;
new_ka.sa.sa_handler = (void *) (long) u_handler; new_ka.sa.sa_handler = (void *) (long) u_handler;
__get_user(mask, &((struct old_sigaction32 __user *)A(act))->sa_mask); __get_user(mask, &act->sa_mask);
new_ka.sa.sa_restorer = NULL; new_ka.sa.sa_restorer = NULL;
new_ka.ka_restorer = NULL; new_ka.ka_restorer = NULL;
siginitset(&new_ka.sa.sa_mask, mask); siginitset(&new_ka.sa.sa_mask, mask);
...@@ -1307,18 +1292,22 @@ asmlinkage int sunos_sigaction (int sig, u32 act, u32 oact) ...@@ -1307,18 +1292,22 @@ asmlinkage int sunos_sigaction (int sig, u32 act, u32 oact)
if (!ret && oact) { if (!ret && oact) {
old_ka.sa.sa_flags ^= SUNOS_SV_INTERRUPT; old_ka.sa.sa_flags ^= SUNOS_SV_INTERRUPT;
if (put_user((long)old_ka.sa.sa_handler, &((struct old_sigaction32 __user *)A(oact))->sa_handler) || if (put_user((long)old_ka.sa.sa_handler, &oact->sa_handler) ||
__put_user(old_ka.sa.sa_flags, &((struct old_sigaction32 __user *)A(oact))->sa_flags)) __put_user(old_ka.sa.sa_flags, &oact->sa_flags))
return -EFAULT; return -EFAULT;
__put_user(old_ka.sa.sa_mask.sig[0], &((struct old_sigaction32 __user *)A(oact))->sa_mask); __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
} }
return ret; return ret;
} }
asmlinkage int sunos_setsockopt(int fd, int level, int optname, u32 optval, asmlinkage int sunos_setsockopt(u32 __fd, u32 __level, u32 __optname,
int optlen) char __user *optval, u32 __optlen)
{ {
int fd = (int) __fd;
int level = (int) __level;
int optname = (int) __optname;
int optlen = (int) __optlen;
int tr_opt = optname; int tr_opt = optname;
int ret; int ret;
...@@ -1328,13 +1317,16 @@ asmlinkage int sunos_setsockopt(int fd, int level, int optname, u32 optval, ...@@ -1328,13 +1317,16 @@ asmlinkage int sunos_setsockopt(int fd, int level, int optname, u32 optval,
tr_opt += 30; tr_opt += 30;
} }
ret = sys_setsockopt(fd, level, tr_opt, ret = sys_setsockopt(fd, level, tr_opt,
(char __user *)A(optval), optlen); optval, optlen);
return ret; return ret;
} }
asmlinkage int sunos_getsockopt(int fd, int level, int optname, asmlinkage int sunos_getsockopt(u32 __fd, u32 __level, u32 __optname,
u32 optval, u32 optlen) char __user *optval, int __user *optlen)
{ {
int fd = (int) __fd;
int level = (int) __level;
int optname = (int) __optname;
int tr_opt = optname; int tr_opt = optname;
int ret; int ret;
...@@ -1344,7 +1336,6 @@ asmlinkage int sunos_getsockopt(int fd, int level, int optname, ...@@ -1344,7 +1336,6 @@ asmlinkage int sunos_getsockopt(int fd, int level, int optname,
tr_opt += 30; tr_opt += 30;
} }
ret = compat_sys_getsockopt(fd, level, tr_opt, ret = compat_sys_getsockopt(fd, level, tr_opt,
(void __user *)(unsigned long) optval, optval, optlen);
(void __user *)(unsigned long) optlen);
return ret; return ret;
} }
...@@ -19,62 +19,62 @@ ...@@ -19,62 +19,62 @@
.globl sys_call_table32 .globl sys_call_table32
sys_call_table32: sys_call_table32:
/*0*/ .word sys_restart_syscall, sparc_exit, sys_fork, sys_read, sys_write /*0*/ .word sys_restart_syscall, sys32_exit, sys_fork, sys_read, sys_write
/*5*/ .word sparc32_open, sys_close, compat_sys_wait4, sys_creat, sys_link /*5*/ .word sys32_open, sys_close, sys32_wait4, sys32_creat, sys_link
/*10*/ .word sys_unlink, sunos_execv, sys_chdir, sys32_chown16, sys32_mknod /*10*/ .word sys_unlink, sunos_execv, sys_chdir, sys32_chown16, sys32_mknod
/*15*/ .word sys32_chmod, sys32_lchown16, sparc_brk, sys_perfctr, sys32_lseek /*15*/ .word sys_chmod, sys32_lchown16, sparc_brk, sys32_perfctr, sys32_lseek
/*20*/ .word sys_getpid, sys_capget, sys_capset, sys32_setuid16, sys32_getuid16 /*20*/ .word sys_getpid, sys_capget, sys_capset, sys32_setuid16, sys32_getuid16
/*25*/ .word sys_time, sys_ptrace, sys_alarm, sys32_sigaltstack, sys32_pause /*25*/ .word sys_time, sys_ptrace, sys_alarm, sys32_sigaltstack, sys32_pause
/*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys_access, sys_nice /*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys32_access, sys32_nice
.word sys_chown, sys_sync, sys_kill, compat_sys_newstat, sys32_sendfile .word sys_chown, sys_sync, sys32_kill, compat_sys_newstat, sys32_sendfile
/*40*/ .word compat_sys_newlstat, sys_dup, sys_pipe, compat_sys_times, sys_getuid /*40*/ .word compat_sys_newlstat, sys_dup, sys_pipe, compat_sys_times, sys_getuid
.word sys_umount, sys32_setgid16, sys32_getgid16, sys_signal, sys32_geteuid16 .word sys32_umount, sys32_setgid16, sys32_getgid16, sys32_signal, sys32_geteuid16
/*50*/ .word sys32_getegid16, sys_acct, sys_nis_syscall, sys_getgid, compat_sys_ioctl /*50*/ .word sys32_getegid16, sys_acct, sys_nis_syscall, sys_getgid, compat_sys_ioctl
.word sys_reboot, sys32_mmap2, sys_symlink, sys_readlink, sys32_execve .word sys32_reboot, sys32_mmap2, sys_symlink, sys32_readlink, sys32_execve
/*60*/ .word sys_umask, sys_chroot, compat_sys_newfstat, sys_fstat64, sys_getpagesize /*60*/ .word sys32_umask, sys_chroot, compat_sys_newfstat, sys_fstat64, sys_getpagesize
.word sys_msync, sys_vfork, sys32_pread64, sys32_pwrite64, sys_geteuid .word sys32_msync, sys_vfork, sys32_pread64, sys32_pwrite64, sys_geteuid
/*70*/ .word sys_getegid, sys32_mmap, sys_setreuid, sys_munmap, sys_mprotect /*70*/ .word sys_getegid, sys_mmap, sys_setreuid, sys_munmap, sys_mprotect
.word sys_madvise, sys_vhangup, sys32_truncate64, sys_mincore, sys32_getgroups16 .word sys_madvise, sys_vhangup, sys32_truncate64, sys_mincore, sys32_getgroups16
/*80*/ .word sys32_setgroups16, sys_getpgrp, sys_setgroups, compat_sys_setitimer, sys32_ftruncate64 /*80*/ .word sys32_setgroups16, sys_getpgrp, sys32_setgroups, sys32_setitimer, sys32_ftruncate64
.word sys_swapon, compat_sys_getitimer, sys_setuid, sys_sethostname, sys_setgid .word sys32_swapon, sys32_getitimer, sys_setuid, sys32_sethostname, sys_setgid
/*90*/ .word sys_dup2, sys_setfsuid, compat_sys_fcntl, sys32_select, sys_setfsgid /*90*/ .word sys_dup2, sys_setfsuid, compat_sys_fcntl, sys32_select, sys_setfsgid
.word sys_fsync, sys_setpriority32, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall .word sys_fsync, sys32_setpriority, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall
/*100*/ .word sys_getpriority, sys32_rt_sigreturn, sys32_rt_sigaction, sys32_rt_sigprocmask, sys32_rt_sigpending /*100*/ .word sys32_getpriority, sys32_rt_sigreturn, sys32_rt_sigaction, sys32_rt_sigprocmask, sys32_rt_sigpending
.word sys32_rt_sigtimedwait, sys32_rt_sigqueueinfo, sys32_rt_sigsuspend, sys_setresuid, sys_getresuid .word sys32_rt_sigtimedwait, sys32_rt_sigqueueinfo, sys32_rt_sigsuspend, sys_setresuid, sys_getresuid
/*110*/ .word sys_setresgid, sys_getresgid, sys_setregid, sys_nis_syscall, sys_nis_syscall /*110*/ .word sys_setresgid, sys_getresgid, sys_setregid, sys_nis_syscall, sys_nis_syscall
.word sys_getgroups, sys32_gettimeofday, compat_sys_getrusage, sys_nis_syscall, sys_getcwd .word sys32_getgroups, sys32_gettimeofday, sys32_getrusage, sys_nis_syscall, sys_getcwd
/*120*/ .word compat_sys_readv, compat_sys_writev, sys32_settimeofday, sys32_fchown16, sys_fchmod /*120*/ .word compat_sys_readv, compat_sys_writev, sys32_settimeofday, sys32_fchown16, sys_fchmod
.word sys_nis_syscall, sys32_setreuid16, sys32_setregid16, sys_rename, sys_truncate .word sys_nis_syscall, sys32_setreuid16, sys32_setregid16, sys_rename, sys_truncate
/*130*/ .word sys_ftruncate, sys_flock, sys_lstat64, sys_nis_syscall, sys_nis_syscall /*130*/ .word sys_ftruncate, sys_flock, sys_lstat64, sys_nis_syscall, sys_nis_syscall
.word sys_nis_syscall, sys_mkdir, sys_rmdir, sys32_utimes, sys_stat64 .word sys_nis_syscall, sys32_mkdir, sys_rmdir, sys32_utimes, sys_stat64
/*140*/ .word sys32_sendfile64, sys_nis_syscall, sys32_futex, sys_gettid, compat_sys_getrlimit /*140*/ .word sys32_sendfile64, sys_nis_syscall, sys32_futex, sys_gettid, compat_sys_getrlimit
.word compat_sys_setrlimit, sys_pivot_root, sys32_prctl, sys32_pciconfig_read, sys32_pciconfig_write .word compat_sys_setrlimit, sys_pivot_root, sys32_prctl, sys_pciconfig_read, sys_pciconfig_write
/*150*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64 /*150*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64
.word compat_sys_fcntl64, sys_ni_syscall, compat_sys_statfs, compat_sys_fstatfs, sys_oldumount .word compat_sys_fcntl64, sys_ni_syscall, compat_sys_statfs, compat_sys_fstatfs, sys_oldumount
/*160*/ .word compat_sys_sched_setaffinity, compat_sys_sched_getaffinity, sys_getdomainname, sys_setdomainname, sys_nis_syscall /*160*/ .word compat_sys_sched_setaffinity, compat_sys_sched_getaffinity, sys32_getdomainname, sys32_setdomainname, sys_nis_syscall
.word sys_quotactl, sys_set_tid_address, compat_sys_mount, sys_ustat, sys_setxattr .word sys_quotactl, sys_set_tid_address, compat_sys_mount, sys_ustat, sys32_setxattr
/*170*/ .word sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys32_getdents /*170*/ .word sys32_lsetxattr, sys32_fsetxattr, sys_getxattr, sys_lgetxattr, sys32_getdents
.word sys_setsid, sys_fchdir, sys_fgetxattr, sys_listxattr, sys_llistxattr .word sys_setsid, sys_fchdir, sys32_fgetxattr, sys_listxattr, sys_llistxattr
/*180*/ .word sys_flistxattr, sys_removexattr, sys_lremovexattr, compat_sys_sigpending, sys_ni_syscall /*180*/ .word sys32_flistxattr, sys_removexattr, sys_lremovexattr, compat_sys_sigpending, sys_ni_syscall
.word sys_setpgid, sys_fremovexattr, sys_tkill, sys_exit_group, sparc64_newuname .word sys32_setpgid, sys32_fremovexattr, sys32_tkill, sys32_exit_group, sparc64_newuname
/*190*/ .word sys32_init_module, sparc64_personality, sys_remap_file_pages, sys_epoll_create, sys_epoll_ctl /*190*/ .word sys32_init_module, sparc64_personality, sys_remap_file_pages, sys32_epoll_create, sys32_epoll_ctl
.word sys_epoll_wait, sys_nis_syscall, sys_getppid, sys32_sigaction, sys_sgetmask .word sys32_epoll_wait, sys_nis_syscall, sys_getppid, sys32_sigaction, sys_sgetmask
/*200*/ .word sys_ssetmask, sys_sigsuspend, compat_sys_newlstat, sys_uselib, old32_readdir /*200*/ .word sys32_ssetmask, sys_sigsuspend, compat_sys_newlstat, sys_uselib, old32_readdir
.word sys32_readahead, sys32_socketcall, sys_syslog, sys32_lookup_dcookie, sys32_fadvise64 .word sys32_readahead, sys32_socketcall, sys32_syslog, sys32_lookup_dcookie, sys32_fadvise64
/*210*/ .word sys32_fadvise64_64, sys_tgkill, sys_waitpid, sys_swapoff, sys32_sysinfo /*210*/ .word sys32_fadvise64_64, sys32_tgkill, sys32_waitpid, sys_swapoff, sys32_sysinfo
.word sys32_ipc, sys32_sigreturn, sys_clone, sys_nis_syscall, sys32_adjtimex .word sys32_ipc, sys32_sigreturn, sys_clone, sys_nis_syscall, sys32_adjtimex
/*220*/ .word compat_sys_sigprocmask, sys_ni_syscall, sys32_delete_module, sys_ni_syscall, sys_getpgid /*220*/ .word sys32_sigprocmask, sys_ni_syscall, sys32_delete_module, sys_ni_syscall, sys32_getpgid
.word sys32_bdflush, sys32_sysfs, sys_nis_syscall, sys32_setfsuid16, sys32_setfsgid16 .word sys32_bdflush, sys32_sysfs, sys_nis_syscall, sys32_setfsuid16, sys32_setfsgid16
/*230*/ .word sys32_select, sys_time, sys_nis_syscall, sys_stime, compat_statfs64 /*230*/ .word sys32_select, sys_time, sys_nis_syscall, sys_stime, compat_statfs64
.word compat_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys_mlockall .word compat_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys32_mlockall
/*240*/ .word sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler /*240*/ .word sys_munlockall, sys32_sched_setparam, sys32_sched_getparam, sys32_sched_setscheduler, sys32_sched_getscheduler
.word sys_sched_yield, sys_sched_get_priority_max, sys_sched_get_priority_min, sys32_sched_rr_get_interval, compat_sys_nanosleep .word sys_sched_yield, sys32_sched_get_priority_max, sys32_sched_get_priority_min, sys32_sched_rr_get_interval, compat_sys_nanosleep
/*250*/ .word sys32_mremap, sys32_sysctl, sys_getsid, sys_fdatasync, compat_sys_nfsservctl /*250*/ .word sys32_mremap, sys32_sysctl, sys32_getsid, sys_fdatasync, sys32_nfsservctl
.word sys_ni_syscall, compat_clock_settime, compat_clock_gettime, compat_clock_getres, compat_clock_nanosleep .word sys_ni_syscall, sys32_clock_settime, compat_clock_gettime, compat_clock_getres, sys32_clock_nanosleep
/*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, compat_timer_settime, compat_timer_gettime, sys_timer_getoverrun /*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_timer_gettime, sys_timer_getoverrun
.word sys_timer_delete, sys32_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy .word sys_timer_delete, sys32_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy
/*270*/ .word compat_sys_io_submit, sys_io_cancel, compat_sys_io_getevents, compat_sys_mq_open, sys_mq_unlink /*270*/ .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink
.word sys32_mq_timedsend, sys32_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, sys_ni_syscall .word sys_mq_timedsend, sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, sys_ni_syscall
/*280*/ .word sys_ni_syscall, sys_ni_syscall, sys_ni_syscall /*280*/ .word sys_ni_syscall, sys_ni_syscall, sys_ni_syscall
/* Now the 64-bit native Linux syscall table. */ /* Now the 64-bit native Linux syscall table. */
...@@ -148,12 +148,12 @@ sys_call_table: ...@@ -148,12 +148,12 @@ sys_call_table:
.align 4 .align 4
.globl sunos_sys_table .globl sunos_sys_table
sunos_sys_table: sunos_sys_table:
/*0*/ .word sunos_indir, sparc_exit, sys_fork /*0*/ .word sunos_indir, sys32_exit, sys_fork
.word sunos_read, sunos_write, sunos_open .word sunos_read, sunos_write, sunos_open
.word sys_close, sunos_wait4, sys_creat .word sys_close, sunos_wait4, sys_creat
.word sys_link, sys_unlink, sunos_execv .word sys_link, sys_unlink, sunos_execv
.word sys_chdir, sunos_nosys, sys32_mknod .word sys_chdir, sunos_nosys, sys32_mknod
.word sys32_chmod, sys32_lchown16, sunos_brk .word sys_chmod, sys32_lchown16, sunos_brk
.word sunos_nosys, sys32_lseek, sunos_getpid .word sunos_nosys, sys32_lseek, sunos_getpid
.word sunos_nosys, sunos_nosys, sunos_nosys .word sunos_nosys, sunos_nosys, sunos_nosys
.word sunos_getuid, sunos_nosys, sys_ptrace .word sunos_getuid, sunos_nosys, sys_ptrace
...@@ -180,26 +180,26 @@ sunos_sys_table: ...@@ -180,26 +180,26 @@ sunos_sys_table:
.word compat_sys_getitimer, sys_gethostname, sys_sethostname .word compat_sys_getitimer, sys_gethostname, sys_sethostname
.word sunos_getdtablesize, sys_dup2, sunos_nop .word sunos_getdtablesize, sys_dup2, sunos_nop
.word compat_sys_fcntl, sunos_select, sunos_nop .word compat_sys_fcntl, sunos_select, sunos_nop
.word sys_fsync, sys_setpriority32, sys_socket .word sys_fsync, sys32_setpriority, sys32_socket
.word sys_connect, sunos_accept .word sys32_connect, sunos_accept
/*100*/ .word sys_getpriority, sunos_send, sunos_recv /*100*/ .word sys_getpriority, sunos_send, sunos_recv
.word sunos_nosys, sys_bind, sunos_setsockopt .word sunos_nosys, sys32_bind, sunos_setsockopt
.word sys_listen, sunos_nosys, sunos_sigaction .word sys32_listen, sunos_nosys, sunos_sigaction
.word sunos_sigblock, sunos_sigsetmask, sys_sigpause .word sunos_sigblock, sunos_sigsetmask, sys_sigpause
.word sys32_sigstack, compat_sys_recvmsg, compat_sys_sendmsg .word sys32_sigstack, sys32_recvmsg, sys32_sendmsg
.word sunos_nosys, sys32_gettimeofday, compat_sys_getrusage .word sunos_nosys, sys32_gettimeofday, compat_sys_getrusage
.word sunos_getsockopt, sunos_nosys, sunos_readv .word sunos_getsockopt, sunos_nosys, sunos_readv
.word sunos_writev, sys32_settimeofday, sys32_fchown16 .word sunos_writev, sys32_settimeofday, sys32_fchown16
.word sys_fchmod, sys32_recvfrom, sys32_setreuid16 .word sys_fchmod, sys32_recvfrom, sys32_setreuid16
.word sys32_setregid16, sys_rename, sys_truncate .word sys32_setregid16, sys_rename, sys_truncate
.word sys_ftruncate, sys_flock, sunos_nosys .word sys_ftruncate, sys_flock, sunos_nosys
.word sys32_sendto, sys_shutdown, sys_socketpair .word sys32_sendto, sys32_shutdown, sys32_socketpair
.word sys_mkdir, sys_rmdir, sys32_utimes .word sys_mkdir, sys_rmdir, sys32_utimes
.word sys32_sigreturn, sunos_nosys, sys_getpeername .word sys32_sigreturn, sunos_nosys, sys32_getpeername
.word sunos_gethostid, sunos_nosys, compat_sys_getrlimit .word sunos_gethostid, sunos_nosys, compat_sys_getrlimit
.word compat_sys_setrlimit, sunos_killpg, sunos_nosys .word compat_sys_setrlimit, sunos_killpg, sunos_nosys
.word sunos_nosys, sunos_nosys .word sunos_nosys, sunos_nosys
/*150*/ .word sys_getsockname, sunos_nosys, sunos_nosys /*150*/ .word sys32_getsockname, sunos_nosys, sunos_nosys
.word sys_poll, sunos_nosys, sunos_nosys .word sys_poll, sunos_nosys, sunos_nosys
.word sunos_getdirentries, compat_sys_statfs, compat_sys_fstatfs .word sunos_getdirentries, compat_sys_statfs, compat_sys_fstatfs
.word sys_oldumount, sunos_nosys, sunos_nosys .word sys_oldumount, sunos_nosys, sunos_nosys
......
...@@ -744,9 +744,9 @@ extern int copy_mount_options (const void __user *, unsigned long *); ...@@ -744,9 +744,9 @@ extern int copy_mount_options (const void __user *, unsigned long *);
#define SMBFS_NAME "smbfs" #define SMBFS_NAME "smbfs"
#define NCPFS_NAME "ncpfs" #define NCPFS_NAME "ncpfs"
asmlinkage int compat_sys_mount(char __user * dev_name, char __user * dir_name, asmlinkage long compat_sys_mount(char __user * dev_name, char __user * dir_name,
char __user * type, unsigned long flags, char __user * type, unsigned long flags,
void __user * data) void __user * data)
{ {
unsigned long type_page; unsigned long type_page;
unsigned long data_page; unsigned long data_page;
......
...@@ -398,8 +398,8 @@ asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid, ...@@ -398,8 +398,8 @@ asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid,
return ret; return ret;
} }
asmlinkage int compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len, asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len,
compat_ulong_t __user *user_mask_ptr) compat_ulong_t __user *user_mask_ptr)
{ {
unsigned long kernel_mask; unsigned long kernel_mask;
mm_segment_t old_fs; mm_segment_t old_fs;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment