Commit 32360cdf authored by David S. Miller's avatar David S. Miller

[SPARC]: First stage of sparc32 sparse work.

parent 5cea1125
...@@ -84,47 +84,44 @@ static int apc_release(struct inode *inode, struct file *f) ...@@ -84,47 +84,44 @@ static int apc_release(struct inode *inode, struct file *f)
} }
static int apc_ioctl(struct inode *inode, struct file *f, static int apc_ioctl(struct inode *inode, struct file *f,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long __arg)
{ {
__u8 inarg; __u8 inarg, __user *arg;
arg = (__u8 __user *) __arg;
switch (cmd) { switch (cmd) {
case APCIOCGFANCTL: case APCIOCGFANCTL:
if(put_user(apc_readb(APC_FANCTL_REG) & APC_REGMASK, (__u8*) arg)) { if (put_user(apc_readb(APC_FANCTL_REG) & APC_REGMASK, arg))
return -EFAULT; return -EFAULT;
} break;
break;
case APCIOCGCPWR: case APCIOCGCPWR:
if(put_user(apc_readb(APC_CPOWER_REG) & APC_REGMASK, (__u8*) arg)) { if (put_user(apc_readb(APC_CPOWER_REG) & APC_REGMASK, arg))
return -EFAULT; return -EFAULT;
} break;
break;
case APCIOCGBPORT: case APCIOCGBPORT:
if(put_user(apc_readb(APC_BPORT_REG) & APC_BPMASK, (__u8*) arg)) { if (put_user(apc_readb(APC_BPORT_REG) & APC_BPMASK, arg))
return -EFAULT; return -EFAULT;
} break;
break;
case APCIOCSFANCTL:
case APCIOCSFANCTL: if (get_user(inarg, arg))
if(get_user(inarg, (__u8*) arg)) { return -EFAULT;
return -EFAULT; apc_writeb(inarg & APC_REGMASK, APC_FANCTL_REG);
} break;
apc_writeb(inarg & APC_REGMASK, APC_FANCTL_REG); case APCIOCSCPWR:
break; if (get_user(inarg, arg))
case APCIOCSCPWR: return -EFAULT;
if(get_user(inarg, (__u8*) arg)) { apc_writeb(inarg & APC_REGMASK, APC_CPOWER_REG);
return -EFAULT; break;
} case APCIOCSBPORT:
apc_writeb(inarg & APC_REGMASK, APC_CPOWER_REG); if (get_user(inarg, arg))
break; return -EFAULT;
case APCIOCSBPORT: apc_writeb(inarg & APC_BPMASK, APC_BPORT_REG);
if(get_user(inarg, (__u8*) arg)) { break;
return -EFAULT; default:
} return -EINVAL;
apc_writeb(inarg & APC_BPMASK, APC_BPORT_REG);
break;
default:
return -EINVAL;
}; };
return 0; return 0;
......
...@@ -238,7 +238,7 @@ void __init fill_ebus_device(int node, struct linux_ebus_device *dev) ...@@ -238,7 +238,7 @@ void __init fill_ebus_device(int node, struct linux_ebus_device *dev)
child->bus = dev->bus; child->bus = dev->bus;
fill_ebus_child(node, &regs[0], child); fill_ebus_child(node, &regs[0], child);
while ((node = prom_getsibling(node))) { while ((node = prom_getsibling(node)) != 0) {
child->next = (struct linux_ebus_child *) child->next = (struct linux_ebus_child *)
ebus_alloc(sizeof(struct linux_ebus_child)); ebus_alloc(sizeof(struct linux_ebus_child));
...@@ -330,7 +330,7 @@ void __init ebus_init(void) ...@@ -330,7 +330,7 @@ void __init ebus_init(void)
dev->bus = ebus; dev->bus = ebus;
fill_ebus_device(nd, dev); fill_ebus_device(nd, dev);
while ((nd = prom_getsibling(nd))) { while ((nd = prom_getsibling(nd)) != 0) {
dev->next = (struct linux_ebus_device *) dev->next = (struct linux_ebus_device *)
ebus_alloc(sizeof(struct linux_ebus_device)); ebus_alloc(sizeof(struct linux_ebus_device));
......
...@@ -216,7 +216,8 @@ void free_irq(unsigned int irq, void *dev_id) ...@@ -216,7 +216,8 @@ void free_irq(unsigned int irq, void *dev_id)
if (sparc_cpu_model == sun4d) { if (sparc_cpu_model == sun4d) {
extern void sun4d_free_irq(unsigned int, void *); extern void sun4d_free_irq(unsigned int, void *);
return sun4d_free_irq(irq, dev_id); sun4d_free_irq(irq, dev_id);
return;
} }
cpu_irq = irq & (NR_IRQS - 1); cpu_irq = irq & (NR_IRQS - 1);
if (cpu_irq > 14) { /* 14 irq levels on the sparc */ if (cpu_irq > 14) { /* 14 irq levels on the sparc */
......
...@@ -54,25 +54,25 @@ static inline void maybe_flush_windows(unsigned int rs1, unsigned int rs2, ...@@ -54,25 +54,25 @@ static inline void maybe_flush_windows(unsigned int rs1, unsigned int rs2,
} }
} }
#define fetch_reg(reg, regs) ({ \ #define fetch_reg(reg, regs) ({ \
struct reg_window *win; \ struct reg_window __user *win; \
register unsigned long ret; \ register unsigned long ret; \
\ \
if (!(reg)) ret = 0; \ if (!(reg)) ret = 0; \
else if((reg) < 16) { \ else if ((reg) < 16) { \
ret = regs->u_regs[(reg)]; \ ret = regs->u_regs[(reg)]; \
} else { \ } else { \
/* Ho hum, the slightly complicated case. */ \ /* Ho hum, the slightly complicated case. */ \
win = (struct reg_window *)regs->u_regs[UREG_FP]; \ win = (struct reg_window __user *)regs->u_regs[UREG_FP];\
if (get_user (ret, &win->locals[(reg) - 16])) return -1; \ if (get_user (ret, &win->locals[(reg) - 16])) return -1;\
} \ } \
ret; \ ret; \
}) })
static inline int static inline int
store_reg(unsigned int result, unsigned int reg, struct pt_regs *regs) store_reg(unsigned int result, unsigned int reg, struct pt_regs *regs)
{ {
struct reg_window *win; struct reg_window __user *win;
if (!reg) if (!reg)
return 0; return 0;
...@@ -81,7 +81,7 @@ store_reg(unsigned int result, unsigned int reg, struct pt_regs *regs) ...@@ -81,7 +81,7 @@ store_reg(unsigned int result, unsigned int reg, struct pt_regs *regs)
return 0; return 0;
} else { } else {
/* need to use put_user() in this case: */ /* need to use put_user() in this case: */
win = (struct reg_window *)regs->u_regs[UREG_FP]; win = (struct reg_window __user *) regs->u_regs[UREG_FP];
return (put_user(result, &win->locals[reg - 16])); return (put_user(result, &win->locals[reg - 16]));
} }
} }
...@@ -89,23 +89,30 @@ store_reg(unsigned int result, unsigned int reg, struct pt_regs *regs) ...@@ -89,23 +89,30 @@ store_reg(unsigned int result, unsigned int reg, struct pt_regs *regs)
extern void handle_hw_divzero (struct pt_regs *regs, unsigned long pc, extern void handle_hw_divzero (struct pt_regs *regs, unsigned long pc,
unsigned long npc, unsigned long psr); unsigned long npc, unsigned long psr);
/* Should return 0 if mul/div emulation succeeded and SIGILL should not be issued */ /* Should return 0 if mul/div emulation succeeded and SIGILL should
* not be issued.
*/
int do_user_muldiv(struct pt_regs *regs, unsigned long pc) int do_user_muldiv(struct pt_regs *regs, unsigned long pc)
{ {
unsigned int insn; unsigned int insn;
int inst; int inst;
unsigned int rs1, rs2, rdv; unsigned int rs1, rs2, rdv;
if (!pc) return -1; /* This happens to often, I think */ if (!pc)
if (get_user (insn, (unsigned int *)pc)) return -1; return -1; /* This happens to often, I think */
if ((insn & 0xc1400000) != 0x80400000) return -1; if (get_user (insn, (unsigned int __user *)pc))
return -1;
if ((insn & 0xc1400000) != 0x80400000)
return -1;
inst = ((insn >> 19) & 0xf); inst = ((insn >> 19) & 0xf);
if ((inst & 0xe) != 10 && (inst & 0xe) != 14) return -1; if ((inst & 0xe) != 10 && (inst & 0xe) != 14)
return -1;
/* Now we know we have to do something with umul, smul, udiv or sdiv */ /* Now we know we have to do something with umul, smul, udiv or sdiv */
rs1 = (insn >> 14) & 0x1f; rs1 = (insn >> 14) & 0x1f;
rs2 = insn & 0x1f; rs2 = insn & 0x1f;
rdv = (insn >> 25) & 0x1f; rdv = (insn >> 25) & 0x1f;
if(has_imm13(insn)) { if (has_imm13(insn)) {
maybe_flush_windows(rs1, 0, rdv); maybe_flush_windows(rs1, 0, rdv);
rs2 = sign_extend_imm13(insn); rs2 = sign_extend_imm13(insn);
} else { } else {
......
...@@ -400,23 +400,30 @@ void flush_thread(void) ...@@ -400,23 +400,30 @@ void flush_thread(void)
} }
} }
static __inline__ struct sparc_stackf * static __inline__ struct sparc_stackf __user *
clone_stackframe(struct sparc_stackf *dst, struct sparc_stackf *src) clone_stackframe(struct sparc_stackf __user *dst,
struct sparc_stackf __user *src)
{ {
unsigned long size; unsigned long size, fp;
struct sparc_stackf *sp; struct sparc_stackf *tmp;
struct sparc_stackf __user *sp;
if (get_user(tmp, &src->fp))
return NULL;
size = ((unsigned long)src->fp) - ((unsigned long)src); fp = (unsigned long) tmp;
sp = (struct sparc_stackf *)(((unsigned long)dst) - size); size = (fp - ((unsigned long) src));
fp = (unsigned long) dst;
sp = (struct sparc_stackf __user *)(fp - size);
/* do_fork() grabs the parent semaphore, we must release it /* do_fork() grabs the parent semaphore, we must release it
* temporarily so we can build the child clone stack frame * temporarily so we can build the child clone stack frame
* without deadlocking. * without deadlocking.
*/ */
if (copy_to_user(sp, src, size)) if (__copy_user(sp, src, size))
sp = (struct sparc_stackf *) 0; sp = NULL;
else if (put_user(dst, &sp->fp)) else if (put_user(fp, &sp->fp))
sp = (struct sparc_stackf *) 0; sp = NULL;
return sp; return sp;
} }
...@@ -435,8 +442,8 @@ asmlinkage int sparc_do_fork(unsigned long clone_flags, ...@@ -435,8 +442,8 @@ asmlinkage int sparc_do_fork(unsigned long clone_flags,
return do_fork(clone_flags, stack_start, return do_fork(clone_flags, stack_start,
regs, stack_size, regs, stack_size,
(int *) parent_tid_ptr, (int __user *) parent_tid_ptr,
(int *) 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
...@@ -519,15 +526,17 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, ...@@ -519,15 +526,17 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
p->thread.current_ds = USER_DS; p->thread.current_ds = USER_DS;
if (sp != regs->u_regs[UREG_FP]) { if (sp != regs->u_regs[UREG_FP]) {
struct sparc_stackf *childstack; struct sparc_stackf __user *childstack;
struct sparc_stackf *parentstack; struct sparc_stackf __user *parentstack;
/* /*
* This is a clone() call with supplied user stack. * This is a clone() call with supplied user stack.
* Set some valid stack frames to give to the child. * Set some valid stack frames to give to the child.
*/ */
childstack = (struct sparc_stackf *) (sp & ~0x7UL); childstack = (struct sparc_stackf __user *)
parentstack = (struct sparc_stackf *) regs->u_regs[UREG_FP]; (sp & ~0x7UL);
parentstack = (struct sparc_stackf __user *)
regs->u_regs[UREG_FP];
#if 0 #if 0
printk("clone: parent stack:\n"); printk("clone: parent stack:\n");
...@@ -654,12 +663,14 @@ asmlinkage int sparc_execve(struct pt_regs *regs) ...@@ -654,12 +663,14 @@ asmlinkage int sparc_execve(struct pt_regs *regs)
if(regs->u_regs[UREG_G1] == 0) if(regs->u_regs[UREG_G1] == 0)
base = 1; base = 1;
filename = getname((char *)regs->u_regs[base + UREG_I0]); filename = getname((char __user *)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 = do_execve(filename, (char **) regs->u_regs[base + UREG_I1], error = do_execve(filename,
(char **) regs->u_regs[base + UREG_I2], regs); (char __user * __user *)regs->u_regs[base + UREG_I1],
(char __user * __user *)regs->u_regs[base + UREG_I2],
regs);
putname(filename); putname(filename);
if (error == 0) if (error == 0)
current->ptrace &= ~PT_DTRACE; current->ptrace &= ~PT_DTRACE;
...@@ -679,25 +690,25 @@ pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) ...@@ -679,25 +690,25 @@ pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
{ {
long retval; long retval;
__asm__ __volatile("mov %4, %%g2\n\t" /* Set aside fn ptr... */ __asm__ __volatile__("mov %4, %%g2\n\t" /* Set aside fn ptr... */
"mov %5, %%g3\n\t" /* and arg. */ "mov %5, %%g3\n\t" /* and arg. */
"mov %1, %%g1\n\t" "mov %1, %%g1\n\t"
"mov %2, %%o0\n\t" /* Clone flags. */ "mov %2, %%o0\n\t" /* Clone flags. */
"mov 0, %%o1\n\t" /* usp arg == 0 */ "mov 0, %%o1\n\t" /* usp arg == 0 */
"t 0x10\n\t" /* Linux/Sparc clone(). */ "t 0x10\n\t" /* Linux/Sparc clone(). */
"cmp %%o1, 0\n\t" "cmp %%o1, 0\n\t"
"be 1f\n\t" /* The parent, just return. */ "be 1f\n\t" /* The parent, just return. */
" nop\n\t" /* Delay slot. */ " nop\n\t" /* Delay slot. */
"jmpl %%g2, %%o7\n\t" /* Call the function. */ "jmpl %%g2, %%o7\n\t" /* Call the function. */
" mov %%g3, %%o0\n\t" /* Get back the arg in delay. */ " mov %%g3, %%o0\n\t" /* Get back the arg in delay. */
"mov %3, %%g1\n\t" "mov %3, %%g1\n\t"
"t 0x10\n\t" /* Linux/Sparc exit(). */ "t 0x10\n\t" /* Linux/Sparc exit(). */
/* Notreached by child. */ /* Notreached by child. */
"1: mov %%o0, %0\n\t" : "1: mov %%o0, %0\n\t" :
"=r" (retval) : "=r" (retval) :
"i" (__NR_clone), "r" (flags | CLONE_VM | CLONE_UNTRACED), "i" (__NR_clone), "r" (flags | CLONE_VM | CLONE_UNTRACED),
"i" (__NR_exit), "r" (fn), "r" (arg) : "i" (__NR_exit), "r" (fn), "r" (arg) :
"g1", "g2", "g3", "o0", "o1", "memory", "cc"); "g1", "g2", "g3", "o0", "o1", "memory", "cc");
return retval; return retval;
} }
......
...@@ -50,8 +50,10 @@ static inline void pt_succ_return(struct pt_regs *regs, unsigned long value) ...@@ -50,8 +50,10 @@ static inline void pt_succ_return(struct pt_regs *regs, unsigned long value)
static void static void
pt_succ_return_linux(struct pt_regs *regs, unsigned long value, long *addr) pt_succ_return_linux(struct pt_regs *regs, unsigned long value, long *addr)
{ {
if(put_user(value, addr)) if (put_user(value, (long __user *) addr)) {
return pt_error_return(regs, EFAULT); pt_error_return(regs, EFAULT);
return;
}
regs->u_regs[UREG_I0] = 0; regs->u_regs[UREG_I0] = 0;
regs->psr &= ~PSR_C; regs->psr &= ~PSR_C;
regs->pc = regs->npc; regs->pc = regs->npc;
...@@ -368,7 +370,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs) ...@@ -368,7 +370,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
} }
case PTRACE_GETREGS: { case PTRACE_GETREGS: {
struct pt_regs *pregs = (struct pt_regs *) addr; struct pt_regs __user *pregs = (struct pt_regs __user *) addr;
struct pt_regs *cregs = child->thread.kregs; struct pt_regs *cregs = child->thread.kregs;
int rval; int rval;
...@@ -391,7 +393,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs) ...@@ -391,7 +393,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
} }
case PTRACE_SETREGS: { case PTRACE_SETREGS: {
struct pt_regs *pregs = (struct pt_regs *) addr; struct pt_regs __user *pregs = (struct pt_regs __user *) addr;
struct pt_regs *cregs = child->thread.kregs; struct pt_regs *cregs = child->thread.kregs;
unsigned long psr, pc, npc, y; unsigned long psr, pc, npc, y;
int i; int i;
...@@ -433,7 +435,8 @@ asmlinkage void do_ptrace(struct pt_regs *regs) ...@@ -433,7 +435,8 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
unsigned long *insnaddr; unsigned long *insnaddr;
unsigned long insn; unsigned long insn;
} fpq[16]; } fpq[16];
} *fps = (struct fps *) addr; };
struct fps __user *fps = (struct fps __user *) addr;
int i; int i;
i = verify_area(VERIFY_WRITE, fps, sizeof(struct fps)); i = verify_area(VERIFY_WRITE, fps, sizeof(struct fps));
...@@ -467,7 +470,8 @@ asmlinkage void do_ptrace(struct pt_regs *regs) ...@@ -467,7 +470,8 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
unsigned long *insnaddr; unsigned long *insnaddr;
unsigned long insn; unsigned long insn;
} fpq[16]; } fpq[16];
} *fps = (struct fps *) addr; };
struct fps __user *fps = (struct fps __user *) addr;
int i; int i;
i = verify_area(VERIFY_READ, fps, sizeof(struct fps)); i = verify_area(VERIFY_READ, fps, sizeof(struct fps));
...@@ -489,7 +493,8 @@ asmlinkage void do_ptrace(struct pt_regs *regs) ...@@ -489,7 +493,8 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
case PTRACE_READTEXT: case PTRACE_READTEXT:
case PTRACE_READDATA: { case PTRACE_READDATA: {
int res = ptrace_readdata(child, addr, (void *) addr2, data); int res = ptrace_readdata(child, addr,
(void __user *) addr2, data);
if (res == data) { if (res == data) {
pt_succ_return(regs, 0); pt_succ_return(regs, 0);
...@@ -504,7 +509,8 @@ asmlinkage void do_ptrace(struct pt_regs *regs) ...@@ -504,7 +509,8 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
case PTRACE_WRITETEXT: case PTRACE_WRITETEXT:
case PTRACE_WRITEDATA: { case PTRACE_WRITEDATA: {
int res = ptrace_writedata(child, (void *) addr2, addr, data); int res = ptrace_writedata(child, (void __user *) addr2,
addr, data);
if (res == data) { if (res == data) {
pt_succ_return(regs, 0); pt_succ_return(regs, 0);
......
...@@ -234,7 +234,7 @@ static inline void do_new_sigreturn (struct pt_regs *regs) ...@@ -234,7 +234,7 @@ static inline void do_new_sigreturn (struct pt_regs *regs)
if (verify_area(VERIFY_READ, sf, sizeof(*sf))) if (verify_area(VERIFY_READ, sf, sizeof(*sf)))
goto segv_and_exit; goto segv_and_exit;
if (((uint) sf) & 3) if (((unsigned long) sf) & 3)
goto segv_and_exit; goto segv_and_exit;
err = __get_user(pc, &sf->info.si_regs.pc); err = __get_user(pc, &sf->info.si_regs.pc);
...@@ -289,8 +289,10 @@ asmlinkage void do_sigreturn(struct pt_regs *regs) ...@@ -289,8 +289,10 @@ asmlinkage void do_sigreturn(struct pt_regs *regs)
synchronize_user_stack(); synchronize_user_stack();
if (current->thread.new_signal) if (current->thread.new_signal) {
return do_new_sigreturn(regs); do_new_sigreturn(regs);
return;
}
scptr = (struct sigcontext __user *) regs->u_regs[UREG_I0]; scptr = (struct sigcontext __user *) regs->u_regs[UREG_I0];
...@@ -347,6 +349,7 @@ asmlinkage void do_rt_sigreturn(struct pt_regs *regs) ...@@ -347,6 +349,7 @@ asmlinkage void do_rt_sigreturn(struct pt_regs *regs)
struct rt_signal_frame __user *sf; struct rt_signal_frame __user *sf;
unsigned int psr, pc, npc; unsigned int psr, pc, npc;
__siginfo_fpu_t __user *fpu_save; __siginfo_fpu_t __user *fpu_save;
mm_segment_t old_fs;
sigset_t set; sigset_t set;
stack_t st; stack_t st;
int err; int err;
...@@ -386,7 +389,10 @@ asmlinkage void do_rt_sigreturn(struct pt_regs *regs) ...@@ -386,7 +389,10 @@ asmlinkage void do_rt_sigreturn(struct pt_regs *regs)
/* It is more difficult to avoid calling this function than to /* It is more difficult to avoid calling this function than to
* call it and ignore errors. * call it and ignore errors.
*/ */
do_sigaltstack(&st, NULL, (unsigned long)sf); old_fs = get_fs();
set_fs(KERNEL_DS);
do_sigaltstack((const stack_t __user *) &st, NULL, (unsigned long)sf);
set_fs(old_fs);
sigdelsetmask(&set, ~_BLOCKABLE); sigdelsetmask(&set, ~_BLOCKABLE);
spin_lock_irq(&current->sighand->siglock); spin_lock_irq(&current->sighand->siglock);
...@@ -849,7 +855,7 @@ setup_svr4_frame(struct sigaction *sa, unsigned long pc, unsigned long npc, ...@@ -849,7 +855,7 @@ setup_svr4_frame(struct sigaction *sa, unsigned long pc, unsigned long npc,
/* Arguments passed to signal handler */ /* Arguments passed to signal handler */
if (regs->u_regs[14]){ if (regs->u_regs[14]){
struct reg_window *rw = (struct reg_window __user *) struct reg_window __user *rw = (struct reg_window __user *)
regs->u_regs[14]; regs->u_regs[14];
err |= __put_user(signr, &rw->ins[0]); err |= __put_user(signr, &rw->ins[0]);
...@@ -860,8 +866,8 @@ setup_svr4_frame(struct sigaction *sa, unsigned long pc, unsigned long npc, ...@@ -860,8 +866,8 @@ setup_svr4_frame(struct sigaction *sa, unsigned long pc, unsigned long npc,
goto sigsegv; goto sigsegv;
regs->u_regs[UREG_I0] = signr; regs->u_regs[UREG_I0] = signr;
regs->u_regs[UREG_I1] = (uint) si; regs->u_regs[UREG_I1] = (unsigned long) si;
regs->u_regs[UREG_I2] = (uint) uc; regs->u_regs[UREG_I2] = (unsigned long) uc;
} }
return; return;
...@@ -932,6 +938,7 @@ asmlinkage int svr4_setcontext(svr4_ucontext_t __user *c, struct pt_regs *regs) ...@@ -932,6 +938,7 @@ asmlinkage int svr4_setcontext(svr4_ucontext_t __user *c, struct pt_regs *regs)
{ {
svr4_gregset_t __user *gr; svr4_gregset_t __user *gr;
unsigned long pc, npc, psr; unsigned long pc, npc, psr;
mm_segment_t old_fs;
sigset_t set; sigset_t set;
svr4_sigset_t setv; svr4_sigset_t setv;
int err; int err;
...@@ -945,7 +952,7 @@ asmlinkage int svr4_setcontext(svr4_ucontext_t __user *c, struct pt_regs *regs) ...@@ -945,7 +952,7 @@ asmlinkage int svr4_setcontext(svr4_ucontext_t __user *c, struct pt_regs *regs)
if (current_thread_info()->w_saved) if (current_thread_info()->w_saved)
goto sigsegv_and_return; goto sigsegv_and_return;
if (((uint) c) & 3) if (((unsigned long) c) & 3)
goto sigsegv_and_return; goto sigsegv_and_return;
if (!__access_ok((unsigned long)c, sizeof(*c))) if (!__access_ok((unsigned long)c, sizeof(*c)))
...@@ -977,7 +984,11 @@ asmlinkage int svr4_setcontext(svr4_ucontext_t __user *c, struct pt_regs *regs) ...@@ -977,7 +984,11 @@ asmlinkage int svr4_setcontext(svr4_ucontext_t __user *c, struct pt_regs *regs)
/* It is more difficult to avoid calling this function than to /* It is more difficult to avoid calling this function than to
call it and ignore errors. */ call it and ignore errors. */
do_sigaltstack(&st, NULL, regs->u_regs[UREG_I6]); old_fs = get_fs();
set_fs(KERNEL_DS);
do_sigaltstack((const stack_t __user *) &st, NULL,
regs->u_regs[UREG_I6]);
set_fs(old_fs);
set.sig[0] = setv.sigbits[0]; set.sig[0] = setv.sigbits[0];
set.sig[1] = setv.sigbits[1]; set.sig[1] = setv.sigbits[1];
......
...@@ -41,18 +41,19 @@ asmlinkage int sunos_ioctl (int fd, unsigned long cmd, unsigned long arg) ...@@ -41,18 +41,19 @@ asmlinkage int sunos_ioctl (int fd, unsigned long cmd, unsigned long arg)
goto out; goto out;
/* First handle an easy compat. case for tty ldisc. */ /* First handle an easy compat. case for tty ldisc. */
if(cmd == TIOCSETD) { if (cmd == TIOCSETD) {
int *p, ntty = N_TTY, tmp; int __user *p;
int ntty = N_TTY, tmp;
mm_segment_t oldfs; mm_segment_t oldfs;
p = (int *) arg; p = (int __user *) arg;
ret = -EFAULT; ret = -EFAULT;
if(get_user(tmp, p)) if (get_user(tmp, p))
goto out; goto out;
if(tmp == 2) { if (tmp == 2) {
oldfs = get_fs(); oldfs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
ret = sys_ioctl(fd, cmd, (int) &ntty); ret = sys_ioctl(fd, cmd, (unsigned long) &ntty);
set_fs(oldfs); set_fs(oldfs);
ret = (ret == -EINVAL ? -EOPNOTSUPP : ret); ret = (ret == -EINVAL ? -EOPNOTSUPP : ret);
goto out; goto out;
...@@ -60,7 +61,7 @@ asmlinkage int sunos_ioctl (int fd, unsigned long cmd, unsigned long arg) ...@@ -60,7 +61,7 @@ asmlinkage int sunos_ioctl (int fd, unsigned long cmd, unsigned long arg)
} }
/* Binary compatibility is good American knowhow fuckin' up. */ /* Binary compatibility is good American knowhow fuckin' up. */
if(cmd == TIOCNOTTY) { if (cmd == TIOCNOTTY) {
ret = sys_setsid(); ret = sys_setsid();
goto out; goto out;
} }
...@@ -176,39 +177,39 @@ asmlinkage int sunos_ioctl (int fd, unsigned long cmd, unsigned long arg) ...@@ -176,39 +177,39 @@ asmlinkage int sunos_ioctl (int fd, unsigned long cmd, unsigned long arg)
goto out; goto out;
/* Non posix grp */ /* Non posix grp */
case _IOW('t', 118, int): { case _IOW('t', 118, int): {
int oldval, newval, *ptr; int oldval, newval, __user *ptr;
cmd = TIOCSPGRP; cmd = TIOCSPGRP;
ptr = (int *) arg; ptr = (int __user *) arg;
ret = -EFAULT; ret = -EFAULT;
if(get_user(oldval, ptr)) if (get_user(oldval, ptr))
goto out; goto out;
ret = sys_ioctl(fd, cmd, arg); ret = sys_ioctl(fd, cmd, arg);
__get_user(newval, ptr); __get_user(newval, ptr);
if(newval == -1) { if (newval == -1) {
__put_user(oldval, ptr); __put_user(oldval, ptr);
ret = -EIO; ret = -EIO;
} }
if(ret == -ENOTTY) if (ret == -ENOTTY)
ret = -EIO; ret = -EIO;
goto out; goto out;
} }
case _IOR('t', 119, int): { case _IOR('t', 119, int): {
int oldval, newval, *ptr; int oldval, newval, __user *ptr;
cmd = TIOCGPGRP; cmd = TIOCGPGRP;
ptr = (int *) arg; ptr = (int __user *) arg;
ret = -EFAULT; ret = -EFAULT;
if(get_user(oldval, ptr)) if (get_user(oldval, ptr))
goto out; goto out;
ret = sys_ioctl(fd, cmd, arg); ret = sys_ioctl(fd, cmd, arg);
__get_user(newval, ptr); __get_user(newval, ptr);
if(newval == -1) { if (newval == -1) {
__put_user(oldval, ptr); __put_user(oldval, ptr);
ret = -EIO; ret = -EIO;
} }
if(ret == -ENOTTY) if (ret == -ENOTTY)
ret = -EIO; ret = -EIO;
goto out; goto out;
} }
......
...@@ -136,7 +136,8 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void __user ...@@ -136,7 +136,8 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void __user
if (!ptr) if (!ptr)
goto out; goto out;
err = -EFAULT; err = -EFAULT;
if(get_user(fourth.__pad, (void __user **)ptr)) if (get_user(fourth.__pad,
(void __user * __user *)ptr))
goto out; goto out;
err = sys_semctl (first, second, third, fourth); err = sys_semctl (first, second, third, fourth);
goto out; goto out;
...@@ -165,7 +166,9 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void __user ...@@ -165,7 +166,9 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void __user
goto out; goto out;
} }
case 1: default: case 1: default:
err = sys_msgrcv (first, (struct msgbuf *) ptr, second, fifth, third); err = sys_msgrcv (first,
(struct msgbuf __user *) ptr,
second, fifth, third);
goto out; goto out;
} }
case MSGGET: case MSGGET:
...@@ -194,7 +197,8 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void __user ...@@ -194,7 +197,8 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void __user
goto out; goto out;
} }
case 1: /* iBCS2 emulator entry point */ case 1: /* iBCS2 emulator entry point */
err = do_shmat (first, (char __user *) ptr, second, (ulong __user *) third); err = do_shmat (first, (char __user *) ptr,
second, (ulong *) third);
goto out; goto out;
} }
case SHMDT: case SHMDT:
......
This diff is collapsed.
...@@ -109,14 +109,14 @@ static inline unsigned long fetch_reg(unsigned int reg, struct pt_regs *regs) ...@@ -109,14 +109,14 @@ static inline unsigned long fetch_reg(unsigned int reg, struct pt_regs *regs)
static inline unsigned long safe_fetch_reg(unsigned int reg, struct pt_regs *regs) static inline unsigned long safe_fetch_reg(unsigned int reg, struct pt_regs *regs)
{ {
struct reg_window *win; struct reg_window __user *win;
unsigned long ret; unsigned long ret;
if(reg < 16) if (reg < 16)
return (!reg ? 0 : regs->u_regs[reg]); return (!reg ? 0 : regs->u_regs[reg]);
/* Ho hum, the slightly complicated case. */ /* Ho hum, the slightly complicated case. */
win = (struct reg_window *) regs->u_regs[UREG_FP]; win = (struct reg_window __user *) regs->u_regs[UREG_FP];
if ((unsigned long)win & 3) if ((unsigned long)win & 3)
return -1; return -1;
...@@ -431,29 +431,32 @@ static inline int ok_for_user(struct pt_regs *regs, unsigned int insn, ...@@ -431,29 +431,32 @@ static inline int ok_for_user(struct pt_regs *regs, unsigned int insn,
int retval, check = (dir == load) ? VERIFY_READ : VERIFY_WRITE; int retval, check = (dir == load) ? VERIFY_READ : VERIFY_WRITE;
int size = ((insn >> 19) & 3) == 3 ? 8 : 4; int size = ((insn >> 19) & 3) == 3 ? 8 : 4;
if((regs->pc | regs->npc) & 3) if ((regs->pc | regs->npc) & 3)
return 0; return 0;
/* Must verify_area() in all the necessary places. */ /* Must verify_area() in all the necessary places. */
#define WINREG_ADDR(regnum) ((void *)(((unsigned long *)regs->u_regs[UREG_FP])+(regnum))) #define WINREG_ADDR(regnum) \
((void __user *)(((unsigned long *)regs->u_regs[UREG_FP])+(regnum)))
retval = 0; retval = 0;
reg = (insn >> 25) & 0x1f; reg = (insn >> 25) & 0x1f;
if(reg >= 16) { if (reg >= 16) {
retval = verify_area(check, WINREG_ADDR(reg - 16), size); retval = verify_area(check, WINREG_ADDR(reg - 16), size);
if(retval) if (retval)
return retval; return retval;
} }
reg = (insn >> 14) & 0x1f; reg = (insn >> 14) & 0x1f;
if(reg >= 16) { if (reg >= 16) {
retval = verify_area(check, WINREG_ADDR(reg - 16), size); retval = verify_area(check, WINREG_ADDR(reg - 16), size);
if(retval) if (retval)
return retval; return retval;
} }
if(!(insn & 0x2000)) { if (!(insn & 0x2000)) {
reg = (insn & 0x1f); reg = (insn & 0x1f);
if(reg >= 16) { if (reg >= 16) {
retval = verify_area(check, WINREG_ADDR(reg - 16), size); retval = verify_area(check, WINREG_ADDR(reg - 16),
if(retval) size);
if (retval)
return retval; return retval;
} }
} }
......
...@@ -69,8 +69,8 @@ void synchronize_user_stack(void) ...@@ -69,8 +69,8 @@ void synchronize_user_stack(void)
unsigned long sp = tp->rwbuf_stkptrs[window]; unsigned long sp = tp->rwbuf_stkptrs[window];
/* Ok, let it rip. */ /* Ok, let it rip. */
if(copy_to_user((char *) sp, &tp->reg_window[window], if (copy_to_user((char __user *) sp, &tp->reg_window[window],
sizeof(struct reg_window))) sizeof(struct reg_window)))
continue; continue;
shift_window_buffer(window, tp->w_saved - 1, tp); shift_window_buffer(window, tp->w_saved - 1, tp);
...@@ -117,8 +117,9 @@ void try_to_clear_window_buffer(struct pt_regs *regs, int who) ...@@ -117,8 +117,9 @@ void try_to_clear_window_buffer(struct pt_regs *regs, int who)
for(window = 0; window < tp->w_saved; window++) { for(window = 0; window < tp->w_saved; window++) {
unsigned long sp = tp->rwbuf_stkptrs[window]; unsigned long sp = tp->rwbuf_stkptrs[window];
if((sp & 7) || if ((sp & 7) ||
copy_to_user((char *) sp, &tp->reg_window[window], sizeof(struct reg_window))) copy_to_user((char __user *) sp, &tp->reg_window[window],
sizeof(struct reg_window)))
do_exit(SIGILL); do_exit(SIGILL);
} }
tp->w_saved = 0; tp->w_saved = 0;
......
...@@ -175,7 +175,7 @@ int do_mathemu(struct pt_regs *regs, struct task_struct *fpt) ...@@ -175,7 +175,7 @@ int do_mathemu(struct pt_regs *regs, struct task_struct *fpt)
#ifdef DEBUG_MATHEMU #ifdef DEBUG_MATHEMU
printk("precise trap at %08lx\n", regs->pc); printk("precise trap at %08lx\n", regs->pc);
#endif #endif
if (!get_user(insn, (u32 *)regs->pc)) { if (!get_user(insn, (u32 __user *) regs->pc)) {
retcode = do_one_mathemu(insn, &fpt->thread.fsr, fpt->thread.float_regs); retcode = do_one_mathemu(insn, &fpt->thread.fsr, fpt->thread.float_regs);
if (retcode) { if (retcode) {
/* in this case we need to fix up PC & nPC */ /* in this case we need to fix up PC & nPC */
...@@ -193,7 +193,7 @@ int do_mathemu(struct pt_regs *regs, struct task_struct *fpt) ...@@ -193,7 +193,7 @@ int do_mathemu(struct pt_regs *regs, struct task_struct *fpt)
break; break;
} }
/* Now empty the queue and clear the queue_not_empty flag */ /* Now empty the queue and clear the queue_not_empty flag */
if(retcode) if (retcode)
fpt->thread.fsr &= ~(0x3000 | FSR_CEXC_MASK); fpt->thread.fsr &= ~(0x3000 | FSR_CEXC_MASK);
else else
fpt->thread.fsr &= ~0x3000; fpt->thread.fsr &= ~0x3000;
...@@ -219,18 +219,18 @@ static inline int record_exception(unsigned long *pfsr, int eflag) ...@@ -219,18 +219,18 @@ static inline int record_exception(unsigned long *pfsr, int eflag)
would_trap = (fsr & ((long)eflag << FSR_TEM_SHIFT)) != 0UL; would_trap = (fsr & ((long)eflag << FSR_TEM_SHIFT)) != 0UL;
/* If trapping, we only want to signal one bit. */ /* If trapping, we only want to signal one bit. */
if(would_trap != 0) { if (would_trap != 0) {
eflag &= ((fsr & FSR_TEM_MASK) >> FSR_TEM_SHIFT); eflag &= ((fsr & FSR_TEM_MASK) >> FSR_TEM_SHIFT);
if((eflag & (eflag - 1)) != 0) { if ((eflag & (eflag - 1)) != 0) {
if(eflag & FP_EX_INVALID) if (eflag & FP_EX_INVALID)
eflag = FP_EX_INVALID; eflag = FP_EX_INVALID;
else if(eflag & FP_EX_OVERFLOW) else if (eflag & FP_EX_OVERFLOW)
eflag = FP_EX_OVERFLOW; eflag = FP_EX_OVERFLOW;
else if(eflag & FP_EX_UNDERFLOW) else if (eflag & FP_EX_UNDERFLOW)
eflag = FP_EX_UNDERFLOW; eflag = FP_EX_UNDERFLOW;
else if(eflag & FP_EX_DIVZERO) else if (eflag & FP_EX_DIVZERO)
eflag = FP_EX_DIVZERO; eflag = FP_EX_DIVZERO;
else if(eflag & FP_EX_INEXACT) else if (eflag & FP_EX_INEXACT)
eflag = FP_EX_INEXACT; eflag = FP_EX_INEXACT;
} }
} }
...@@ -250,11 +250,11 @@ static inline int record_exception(unsigned long *pfsr, int eflag) ...@@ -250,11 +250,11 @@ static inline int record_exception(unsigned long *pfsr, int eflag)
* CEXC just generated is OR'd into the * CEXC just generated is OR'd into the
* existing value of AEXC. * existing value of AEXC.
*/ */
if(would_trap == 0) if (would_trap == 0)
fsr |= ((long)eflag << FSR_AEXC_SHIFT); fsr |= ((long)eflag << FSR_AEXC_SHIFT);
/* If trapping, indicate fault trap type IEEE. */ /* If trapping, indicate fault trap type IEEE. */
if(would_trap != 0) if (would_trap != 0)
fsr |= (1UL << 14); fsr |= (1UL << 14);
*pfsr = fsr; *pfsr = fsr;
...@@ -515,7 +515,7 @@ static int do_one_mathemu(u32 insn, unsigned long *pfsr, unsigned long *fregs) ...@@ -515,7 +515,7 @@ static int do_one_mathemu(u32 insn, unsigned long *pfsr, unsigned long *fregs)
case 7: FP_PACK_QP (rd, QR); break; case 7: FP_PACK_QP (rd, QR); break;
} }
} }
if(_fex == 0) if (_fex == 0)
return 1; /* success! */ return 1; /* success! */
return record_exception(pfsr, _fex); return record_exception(pfsr, _fex);
} }
...@@ -412,10 +412,10 @@ asmlinkage void do_sun4c_fault(struct pt_regs *regs, int text_fault, int write, ...@@ -412,10 +412,10 @@ asmlinkage void do_sun4c_fault(struct pt_regs *regs, int text_fault, int write,
address = regs->pc; address = regs->pc;
} else if (!write && } else if (!write &&
!(regs->psr & PSR_PS)) { !(regs->psr & PSR_PS)) {
unsigned int insn, *ip; unsigned int insn, __user *ip;
ip = (unsigned int *)regs->pc; ip = (unsigned int __user *)regs->pc;
if (! get_user(insn, ip)) { if (!get_user(insn, ip)) {
if ((insn & 0xc1680000) == 0xc0680000) if ((insn & 0xc1680000) == 0xc0680000)
write = 1; write = 1;
} }
......
...@@ -56,15 +56,6 @@ typedef struct { ...@@ -56,15 +56,6 @@ typedef struct {
#define SOFTIRQ_OFFSET (1UL << SOFTIRQ_SHIFT) #define SOFTIRQ_OFFSET (1UL << SOFTIRQ_SHIFT)
#define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT) #define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT)
/*
* The hardirq mask has to be large enough to have
* space for potentially all IRQ sources in the system
* nesting on a single CPU:
*/
#if (1 << HARDIRQ_BITS) < NR_IRQS
# error HARDIRQ_BITS is too low!
#endif
/* /*
* Are we doing bottom half or hardware interrupt processing? * Are we doing bottom half or hardware interrupt processing?
* Are we in a softirq context? Interrupt context? * Are we in a softirq context? Interrupt context?
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* See arch/sparc/kernel/sys_sparc.c for ugly details.. * See arch/sparc/kernel/sys_sparc.c for ugly details..
*/ */
struct ipc_kludge { struct ipc_kludge {
struct msgbuf *msgp; struct msgbuf __user *msgp;
long msgtyp; long msgtyp;
}; };
......
...@@ -13,12 +13,12 @@ struct semaphore { ...@@ -13,12 +13,12 @@ struct semaphore {
atomic24_t count; atomic24_t count;
int sleepers; int sleepers;
wait_queue_head_t wait; wait_queue_head_t wait;
#if WAITQUEUE_DEBUG #ifdef WAITQUEUE_DEBUG
long __magic; long __magic;
#endif #endif
}; };
#if WAITQUEUE_DEBUG #ifdef WAITQUEUE_DEBUG
# define __SEM_DEBUG_INIT(name) \ # define __SEM_DEBUG_INIT(name) \
, (long)&(name).__magic , (long)&(name).__magic
#else #else
...@@ -43,7 +43,7 @@ static inline void sema_init (struct semaphore *sem, int val) ...@@ -43,7 +43,7 @@ static inline void sema_init (struct semaphore *sem, int val)
atomic24_set(&sem->count, val); atomic24_set(&sem->count, val);
sem->sleepers = 0; sem->sleepers = 0;
init_waitqueue_head(&sem->wait); init_waitqueue_head(&sem->wait);
#if WAITQUEUE_DEBUG #ifdef WAITQUEUE_DEBUG
sem->__magic = (long)&sem->__magic; sem->__magic = (long)&sem->__magic;
#endif #endif
} }
...@@ -68,7 +68,7 @@ static inline void down(struct semaphore * sem) ...@@ -68,7 +68,7 @@ static inline void down(struct semaphore * sem)
register volatile int *ptr asm("g1"); register volatile int *ptr asm("g1");
register int increment asm("g2"); register int increment asm("g2");
#if WAITQUEUE_DEBUG #ifdef WAITQUEUE_DEBUG
CHECK_MAGIC(sem->__magic); CHECK_MAGIC(sem->__magic);
#endif #endif
might_sleep(); might_sleep();
...@@ -105,7 +105,7 @@ static inline int down_interruptible(struct semaphore * sem) ...@@ -105,7 +105,7 @@ static inline int down_interruptible(struct semaphore * sem)
register volatile int *ptr asm("g1"); register volatile int *ptr asm("g1");
register int increment asm("g2"); register int increment asm("g2");
#if WAITQUEUE_DEBUG #ifdef WAITQUEUE_DEBUG
CHECK_MAGIC(sem->__magic); CHECK_MAGIC(sem->__magic);
#endif #endif
might_sleep(); might_sleep();
...@@ -145,7 +145,7 @@ static inline int down_trylock(struct semaphore * sem) ...@@ -145,7 +145,7 @@ static inline int down_trylock(struct semaphore * sem)
register volatile int *ptr asm("g1"); register volatile int *ptr asm("g1");
register int increment asm("g2"); register int increment asm("g2");
#if WAITQUEUE_DEBUG #ifdef WAITQUEUE_DEBUG
CHECK_MAGIC(sem->__magic); CHECK_MAGIC(sem->__magic);
#endif #endif
...@@ -184,7 +184,7 @@ static inline void up(struct semaphore * sem) ...@@ -184,7 +184,7 @@ static inline void up(struct semaphore * sem)
register volatile int *ptr asm("g1"); register volatile int *ptr asm("g1");
register int increment asm("g2"); register int increment asm("g2");
#if WAITQUEUE_DEBUG #ifdef WAITQUEUE_DEBUG
CHECK_MAGIC(sem->__magic); CHECK_MAGIC(sem->__magic);
#endif #endif
......
...@@ -199,7 +199,7 @@ struct __new_sigaction { ...@@ -199,7 +199,7 @@ struct __new_sigaction {
#ifdef __KERNEL__ #ifdef __KERNEL__
struct k_sigaction { struct k_sigaction {
struct __new_sigaction sa; struct __new_sigaction sa;
void *ka_restorer; void __user *ka_restorer;
}; };
#endif #endif
...@@ -211,7 +211,7 @@ struct __old_sigaction { ...@@ -211,7 +211,7 @@ struct __old_sigaction {
}; };
typedef struct sigaltstack { typedef struct sigaltstack {
void *ss_sp; void __user *ss_sp;
int ss_flags; int ss_flags;
size_t ss_size; size_t ss_size;
} stack_t; } stack_t;
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <asm/btfixup.h> #include <asm/btfixup.h>
#include <asm/ptrace.h> #include <asm/ptrace.h>
#include <asm/page.h>
/* /*
* Low level task data. * Low level task data.
......
...@@ -83,6 +83,10 @@ extern unsigned long search_extables_range(unsigned long addr, unsigned long *g2 ...@@ -83,6 +83,10 @@ extern unsigned long search_extables_range(unsigned long addr, unsigned long *g2
extern void __ret_efault(void); extern void __ret_efault(void);
extern long not_a_user_address;
#define check_user_ptr(x) \
(void) ({ void __user * __userptr = (__typeof__(*(x)) *)&not_a_user_address; __userptr; })
/* Uh, these should become the main single-value transfer routines.. /* Uh, these should become the main single-value transfer routines..
* They automatically use the right size if we just have the right * They automatically use the right size if we just have the right
* pointer type.. * pointer type..
...@@ -94,10 +98,12 @@ extern void __ret_efault(void); ...@@ -94,10 +98,12 @@ extern void __ret_efault(void);
*/ */
#define put_user(x,ptr) ({ \ #define put_user(x,ptr) ({ \
unsigned long __pu_addr = (unsigned long)(ptr); \ unsigned long __pu_addr = (unsigned long)(ptr); \
check_user_ptr(ptr); \
__put_user_check((__typeof__(*(ptr)))(x),__pu_addr,sizeof(*(ptr))); }) __put_user_check((__typeof__(*(ptr)))(x),__pu_addr,sizeof(*(ptr))); })
#define get_user(x,ptr) ({ \ #define get_user(x,ptr) ({ \
unsigned long __gu_addr = (unsigned long)(ptr); \ unsigned long __gu_addr = (unsigned long)(ptr); \
check_user_ptr(ptr); \
__get_user_check((x),__gu_addr,sizeof(*(ptr)),__typeof__(*(ptr))); }) __get_user_check((x),__gu_addr,sizeof(*(ptr)),__typeof__(*(ptr))); })
/* /*
...@@ -292,32 +298,32 @@ __asm__ __volatile__( \ ...@@ -292,32 +298,32 @@ __asm__ __volatile__( \
extern int __get_user_bad(void); extern int __get_user_bad(void);
extern unsigned long __copy_user(void *to, const void *from, unsigned long size); extern unsigned long __copy_user(void __user *to, const void __user *from, unsigned long size);
static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n) static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n)
{ {
if (n && __access_ok((unsigned long) to, n)) if (n && __access_ok((unsigned long) to, n))
return __copy_user((void *) to, from, n); return __copy_user(to, (void __user *) from, n);
else else
return n; return n;
} }
static inline unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n) static inline unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n)
{ {
return __copy_user((void *)to, from, n); return __copy_user(to, (void __user *) from, n);
} }
static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n) static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n)
{ {
if (n && __access_ok((unsigned long) from, n)) if (n && __access_ok((unsigned long) from, n))
return __copy_user(to, (void *) from, n); return __copy_user((void __user *) to, from, n);
else else
return n; return n;
} }
static inline unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n) static inline unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n)
{ {
return __copy_user(to, (void *)from, n); return __copy_user((void __user *) to, from, n);
} }
static inline unsigned long __clear_user(void __user *addr, unsigned long size) static inline unsigned long __clear_user(void __user *addr, unsigned long size)
......
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