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;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -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