aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2008-09-04 05:53:58 -0400
committerPaul Mundt <lethal@linux-sh.org>2008-09-07 21:35:04 -0400
commitfa43972fab24a3c050e880a7831f9378c6cebc0b (patch)
tree35d51e6a0ac6556f82d843506e8317854dc3192c /arch/sh/kernel
parent7d96169cb769f459dd6730b06fa3a88cb0c9297d (diff)
sh: fixup many sparse errors.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel')
-rw-r--r--arch/sh/kernel/cpu/clock.c5
-rw-r--r--arch/sh/kernel/io_generic.c6
-rw-r--r--arch/sh/kernel/machvec.c1
-rw-r--r--arch/sh/kernel/process_32.c1
-rw-r--r--arch/sh/kernel/process_64.c1
-rw-r--r--arch/sh/kernel/ptrace_32.c6
-rw-r--r--arch/sh/kernel/ptrace_64.c1
-rw-r--r--arch/sh/kernel/setup.c1
-rw-r--r--arch/sh/kernel/signal_32.c10
-rw-r--r--arch/sh/kernel/sys_sh.c7
-rw-r--r--arch/sh/kernel/sys_sh32.c5
-rw-r--r--arch/sh/kernel/time_32.c1
-rw-r--r--arch/sh/kernel/timers/timer-cmt.c2
-rw-r--r--arch/sh/kernel/traps_32.c68
14 files changed, 63 insertions, 52 deletions
diff --git a/arch/sh/kernel/cpu/clock.c b/arch/sh/kernel/cpu/clock.c
index f5eb56e6bc59..b7e46d5bba43 100644
--- a/arch/sh/kernel/cpu/clock.c
+++ b/arch/sh/kernel/cpu/clock.c
@@ -294,9 +294,10 @@ arch_init_clk_ops(struct clk_ops **ops, int type)
294{ 294{
295} 295}
296 296
297void __init __attribute__ ((weak)) 297int __init __attribute__ ((weak))
298arch_clk_init(void) 298arch_clk_init(void)
299{ 299{
300 return 0;
300} 301}
301 302
302static int show_clocks(char *buf, char **start, off_t off, 303static int show_clocks(char *buf, char **start, off_t off,
@@ -331,7 +332,7 @@ int __init clk_init(void)
331 ret |= clk_register(clk); 332 ret |= clk_register(clk);
332 } 333 }
333 334
334 arch_clk_init(); 335 ret |= arch_clk_init();
335 336
336 /* Kick the child clocks.. */ 337 /* Kick the child clocks.. */
337 propagate_rate(&master_clk); 338 propagate_rate(&master_clk);
diff --git a/arch/sh/kernel/io_generic.c b/arch/sh/kernel/io_generic.c
index db769449f5a7..f1b214d3bce3 100644
--- a/arch/sh/kernel/io_generic.c
+++ b/arch/sh/kernel/io_generic.c
@@ -81,7 +81,7 @@ void generic_insb(unsigned long port, void *dst, unsigned long count)
81 volatile u8 *port_addr; 81 volatile u8 *port_addr;
82 u8 *buf = dst; 82 u8 *buf = dst;
83 83
84 port_addr = (volatile u8 *)__ioport_map(port, 1); 84 port_addr = (volatile u8 __force *)__ioport_map(port, 1);
85 while (count--) 85 while (count--)
86 *buf++ = *port_addr; 86 *buf++ = *port_addr;
87} 87}
@@ -91,7 +91,7 @@ void generic_insw(unsigned long port, void *dst, unsigned long count)
91 volatile u16 *port_addr; 91 volatile u16 *port_addr;
92 u16 *buf = dst; 92 u16 *buf = dst;
93 93
94 port_addr = (volatile u16 *)__ioport_map(port, 2); 94 port_addr = (volatile u16 __force *)__ioport_map(port, 2);
95 while (count--) 95 while (count--)
96 *buf++ = *port_addr; 96 *buf++ = *port_addr;
97 97
@@ -103,7 +103,7 @@ void generic_insl(unsigned long port, void *dst, unsigned long count)
103 volatile u32 *port_addr; 103 volatile u32 *port_addr;
104 u32 *buf = dst; 104 u32 *buf = dst;
105 105
106 port_addr = (volatile u32 *)__ioport_map(port, 4); 106 port_addr = (volatile u32 __force *)__ioport_map(port, 4);
107 while (count--) 107 while (count--)
108 *buf++ = *port_addr; 108 *buf++ = *port_addr;
109 109
diff --git a/arch/sh/kernel/machvec.c b/arch/sh/kernel/machvec.c
index 129b2cfd18a8..8bfdd275e940 100644
--- a/arch/sh/kernel/machvec.c
+++ b/arch/sh/kernel/machvec.c
@@ -14,6 +14,7 @@
14#include <linux/string.h> 14#include <linux/string.h>
15#include <asm/machvec.h> 15#include <asm/machvec.h>
16#include <asm/sections.h> 16#include <asm/sections.h>
17#include <asm/setup.h>
17#include <asm/io.h> 18#include <asm/io.h>
18#include <asm/irq.h> 19#include <asm/irq.h>
19 20
diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c
index 7326313bcfdb..914e543102df 100644
--- a/arch/sh/kernel/process_32.c
+++ b/arch/sh/kernel/process_32.c
@@ -26,6 +26,7 @@
26#include <asm/system.h> 26#include <asm/system.h>
27#include <asm/ubc.h> 27#include <asm/ubc.h>
28#include <asm/fpu.h> 28#include <asm/fpu.h>
29#include <asm/syscalls.h>
29 30
30static int hlt_counter; 31static int hlt_counter;
31int ubc_usercnt = 0; 32int ubc_usercnt = 0;
diff --git a/arch/sh/kernel/process_64.c b/arch/sh/kernel/process_64.c
index b9dbd2d3b4a5..d0dddc438c0c 100644
--- a/arch/sh/kernel/process_64.c
+++ b/arch/sh/kernel/process_64.c
@@ -25,6 +25,7 @@
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/proc_fs.h> 26#include <linux/proc_fs.h>
27#include <linux/io.h> 27#include <linux/io.h>
28#include <asm/syscalls.h>
28#include <asm/uaccess.h> 29#include <asm/uaccess.h>
29#include <asm/pgtable.h> 30#include <asm/pgtable.h>
30#include <asm/mmu_context.h> 31#include <asm/mmu_context.h>
diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c
index 035cb300d3dc..84bf3420597c 100644
--- a/arch/sh/kernel/ptrace_32.c
+++ b/arch/sh/kernel/ptrace_32.c
@@ -27,6 +27,7 @@
27#include <asm/system.h> 27#include <asm/system.h>
28#include <asm/processor.h> 28#include <asm/processor.h>
29#include <asm/mmu_context.h> 29#include <asm/mmu_context.h>
30#include <asm/syscalls.h>
30 31
31/* 32/*
32 * does not yet catch signals sent when the child dies. 33 * does not yet catch signals sent when the child dies.
@@ -105,6 +106,7 @@ void ptrace_disable(struct task_struct *child)
105long arch_ptrace(struct task_struct *child, long request, long addr, long data) 106long arch_ptrace(struct task_struct *child, long request, long addr, long data)
106{ 107{
107 struct user * dummy = NULL; 108 struct user * dummy = NULL;
109 unsigned long __user *datap = (unsigned long __user *)data;
108 int ret; 110 int ret;
109 111
110 switch (request) { 112 switch (request) {
@@ -133,7 +135,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
133 tmp = !!tsk_used_math(child); 135 tmp = !!tsk_used_math(child);
134 else 136 else
135 tmp = 0; 137 tmp = 0;
136 ret = put_user(tmp, (unsigned long __user *)data); 138 ret = put_user(tmp, datap);
137 break; 139 break;
138 } 140 }
139 141
@@ -202,7 +204,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
202 } 204 }
203 205
204 ret = 0; 206 ret = 0;
205 if (put_user(tmp, (unsigned long *) data)) { 207 if (put_user(tmp, datap)) {
206 ret = -EFAULT; 208 ret = -EFAULT;
207 break; 209 break;
208 } 210 }
diff --git a/arch/sh/kernel/ptrace_64.c b/arch/sh/kernel/ptrace_64.c
index 9c6424892bd3..e15b099c1f06 100644
--- a/arch/sh/kernel/ptrace_64.c
+++ b/arch/sh/kernel/ptrace_64.c
@@ -35,6 +35,7 @@
35#include <asm/system.h> 35#include <asm/system.h>
36#include <asm/processor.h> 36#include <asm/processor.h>
37#include <asm/mmu_context.h> 37#include <asm/mmu_context.h>
38#include <asm/syscalls.h>
38#include <asm/fpu.h> 39#include <asm/fpu.h>
39 40
40/* This mask defines the bits of the SR which the user is not allowed to 41/* This mask defines the bits of the SR which the user is not allowed to
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index de832056bf1b..6d0899e890d0 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -26,6 +26,7 @@
26#include <linux/err.h> 26#include <linux/err.h>
27#include <linux/debugfs.h> 27#include <linux/debugfs.h>
28#include <linux/crash_dump.h> 28#include <linux/crash_dump.h>
29#include <linux/mmzone.h>
29#include <asm/uaccess.h> 30#include <asm/uaccess.h>
30#include <asm/io.h> 31#include <asm/io.h>
31#include <asm/page.h> 32#include <asm/page.h>
diff --git a/arch/sh/kernel/signal_32.c b/arch/sh/kernel/signal_32.c
index 51689d29ad45..345de2f1d53c 100644
--- a/arch/sh/kernel/signal_32.c
+++ b/arch/sh/kernel/signal_32.c
@@ -30,6 +30,7 @@
30#include <asm/uaccess.h> 30#include <asm/uaccess.h>
31#include <asm/pgtable.h> 31#include <asm/pgtable.h>
32#include <asm/cacheflush.h> 32#include <asm/cacheflush.h>
33#include <asm/syscalls.h>
33#include <asm/fpu.h> 34#include <asm/fpu.h>
34 35
35#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 36#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
@@ -247,7 +248,6 @@ asmlinkage int sys_rt_sigreturn(unsigned long r4, unsigned long r5,
247 struct pt_regs *regs = RELOC_HIDE(&__regs, 0); 248 struct pt_regs *regs = RELOC_HIDE(&__regs, 0);
248 struct rt_sigframe __user *frame = (struct rt_sigframe __user *)regs->regs[15]; 249 struct rt_sigframe __user *frame = (struct rt_sigframe __user *)regs->regs[15];
249 sigset_t set; 250 sigset_t set;
250 stack_t st;
251 int r0; 251 int r0;
252 252
253 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 253 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
@@ -265,11 +265,9 @@ asmlinkage int sys_rt_sigreturn(unsigned long r4, unsigned long r5,
265 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &r0)) 265 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &r0))
266 goto badframe; 266 goto badframe;
267 267
268 if (__copy_from_user(&st, &frame->uc.uc_stack, sizeof(st))) 268 if (do_sigaltstack(&frame->uc.uc_stack, NULL,
269 regs->regs[15]) == -EFAULT)
269 goto badframe; 270 goto badframe;
270 /* It is more difficult to avoid calling this function than to
271 call it and ignore errors. */
272 do_sigaltstack((const stack_t __user *)&st, NULL, (unsigned long)frame);
273 271
274 return r0; 272 return r0;
275 273
@@ -429,7 +427,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
429 427
430 /* Create the ucontext. */ 428 /* Create the ucontext. */
431 err |= __put_user(0, &frame->uc.uc_flags); 429 err |= __put_user(0, &frame->uc.uc_flags);
432 err |= __put_user(0, &frame->uc.uc_link); 430 err |= __put_user(NULL, &frame->uc.uc_link);
433 err |= __put_user((void *)current->sas_ss_sp, 431 err |= __put_user((void *)current->sas_ss_sp,
434 &frame->uc.uc_stack.ss_sp); 432 &frame->uc.uc_stack.ss_sp);
435 err |= __put_user(sas_ss_flags(regs->regs[15]), 433 err |= __put_user(sas_ss_flags(regs->regs[15]),
diff --git a/arch/sh/kernel/sys_sh.c b/arch/sh/kernel/sys_sh.c
index 9061b86d73fa..0dfb88925add 100644
--- a/arch/sh/kernel/sys_sh.c
+++ b/arch/sh/kernel/sys_sh.c
@@ -23,6 +23,7 @@
23#include <linux/fs.h> 23#include <linux/fs.h>
24#include <linux/ipc.h> 24#include <linux/ipc.h>
25#include <asm/cacheflush.h> 25#include <asm/cacheflush.h>
26#include <asm/syscalls.h>
26#include <asm/uaccess.h> 27#include <asm/uaccess.h>
27#include <asm/unistd.h> 28#include <asm/unistd.h>
28 29
@@ -186,7 +187,7 @@ asmlinkage int sys_ipc(uint call, int first, int second,
186 union semun fourth; 187 union semun fourth;
187 if (!ptr) 188 if (!ptr)
188 return -EINVAL; 189 return -EINVAL;
189 if (get_user(fourth.__pad, (void * __user *) ptr)) 190 if (get_user(fourth.__pad, (void __user * __user *) ptr))
190 return -EFAULT; 191 return -EFAULT;
191 return sys_semctl (first, second, third, fourth); 192 return sys_semctl (first, second, third, fourth);
192 } 193 }
@@ -261,13 +262,13 @@ asmlinkage int sys_ipc(uint call, int first, int second,
261 return -EINVAL; 262 return -EINVAL;
262} 263}
263 264
264asmlinkage int sys_uname(struct old_utsname * name) 265asmlinkage int sys_uname(struct old_utsname __user *name)
265{ 266{
266 int err; 267 int err;
267 if (!name) 268 if (!name)
268 return -EFAULT; 269 return -EFAULT;
269 down_read(&uts_sem); 270 down_read(&uts_sem);
270 err = copy_to_user(name, utsname(), sizeof (*name)); 271 err = copy_to_user(name, utsname(), sizeof(*name));
271 up_read(&uts_sem); 272 up_read(&uts_sem);
272 return err?-EFAULT:0; 273 return err?-EFAULT:0;
273} 274}
diff --git a/arch/sh/kernel/sys_sh32.c b/arch/sh/kernel/sys_sh32.c
index f0aa5c398656..dbba1e1833d4 100644
--- a/arch/sh/kernel/sys_sh32.c
+++ b/arch/sh/kernel/sys_sh32.c
@@ -16,6 +16,7 @@
16#include <asm/cacheflush.h> 16#include <asm/cacheflush.h>
17#include <asm/uaccess.h> 17#include <asm/uaccess.h>
18#include <asm/unistd.h> 18#include <asm/unistd.h>
19#include <asm/syscalls.h>
19 20
20/* 21/*
21 * sys_pipe() is the normal C calling standard for creating 22 * sys_pipe() is the normal C calling standard for creating
@@ -37,13 +38,13 @@ asmlinkage int sys_pipe(unsigned long r4, unsigned long r5,
37 return error; 38 return error;
38} 39}
39 40
40asmlinkage ssize_t sys_pread_wrapper(unsigned int fd, char * buf, 41asmlinkage ssize_t sys_pread_wrapper(unsigned int fd, char __user *buf,
41 size_t count, long dummy, loff_t pos) 42 size_t count, long dummy, loff_t pos)
42{ 43{
43 return sys_pread64(fd, buf, count, pos); 44 return sys_pread64(fd, buf, count, pos);
44} 45}
45 46
46asmlinkage ssize_t sys_pwrite_wrapper(unsigned int fd, const char * buf, 47asmlinkage ssize_t sys_pwrite_wrapper(unsigned int fd, const char __user *buf,
47 size_t count, long dummy, loff_t pos) 48 size_t count, long dummy, loff_t pos)
48{ 49{
49 return sys_pwrite64(fd, buf, count, pos); 50 return sys_pwrite64(fd, buf, count, pos);
diff --git a/arch/sh/kernel/time_32.c b/arch/sh/kernel/time_32.c
index e2f74cc71d8c..23ca711c27d2 100644
--- a/arch/sh/kernel/time_32.c
+++ b/arch/sh/kernel/time_32.c
@@ -16,6 +16,7 @@
16#include <linux/timex.h> 16#include <linux/timex.h>
17#include <linux/sched.h> 17#include <linux/sched.h>
18#include <linux/clockchips.h> 18#include <linux/clockchips.h>
19#include <linux/mc146818rtc.h> /* for rtc_lock */
19#include <linux/smp.h> 20#include <linux/smp.h>
20#include <asm/clock.h> 21#include <asm/clock.h>
21#include <asm/rtc.h> 22#include <asm/rtc.h>
diff --git a/arch/sh/kernel/timers/timer-cmt.c b/arch/sh/kernel/timers/timer-cmt.c
index d20c8c375881..c127293271e1 100644
--- a/arch/sh/kernel/timers/timer-cmt.c
+++ b/arch/sh/kernel/timers/timer-cmt.c
@@ -174,7 +174,7 @@ static int cmt_timer_init(void)
174 return 0; 174 return 0;
175} 175}
176 176
177struct sys_timer_ops cmt_timer_ops = { 177static struct sys_timer_ops cmt_timer_ops = {
178 .init = cmt_timer_init, 178 .init = cmt_timer_init,
179 .start = cmt_timer_start, 179 .start = cmt_timer_start,
180 .stop = cmt_timer_stop, 180 .stop = cmt_timer_stop,
diff --git a/arch/sh/kernel/traps_32.c b/arch/sh/kernel/traps_32.c
index 511a9426cec5..4901f6732162 100644
--- a/arch/sh/kernel/traps_32.c
+++ b/arch/sh/kernel/traps_32.c
@@ -192,6 +192,7 @@ static int handle_unaligned_ins(opcode_t instruction, struct pt_regs *regs,
192 int ret, index, count; 192 int ret, index, count;
193 unsigned long *rm, *rn; 193 unsigned long *rm, *rn;
194 unsigned char *src, *dst; 194 unsigned char *src, *dst;
195 unsigned char __user *srcu, *dstu;
195 196
196 index = (instruction>>8)&15; /* 0x0F00 */ 197 index = (instruction>>8)&15; /* 0x0F00 */
197 rn = &regs->regs[index]; 198 rn = &regs->regs[index];
@@ -206,28 +207,28 @@ static int handle_unaligned_ins(opcode_t instruction, struct pt_regs *regs,
206 case 0: /* mov.[bwl] to/from memory via r0+rn */ 207 case 0: /* mov.[bwl] to/from memory via r0+rn */
207 if (instruction & 8) { 208 if (instruction & 8) {
208 /* from memory */ 209 /* from memory */
209 src = (unsigned char*) *rm; 210 srcu = (unsigned char __user *)*rm;
210 src += regs->regs[0]; 211 srcu += regs->regs[0];
211 dst = (unsigned char*) rn; 212 dst = (unsigned char *)rn;
212 *(unsigned long*)dst = 0; 213 *(unsigned long *)dst = 0;
213 214
214#if !defined(__LITTLE_ENDIAN__) 215#if !defined(__LITTLE_ENDIAN__)
215 dst += 4-count; 216 dst += 4-count;
216#endif 217#endif
217 if (ma->from(dst, src, count)) 218 if (ma->from(dst, srcu, count))
218 goto fetch_fault; 219 goto fetch_fault;
219 220
220 sign_extend(count, dst); 221 sign_extend(count, dst);
221 } else { 222 } else {
222 /* to memory */ 223 /* to memory */
223 src = (unsigned char*) rm; 224 src = (unsigned char *)rm;
224#if !defined(__LITTLE_ENDIAN__) 225#if !defined(__LITTLE_ENDIAN__)
225 src += 4-count; 226 src += 4-count;
226#endif 227#endif
227 dst = (unsigned char*) *rn; 228 dstu = (unsigned char __user *)*rn;
228 dst += regs->regs[0]; 229 dstu += regs->regs[0];
229 230
230 if (ma->to(dst, src, count)) 231 if (ma->to(dstu, src, count))
231 goto fetch_fault; 232 goto fetch_fault;
232 } 233 }
233 ret = 0; 234 ret = 0;
@@ -235,10 +236,10 @@ static int handle_unaligned_ins(opcode_t instruction, struct pt_regs *regs,
235 236
236 case 1: /* mov.l Rm,@(disp,Rn) */ 237 case 1: /* mov.l Rm,@(disp,Rn) */
237 src = (unsigned char*) rm; 238 src = (unsigned char*) rm;
238 dst = (unsigned char*) *rn; 239 dstu = (unsigned char __user *)*rn;
239 dst += (instruction&0x000F)<<2; 240 dstu += (instruction&0x000F)<<2;
240 241
241 if (ma->to(dst, src, 4)) 242 if (ma->to(dstu, src, 4))
242 goto fetch_fault; 243 goto fetch_fault;
243 ret = 0; 244 ret = 0;
244 break; 245 break;
@@ -247,28 +248,28 @@ static int handle_unaligned_ins(opcode_t instruction, struct pt_regs *regs,
247 if (instruction & 4) 248 if (instruction & 4)
248 *rn -= count; 249 *rn -= count;
249 src = (unsigned char*) rm; 250 src = (unsigned char*) rm;
250 dst = (unsigned char*) *rn; 251 dstu = (unsigned char __user *)*rn;
251#if !defined(__LITTLE_ENDIAN__) 252#if !defined(__LITTLE_ENDIAN__)
252 src += 4-count; 253 src += 4-count;
253#endif 254#endif
254 if (ma->to(dst, src, count)) 255 if (ma->to(dstu, src, count))
255 goto fetch_fault; 256 goto fetch_fault;
256 ret = 0; 257 ret = 0;
257 break; 258 break;
258 259
259 case 5: /* mov.l @(disp,Rm),Rn */ 260 case 5: /* mov.l @(disp,Rm),Rn */
260 src = (unsigned char*) *rm; 261 srcu = (unsigned char __user *)*rm;
261 src += (instruction&0x000F)<<2; 262 srcu += (instruction & 0x000F) << 2;
262 dst = (unsigned char*) rn; 263 dst = (unsigned char *)rn;
263 *(unsigned long*)dst = 0; 264 *(unsigned long *)dst = 0;
264 265
265 if (ma->from(dst, src, 4)) 266 if (ma->from(dst, srcu, 4))
266 goto fetch_fault; 267 goto fetch_fault;
267 ret = 0; 268 ret = 0;
268 break; 269 break;
269 270
270 case 6: /* mov.[bwl] from memory, possibly with post-increment */ 271 case 6: /* mov.[bwl] from memory, possibly with post-increment */
271 src = (unsigned char*) *rm; 272 srcu = (unsigned char __user *)*rm;
272 if (instruction & 4) 273 if (instruction & 4)
273 *rm += count; 274 *rm += count;
274 dst = (unsigned char*) rn; 275 dst = (unsigned char*) rn;
@@ -277,7 +278,7 @@ static int handle_unaligned_ins(opcode_t instruction, struct pt_regs *regs,
277#if !defined(__LITTLE_ENDIAN__) 278#if !defined(__LITTLE_ENDIAN__)
278 dst += 4-count; 279 dst += 4-count;
279#endif 280#endif
280 if (ma->from(dst, src, count)) 281 if (ma->from(dst, srcu, count))
281 goto fetch_fault; 282 goto fetch_fault;
282 sign_extend(count, dst); 283 sign_extend(count, dst);
283 ret = 0; 284 ret = 0;
@@ -286,28 +287,28 @@ static int handle_unaligned_ins(opcode_t instruction, struct pt_regs *regs,
286 case 8: 287 case 8:
287 switch ((instruction&0xFF00)>>8) { 288 switch ((instruction&0xFF00)>>8) {
288 case 0x81: /* mov.w R0,@(disp,Rn) */ 289 case 0x81: /* mov.w R0,@(disp,Rn) */
289 src = (unsigned char*) &regs->regs[0]; 290 src = (unsigned char *) &regs->regs[0];
290#if !defined(__LITTLE_ENDIAN__) 291#if !defined(__LITTLE_ENDIAN__)
291 src += 2; 292 src += 2;
292#endif 293#endif
293 dst = (unsigned char*) *rm; /* called Rn in the spec */ 294 dstu = (unsigned char __user *)*rm; /* called Rn in the spec */
294 dst += (instruction&0x000F)<<1; 295 dstu += (instruction & 0x000F) << 1;
295 296
296 if (ma->to(dst, src, 2)) 297 if (ma->to(dstu, src, 2))
297 goto fetch_fault; 298 goto fetch_fault;
298 ret = 0; 299 ret = 0;
299 break; 300 break;
300 301
301 case 0x85: /* mov.w @(disp,Rm),R0 */ 302 case 0x85: /* mov.w @(disp,Rm),R0 */
302 src = (unsigned char*) *rm; 303 srcu = (unsigned char __user *)*rm;
303 src += (instruction&0x000F)<<1; 304 srcu += (instruction & 0x000F) << 1;
304 dst = (unsigned char*) &regs->regs[0]; 305 dst = (unsigned char *) &regs->regs[0];
305 *(unsigned long*)dst = 0; 306 *(unsigned long *)dst = 0;
306 307
307#if !defined(__LITTLE_ENDIAN__) 308#if !defined(__LITTLE_ENDIAN__)
308 dst += 2; 309 dst += 2;
309#endif 310#endif
310 if (ma->from(dst, src, 2)) 311 if (ma->from(dst, srcu, 2))
311 goto fetch_fault; 312 goto fetch_fault;
312 sign_extend(2, dst); 313 sign_extend(2, dst);
313 ret = 0; 314 ret = 0;
@@ -333,7 +334,8 @@ static inline int handle_delayslot(struct pt_regs *regs,
333 struct mem_access *ma) 334 struct mem_access *ma)
334{ 335{
335 opcode_t instruction; 336 opcode_t instruction;
336 void *addr = (void *)(regs->pc + instruction_size(old_instruction)); 337 void __user *addr = (void __user *)(regs->pc +
338 instruction_size(old_instruction));
337 339
338 if (copy_from_user(&instruction, addr, sizeof(instruction))) { 340 if (copy_from_user(&instruction, addr, sizeof(instruction))) {
339 /* the instruction-fetch faulted */ 341 /* the instruction-fetch faulted */
@@ -559,7 +561,7 @@ asmlinkage void do_address_error(struct pt_regs *regs,
559 } 561 }
560 562
561 set_fs(USER_DS); 563 set_fs(USER_DS);
562 if (copy_from_user(&instruction, (void *)(regs->pc), 564 if (copy_from_user(&instruction, (void __user *)(regs->pc),
563 sizeof(instruction))) { 565 sizeof(instruction))) {
564 /* Argh. Fault on the instruction itself. 566 /* Argh. Fault on the instruction itself.
565 This should never happen non-SMP 567 This should never happen non-SMP
@@ -589,7 +591,7 @@ uspace_segv:
589 die("unaligned program counter", regs, error_code); 591 die("unaligned program counter", regs, error_code);
590 592
591 set_fs(KERNEL_DS); 593 set_fs(KERNEL_DS);
592 if (copy_from_user(&instruction, (void *)(regs->pc), 594 if (copy_from_user(&instruction, (void __user *)(regs->pc),
593 sizeof(instruction))) { 595 sizeof(instruction))) {
594 /* Argh. Fault on the instruction itself. 596 /* Argh. Fault on the instruction itself.
595 This should never happen non-SMP 597 This should never happen non-SMP