aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-03-16 22:28:15 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-03-16 22:28:15 -0400
commit47455911674d65fba28d43f4135c28ee40c75bac (patch)
treebb109710af11a8e499e971a230fff7316cc49095 /arch
parent5379058b718ac6354ba99cc74d10c28d632dc28a (diff)
parentf510aa3bdb095c5253f6bee9e0f5a3a9ac69ded4 (diff)
Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
* 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus: [MIPS] Kconfig: Move missplaced NR_CPUS default from SMTC to VSMP. [MIPS] Lockdep: Fix recursion bug. [MIPS] RTLX: Handle copy_*_user return values. [MIPS] RTLX: Protect rtlx_{read,write} with mutex. [MIPS] RTLX: Harden against compiler reordering and optimization. [MIPS] RTLX: Don't use volatile; it's fragile. [MIPS] Lasat: Downgrade 64-bit kernel from experimental to broken. [MIPS] Compat: Fix build if CONFIG_SYSVIPC is disabled. [CHAR] lcd: Fix two warnings. [MIPS] FPU ownership management & preemption fixes [MIPS] Check FCSR for pending interrupts, alternative version [MIPS] IP27, IP35: Fix warnings.
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/Kconfig4
-rw-r--r--arch/mips/kernel/kspd.c18
-rw-r--r--arch/mips/kernel/linux32.c12
-rw-r--r--arch/mips/kernel/r2300_switch.S10
-rw-r--r--arch/mips/kernel/r4k_fpu.S16
-rw-r--r--arch/mips/kernel/r4k_switch.S10
-rw-r--r--arch/mips/kernel/rtlx.c104
-rw-r--r--arch/mips/kernel/signal-common.h3
-rw-r--r--arch/mips/kernel/signal.c75
-rw-r--r--arch/mips/kernel/signal32.c56
-rw-r--r--arch/mips/kernel/signal_n32.c6
-rw-r--r--arch/mips/kernel/traps.c84
-rw-r--r--arch/mips/math-emu/kernel_linkage.c8
13 files changed, 242 insertions, 164 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 2b9c65c3b5d..5f29018a653 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -250,7 +250,7 @@ config LASAT
250 select R5000_CPU_SCACHE 250 select R5000_CPU_SCACHE
251 select SYS_HAS_CPU_R5000 251 select SYS_HAS_CPU_R5000
252 select SYS_SUPPORTS_32BIT_KERNEL 252 select SYS_SUPPORTS_32BIT_KERNEL
253 select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL 253 select SYS_SUPPORTS_64BIT_KERNEL if BROKEN
254 select SYS_SUPPORTS_LITTLE_ENDIAN 254 select SYS_SUPPORTS_LITTLE_ENDIAN
255 select GENERIC_HARDIRQS_NO__DO_IRQ 255 select GENERIC_HARDIRQS_NO__DO_IRQ
256 256
@@ -1559,6 +1559,7 @@ config MIPS_MT_SMP
1559 select CPU_MIPSR2_IRQ_VI 1559 select CPU_MIPSR2_IRQ_VI
1560 select CPU_MIPSR2_SRS 1560 select CPU_MIPSR2_SRS
1561 select MIPS_MT 1561 select MIPS_MT
1562 select NR_CPUS_DEFAULT_2
1562 select SMP 1563 select SMP
1563 select SYS_SUPPORTS_SMP 1564 select SYS_SUPPORTS_SMP
1564 help 1565 help
@@ -1573,7 +1574,6 @@ config MIPS_MT_SMTC
1573 select CPU_MIPSR2_IRQ_VI 1574 select CPU_MIPSR2_IRQ_VI
1574 select CPU_MIPSR2_SRS 1575 select CPU_MIPSR2_SRS
1575 select MIPS_MT 1576 select MIPS_MT
1576 select NR_CPUS_DEFAULT_2
1577 select NR_CPUS_DEFAULT_8 1577 select NR_CPUS_DEFAULT_8
1578 select SMP 1578 select SMP
1579 select SYS_SUPPORTS_SMP 1579 select SYS_SUPPORTS_SMP
diff --git a/arch/mips/kernel/kspd.c b/arch/mips/kernel/kspd.c
index 241ee7a2906..29eadd404fa 100644
--- a/arch/mips/kernel/kspd.c
+++ b/arch/mips/kernel/kspd.c
@@ -191,6 +191,8 @@ void sp_work_handle_request(void)
191 struct mtsp_syscall_generic generic; 191 struct mtsp_syscall_generic generic;
192 struct mtsp_syscall_ret ret; 192 struct mtsp_syscall_ret ret;
193 struct kspd_notifications *n; 193 struct kspd_notifications *n;
194 unsigned long written;
195 mm_segment_t old_fs;
194 struct timeval tv; 196 struct timeval tv;
195 struct timezone tz; 197 struct timezone tz;
196 int cmd; 198 int cmd;
@@ -201,7 +203,11 @@ void sp_work_handle_request(void)
201 203
202 ret.retval = -1; 204 ret.retval = -1;
203 205
204 if (!rtlx_read(RTLX_CHANNEL_SYSIO, &sc, sizeof(struct mtsp_syscall), 0)) { 206 old_fs = get_fs();
207 set_fs(KERNEL_DS);
208
209 if (!rtlx_read(RTLX_CHANNEL_SYSIO, &sc, sizeof(struct mtsp_syscall))) {
210 set_fs(old_fs);
205 printk(KERN_ERR "Expected request but nothing to read\n"); 211 printk(KERN_ERR "Expected request but nothing to read\n");
206 return; 212 return;
207 } 213 }
@@ -209,7 +215,8 @@ void sp_work_handle_request(void)
209 size = sc.size; 215 size = sc.size;
210 216
211 if (size) { 217 if (size) {
212 if (!rtlx_read(RTLX_CHANNEL_SYSIO, &generic, size, 0)) { 218 if (!rtlx_read(RTLX_CHANNEL_SYSIO, &generic, size)) {
219 set_fs(old_fs);
213 printk(KERN_ERR "Expected request but nothing to read\n"); 220 printk(KERN_ERR "Expected request but nothing to read\n");
214 return; 221 return;
215 } 222 }
@@ -282,8 +289,11 @@ void sp_work_handle_request(void)
282 if (vpe_getuid(SP_VPE)) 289 if (vpe_getuid(SP_VPE))
283 sp_setfsuidgid( 0, 0); 290 sp_setfsuidgid( 0, 0);
284 291
285 if ((rtlx_write(RTLX_CHANNEL_SYSIO, &ret, sizeof(struct mtsp_syscall_ret), 0)) 292 old_fs = get_fs();
286 < sizeof(struct mtsp_syscall_ret)) 293 set_fs(KERNEL_DS);
294 written = rtlx_write(RTLX_CHANNEL_SYSIO, &ret, sizeof(ret));
295 set_fs(old_fs);
296 if (written < sizeof(ret))
287 printk("KSPD: sp_work_handle_request failed to send to SP\n"); 297 printk("KSPD: sp_work_handle_request failed to send to SP\n");
288} 298}
289 299
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 1df544c1f96..37849edd064 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -311,6 +311,8 @@ asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid,
311 return ret; 311 return ret;
312} 312}
313 313
314#ifdef CONFIG_SYSVIPC
315
314asmlinkage long 316asmlinkage long
315sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth) 317sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth)
316{ 318{
@@ -368,6 +370,16 @@ sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth)
368 return err; 370 return err;
369} 371}
370 372
373#else
374
375asmlinkage long
376sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth)
377{
378 return -ENOSYS;
379}
380
381#endif /* CONFIG_SYSVIPC */
382
371#ifdef CONFIG_MIPS32_N32 383#ifdef CONFIG_MIPS32_N32
372asmlinkage long sysn32_semctl(int semid, int semnum, int cmd, u32 arg) 384asmlinkage long sysn32_semctl(int semid, int semnum, int cmd, u32 arg)
373{ 385{
diff --git a/arch/mips/kernel/r2300_switch.S b/arch/mips/kernel/r2300_switch.S
index 656bde2e11b..28c2e2e6af7 100644
--- a/arch/mips/kernel/r2300_switch.S
+++ b/arch/mips/kernel/r2300_switch.S
@@ -49,8 +49,7 @@ LEAF(resume)
49#ifndef CONFIG_CPU_HAS_LLSC 49#ifndef CONFIG_CPU_HAS_LLSC
50 sw zero, ll_bit 50 sw zero, ll_bit
51#endif 51#endif
52 mfc0 t1, CP0_STATUS 52 mfc0 t2, CP0_STATUS
53 sw t1, THREAD_STATUS(a0)
54 cpu_save_nonscratch a0 53 cpu_save_nonscratch a0
55 sw ra, THREAD_REG31(a0) 54 sw ra, THREAD_REG31(a0)
56 55
@@ -60,8 +59,8 @@ LEAF(resume)
60 lw t3, TASK_THREAD_INFO(a0) 59 lw t3, TASK_THREAD_INFO(a0)
61 lw t0, TI_FLAGS(t3) 60 lw t0, TI_FLAGS(t3)
62 li t1, _TIF_USEDFPU 61 li t1, _TIF_USEDFPU
63 and t2, t0, t1 62 and t1, t0
64 beqz t2, 1f 63 beqz t1, 1f
65 nor t1, zero, t1 64 nor t1, zero, t1
66 65
67 and t0, t0, t1 66 and t0, t0, t1
@@ -74,10 +73,13 @@ LEAF(resume)
74 li t1, ~ST0_CU1 73 li t1, ~ST0_CU1
75 and t0, t0, t1 74 and t0, t0, t1
76 sw t0, ST_OFF(t3) 75 sw t0, ST_OFF(t3)
76 /* clear thread_struct CU1 bit */
77 and t2, t1
77 78
78 fpu_save_single a0, t0 # clobbers t0 79 fpu_save_single a0, t0 # clobbers t0
79 80
801: 811:
82 sw t2, THREAD_STATUS(a0)
81 /* 83 /*
82 * The order of restoring the registers takes care of the race 84 * The order of restoring the registers takes care of the race
83 * updating $28, $29 and kernelsp without disabling ints. 85 * updating $28, $29 and kernelsp without disabling ints.
diff --git a/arch/mips/kernel/r4k_fpu.S b/arch/mips/kernel/r4k_fpu.S
index 59c1577ecbb..dbd42adc52e 100644
--- a/arch/mips/kernel/r4k_fpu.S
+++ b/arch/mips/kernel/r4k_fpu.S
@@ -114,14 +114,6 @@ LEAF(_save_fp_context32)
114 */ 114 */
115LEAF(_restore_fp_context) 115LEAF(_restore_fp_context)
116 EX lw t0, SC_FPC_CSR(a0) 116 EX lw t0, SC_FPC_CSR(a0)
117
118 /* Fail if the CSR has exceptions pending */
119 srl t1, t0, 5
120 and t1, t0
121 andi t1, 0x1f << 7
122 bnez t1, fault
123 nop
124
125#ifdef CONFIG_64BIT 117#ifdef CONFIG_64BIT
126 EX ldc1 $f1, SC_FPREGS+8(a0) 118 EX ldc1 $f1, SC_FPREGS+8(a0)
127 EX ldc1 $f3, SC_FPREGS+24(a0) 119 EX ldc1 $f3, SC_FPREGS+24(a0)
@@ -165,14 +157,6 @@ LEAF(_restore_fp_context)
165LEAF(_restore_fp_context32) 157LEAF(_restore_fp_context32)
166 /* Restore an o32 sigcontext. */ 158 /* Restore an o32 sigcontext. */
167 EX lw t0, SC32_FPC_CSR(a0) 159 EX lw t0, SC32_FPC_CSR(a0)
168
169 /* Fail if the CSR has exceptions pending */
170 srl t1, t0, 5
171 and t1, t0
172 andi t1, 0x1f << 7
173 bnez t1, fault
174 nop
175
176 EX ldc1 $f0, SC32_FPREGS+0(a0) 160 EX ldc1 $f0, SC32_FPREGS+0(a0)
177 EX ldc1 $f2, SC32_FPREGS+16(a0) 161 EX ldc1 $f2, SC32_FPREGS+16(a0)
178 EX ldc1 $f4, SC32_FPREGS+32(a0) 162 EX ldc1 $f4, SC32_FPREGS+32(a0)
diff --git a/arch/mips/kernel/r4k_switch.S b/arch/mips/kernel/r4k_switch.S
index cc566cf1224..c7698fd9955 100644
--- a/arch/mips/kernel/r4k_switch.S
+++ b/arch/mips/kernel/r4k_switch.S
@@ -48,8 +48,7 @@
48#ifndef CONFIG_CPU_HAS_LLSC 48#ifndef CONFIG_CPU_HAS_LLSC
49 sw zero, ll_bit 49 sw zero, ll_bit
50#endif 50#endif
51 mfc0 t1, CP0_STATUS 51 mfc0 t2, CP0_STATUS
52 LONG_S t1, THREAD_STATUS(a0)
53 cpu_save_nonscratch a0 52 cpu_save_nonscratch a0
54 LONG_S ra, THREAD_REG31(a0) 53 LONG_S ra, THREAD_REG31(a0)
55 54
@@ -59,8 +58,8 @@
59 PTR_L t3, TASK_THREAD_INFO(a0) 58 PTR_L t3, TASK_THREAD_INFO(a0)
60 LONG_L t0, TI_FLAGS(t3) 59 LONG_L t0, TI_FLAGS(t3)
61 li t1, _TIF_USEDFPU 60 li t1, _TIF_USEDFPU
62 and t2, t0, t1 61 and t1, t0
63 beqz t2, 1f 62 beqz t1, 1f
64 nor t1, zero, t1 63 nor t1, zero, t1
65 64
66 and t0, t0, t1 65 and t0, t0, t1
@@ -73,10 +72,13 @@
73 li t1, ~ST0_CU1 72 li t1, ~ST0_CU1
74 and t0, t0, t1 73 and t0, t0, t1
75 LONG_S t0, ST_OFF(t3) 74 LONG_S t0, ST_OFF(t3)
75 /* clear thread_struct CU1 bit */
76 and t2, t1
76 77
77 fpu_save_double a0 t0 t1 # c0_status passed in t0 78 fpu_save_double a0 t0 t1 # c0_status passed in t0
78 # clobbers t1 79 # clobbers t1
791: 801:
81 LONG_S t2, THREAD_STATUS(a0)
80 82
81 /* 83 /*
82 * The order of restoring the registers takes care of the race 84 * The order of restoring the registers takes care of the race
diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c
index e14ae09eda2..e6e3047151a 100644
--- a/arch/mips/kernel/rtlx.c
+++ b/arch/mips/kernel/rtlx.c
@@ -54,6 +54,7 @@ static struct chan_waitqueues {
54 wait_queue_head_t rt_queue; 54 wait_queue_head_t rt_queue;
55 wait_queue_head_t lx_queue; 55 wait_queue_head_t lx_queue;
56 atomic_t in_open; 56 atomic_t in_open;
57 struct mutex mutex;
57} channel_wqs[RTLX_CHANNELS]; 58} channel_wqs[RTLX_CHANNELS];
58 59
59static struct irqaction irq; 60static struct irqaction irq;
@@ -146,7 +147,7 @@ static void stopping(int vpe)
146 147
147int rtlx_open(int index, int can_sleep) 148int rtlx_open(int index, int can_sleep)
148{ 149{
149 volatile struct rtlx_info **p; 150 struct rtlx_info **p;
150 struct rtlx_channel *chan; 151 struct rtlx_channel *chan;
151 enum rtlx_state state; 152 enum rtlx_state state;
152 int ret = 0; 153 int ret = 0;
@@ -179,13 +180,24 @@ int rtlx_open(int index, int can_sleep)
179 } 180 }
180 } 181 }
181 182
183 smp_rmb();
182 if (*p == NULL) { 184 if (*p == NULL) {
183 if (can_sleep) { 185 if (can_sleep) {
184 __wait_event_interruptible(channel_wqs[index].lx_queue, 186 DEFINE_WAIT(wait);
185 *p != NULL, 187
186 ret); 188 for (;;) {
187 if (ret) 189 prepare_to_wait(&channel_wqs[index].lx_queue, &wait, TASK_INTERRUPTIBLE);
190 smp_rmb();
191 if (*p != NULL)
192 break;
193 if (!signal_pending(current)) {
194 schedule();
195 continue;
196 }
197 ret = -ERESTARTSYS;
188 goto out_fail; 198 goto out_fail;
199 }
200 finish_wait(&channel_wqs[index].lx_queue, &wait);
189 } else { 201 } else {
190 printk(" *vpe_get_shared is NULL. " 202 printk(" *vpe_get_shared is NULL. "
191 "Has an SP program been loaded?\n"); 203 "Has an SP program been loaded?\n");
@@ -277,56 +289,52 @@ unsigned int rtlx_write_poll(int index)
277 return write_spacefree(chan->rt_read, chan->rt_write, chan->buffer_size); 289 return write_spacefree(chan->rt_read, chan->rt_write, chan->buffer_size);
278} 290}
279 291
280static inline void copy_to(void *dst, void *src, size_t count, int user) 292ssize_t rtlx_read(int index, void __user *buff, size_t count, int user)
281{
282 if (user)
283 copy_to_user(dst, src, count);
284 else
285 memcpy(dst, src, count);
286}
287
288static inline void copy_from(void *dst, void *src, size_t count, int user)
289{ 293{
290 if (user) 294 size_t lx_write, fl = 0L;
291 copy_from_user(dst, src, count);
292 else
293 memcpy(dst, src, count);
294}
295
296ssize_t rtlx_read(int index, void *buff, size_t count, int user)
297{
298 size_t fl = 0L;
299 struct rtlx_channel *lx; 295 struct rtlx_channel *lx;
296 unsigned long failed;
300 297
301 if (rtlx == NULL) 298 if (rtlx == NULL)
302 return -ENOSYS; 299 return -ENOSYS;
303 300
304 lx = &rtlx->channel[index]; 301 lx = &rtlx->channel[index];
305 302
303 mutex_lock(&channel_wqs[index].mutex);
304 smp_rmb();
305 lx_write = lx->lx_write;
306
306 /* find out how much in total */ 307 /* find out how much in total */
307 count = min(count, 308 count = min(count,
308 (size_t)(lx->lx_write + lx->buffer_size - lx->lx_read) 309 (size_t)(lx_write + lx->buffer_size - lx->lx_read)
309 % lx->buffer_size); 310 % lx->buffer_size);
310 311
311 /* then how much from the read pointer onwards */ 312 /* then how much from the read pointer onwards */
312 fl = min( count, (size_t)lx->buffer_size - lx->lx_read); 313 fl = min(count, (size_t)lx->buffer_size - lx->lx_read);
313 314
314 copy_to(buff, &lx->lx_buffer[lx->lx_read], fl, user); 315 failed = copy_to_user(buff, lx->lx_buffer + lx->lx_read, fl);
316 if (failed)
317 goto out;
315 318
316 /* and if there is anything left at the beginning of the buffer */ 319 /* and if there is anything left at the beginning of the buffer */
317 if ( count - fl ) 320 if (count - fl)
318 copy_to (buff + fl, lx->lx_buffer, count - fl, user); 321 failed = copy_to_user(buff + fl, lx->lx_buffer, count - fl);
319 322
320 /* update the index */ 323out:
321 lx->lx_read += count; 324 count -= failed;
322 lx->lx_read %= lx->buffer_size; 325
326 smp_wmb();
327 lx->lx_read = (lx->lx_read + count) % lx->buffer_size;
328 smp_wmb();
329 mutex_unlock(&channel_wqs[index].mutex);
323 330
324 return count; 331 return count;
325} 332}
326 333
327ssize_t rtlx_write(int index, void *buffer, size_t count, int user) 334ssize_t rtlx_write(int index, const void __user *buffer, size_t count, int user)
328{ 335{
329 struct rtlx_channel *rt; 336 struct rtlx_channel *rt;
337 size_t rt_read;
330 size_t fl; 338 size_t fl;
331 339
332 if (rtlx == NULL) 340 if (rtlx == NULL)
@@ -334,24 +342,35 @@ ssize_t rtlx_write(int index, void *buffer, size_t count, int user)
334 342
335 rt = &rtlx->channel[index]; 343 rt = &rtlx->channel[index];
336 344
345 mutex_lock(&channel_wqs[index].mutex);
346 smp_rmb();
347 rt_read = rt->rt_read;
348
337 /* total number of bytes to copy */ 349 /* total number of bytes to copy */
338 count = min(count, 350 count = min(count,
339 (size_t)write_spacefree(rt->rt_read, rt->rt_write, 351 (size_t)write_spacefree(rt_read, rt->rt_write, rt->buffer_size));
340 rt->buffer_size));
341 352
342 /* first bit from write pointer to the end of the buffer, or count */ 353 /* first bit from write pointer to the end of the buffer, or count */
343 fl = min(count, (size_t) rt->buffer_size - rt->rt_write); 354 fl = min(count, (size_t) rt->buffer_size - rt->rt_write);
344 355
345 copy_from (&rt->rt_buffer[rt->rt_write], buffer, fl, user); 356 failed = copy_from_user(rt->rt_buffer + rt->rt_write, buffer, fl);
357 if (failed)
358 goto out;
346 359
347 /* if there's any left copy to the beginning of the buffer */ 360 /* if there's any left copy to the beginning of the buffer */
348 if( count - fl ) 361 if (count - fl) {
349 copy_from (rt->rt_buffer, buffer + fl, count - fl, user); 362 failed = copy_from_user(rt->rt_buffer, buffer + fl, count - fl);
363 }
364
365out:
366 count -= cailed;
350 367
351 rt->rt_write += count; 368 smp_wmb();
352 rt->rt_write %= rt->buffer_size; 369 rt->rt_write = (rt->rt_write + count) % rt->buffer_size;
370 smp_wmb();
371 mutex_unlock(&channel_wqs[index].mutex);
353 372
354 return(count); 373 return count;
355} 374}
356 375
357 376
@@ -403,7 +422,7 @@ static ssize_t file_read(struct file *file, char __user * buffer, size_t count,
403 return 0; // -EAGAIN makes cat whinge 422 return 0; // -EAGAIN makes cat whinge
404 } 423 }
405 424
406 return rtlx_read(minor, buffer, count, 1); 425 return rtlx_read(minor, buffer, count);
407} 426}
408 427
409static ssize_t file_write(struct file *file, const char __user * buffer, 428static ssize_t file_write(struct file *file, const char __user * buffer,
@@ -429,7 +448,7 @@ static ssize_t file_write(struct file *file, const char __user * buffer,
429 return ret; 448 return ret;
430 } 449 }
431 450
432 return rtlx_write(minor, (void *)buffer, count, 1); 451 return rtlx_write(minor, buffer, count);
433} 452}
434 453
435static const struct file_operations rtlx_fops = { 454static const struct file_operations rtlx_fops = {
@@ -468,6 +487,7 @@ static int rtlx_module_init(void)
468 init_waitqueue_head(&channel_wqs[i].rt_queue); 487 init_waitqueue_head(&channel_wqs[i].rt_queue);
469 init_waitqueue_head(&channel_wqs[i].lx_queue); 488 init_waitqueue_head(&channel_wqs[i].lx_queue);
470 atomic_set(&channel_wqs[i].in_open, 0); 489 atomic_set(&channel_wqs[i].in_open, 0);
490 mutex_init(&channel_wqs[i].mutex);
471 491
472 dev = device_create(mt_class, NULL, MKDEV(major, i), 492 dev = device_create(mt_class, NULL, MKDEV(major, i),
473 "%s%d", module_name, i); 493 "%s%d", module_name, i);
diff --git a/arch/mips/kernel/signal-common.h b/arch/mips/kernel/signal-common.h
index fdbdbdc65b5..297dfcb9752 100644
--- a/arch/mips/kernel/signal-common.h
+++ b/arch/mips/kernel/signal-common.h
@@ -31,4 +31,7 @@ extern void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
31 */ 31 */
32extern int install_sigtramp(unsigned int __user *tramp, unsigned int syscall); 32extern int install_sigtramp(unsigned int __user *tramp, unsigned int syscall);
33 33
34/* Check and clear pending FPU exceptions in saved CSR */
35extern int fpcsr_pending(unsigned int __user *fpcsr);
36
34#endif /* __SIGNAL_COMMON_H */ 37#endif /* __SIGNAL_COMMON_H */
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index f091786187a..8c3c5a5789b 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -82,6 +82,7 @@ int setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
82{ 82{
83 int err = 0; 83 int err = 0;
84 int i; 84 int i;
85 unsigned int used_math;
85 86
86 err |= __put_user(regs->cp0_epc, &sc->sc_pc); 87 err |= __put_user(regs->cp0_epc, &sc->sc_pc);
87 88
@@ -104,26 +105,53 @@ int setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
104 err |= __put_user(rddsp(DSP_MASK), &sc->sc_dsp); 105 err |= __put_user(rddsp(DSP_MASK), &sc->sc_dsp);
105 } 106 }
106 107
107 err |= __put_user(!!used_math(), &sc->sc_used_math); 108 used_math = !!used_math();
109 err |= __put_user(used_math, &sc->sc_used_math);
108 110
109 if (used_math()) { 111 if (used_math) {
110 /* 112 /*
111 * Save FPU state to signal context. Signal handler 113 * Save FPU state to signal context. Signal handler
112 * will "inherit" current FPU state. 114 * will "inherit" current FPU state.
113 */ 115 */
114 preempt_disable(); 116 own_fpu(1);
115 117 enable_fp_in_kernel();
116 if (!is_fpu_owner()) {
117 own_fpu();
118 restore_fp(current);
119 }
120 err |= save_fp_context(sc); 118 err |= save_fp_context(sc);
121 119 disable_fp_in_kernel();
122 preempt_enable();
123 } 120 }
124 return err; 121 return err;
125} 122}
126 123
124int fpcsr_pending(unsigned int __user *fpcsr)
125{
126 int err, sig = 0;
127 unsigned int csr, enabled;
128
129 err = __get_user(csr, fpcsr);
130 enabled = FPU_CSR_UNI_X | ((csr & FPU_CSR_ALL_E) << 5);
131 /*
132 * If the signal handler set some FPU exceptions, clear it and
133 * send SIGFPE.
134 */
135 if (csr & enabled) {
136 csr &= ~enabled;
137 err |= __put_user(csr, fpcsr);
138 sig = SIGFPE;
139 }
140 return err ?: sig;
141}
142
143static int
144check_and_restore_fp_context(struct sigcontext __user *sc)
145{
146 int err, sig;
147
148 err = sig = fpcsr_pending(&sc->sc_fpc_csr);
149 if (err > 0)
150 err = 0;
151 err |= restore_fp_context(sc);
152 return err ?: sig;
153}
154
127int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) 155int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
128{ 156{
129 unsigned int used_math; 157 unsigned int used_math;
@@ -157,19 +185,18 @@ int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
157 err |= __get_user(used_math, &sc->sc_used_math); 185 err |= __get_user(used_math, &sc->sc_used_math);
158 conditional_used_math(used_math); 186 conditional_used_math(used_math);
159 187
160 preempt_disable(); 188 if (used_math) {
161
162 if (used_math()) {
163 /* restore fpu context if we have used it before */ 189 /* restore fpu context if we have used it before */
164 own_fpu(); 190 own_fpu(0);
165 err |= restore_fp_context(sc); 191 enable_fp_in_kernel();
192 if (!err)
193 err = check_and_restore_fp_context(sc);
194 disable_fp_in_kernel();
166 } else { 195 } else {
167 /* signal handler may have used FPU. Give it up. */ 196 /* signal handler may have used FPU. Give it up. */
168 lose_fpu(); 197 lose_fpu(0);
169 } 198 }
170 199
171 preempt_enable();
172
173 return err; 200 return err;
174} 201}
175 202
@@ -332,6 +359,7 @@ asmlinkage void sys_sigreturn(nabi_no_regargs struct pt_regs regs)
332{ 359{
333 struct sigframe __user *frame; 360 struct sigframe __user *frame;
334 sigset_t blocked; 361 sigset_t blocked;
362 int sig;
335 363
336 frame = (struct sigframe __user *) regs.regs[29]; 364 frame = (struct sigframe __user *) regs.regs[29];
337 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 365 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
@@ -345,8 +373,11 @@ asmlinkage void sys_sigreturn(nabi_no_regargs struct pt_regs regs)
345 recalc_sigpending(); 373 recalc_sigpending();
346 spin_unlock_irq(&current->sighand->siglock); 374 spin_unlock_irq(&current->sighand->siglock);
347 375
348 if (restore_sigcontext(&regs, &frame->sf_sc)) 376 sig = restore_sigcontext(&regs, &frame->sf_sc);
377 if (sig < 0)
349 goto badframe; 378 goto badframe;
379 else if (sig)
380 force_sig(sig, current);
350 381
351 /* 382 /*
352 * Don't let your children do this ... 383 * Don't let your children do this ...
@@ -368,6 +399,7 @@ asmlinkage void sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
368 struct rt_sigframe __user *frame; 399 struct rt_sigframe __user *frame;
369 sigset_t set; 400 sigset_t set;
370 stack_t st; 401 stack_t st;
402 int sig;
371 403
372 frame = (struct rt_sigframe __user *) regs.regs[29]; 404 frame = (struct rt_sigframe __user *) regs.regs[29];
373 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 405 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
@@ -381,8 +413,11 @@ asmlinkage void sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
381 recalc_sigpending(); 413 recalc_sigpending();
382 spin_unlock_irq(&current->sighand->siglock); 414 spin_unlock_irq(&current->sighand->siglock);
383 415
384 if (restore_sigcontext(&regs, &frame->rs_uc.uc_mcontext)) 416 sig = restore_sigcontext(&regs, &frame->rs_uc.uc_mcontext);
417 if (sig < 0)
385 goto badframe; 418 goto badframe;
419 else if (sig)
420 force_sig(sig, current);
386 421
387 if (__copy_from_user(&st, &frame->rs_uc.uc_stack, sizeof(st))) 422 if (__copy_from_user(&st, &frame->rs_uc.uc_stack, sizeof(st)))
388 goto badframe; 423 goto badframe;
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index 19bbef00195..151fd2f0893 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -181,6 +181,7 @@ static int setup_sigcontext32(struct pt_regs *regs,
181{ 181{
182 int err = 0; 182 int err = 0;
183 int i; 183 int i;
184 u32 used_math;
184 185
185 err |= __put_user(regs->cp0_epc, &sc->sc_pc); 186 err |= __put_user(regs->cp0_epc, &sc->sc_pc);
186 187
@@ -200,26 +201,34 @@ static int setup_sigcontext32(struct pt_regs *regs,
200 err |= __put_user(mflo3(), &sc->sc_lo3); 201 err |= __put_user(mflo3(), &sc->sc_lo3);
201 } 202 }
202 203
203 err |= __put_user(!!used_math(), &sc->sc_used_math); 204 used_math = !!used_math();
205 err |= __put_user(used_math, &sc->sc_used_math);
204 206
205 if (used_math()) { 207 if (used_math) {
206 /* 208 /*
207 * Save FPU state to signal context. Signal handler 209 * Save FPU state to signal context. Signal handler
208 * will "inherit" current FPU state. 210 * will "inherit" current FPU state.
209 */ 211 */
210 preempt_disable(); 212 own_fpu(1);
211 213 enable_fp_in_kernel();
212 if (!is_fpu_owner()) {
213 own_fpu();
214 restore_fp(current);
215 }
216 err |= save_fp_context32(sc); 214 err |= save_fp_context32(sc);
217 215 disable_fp_in_kernel();
218 preempt_enable();
219 } 216 }
220 return err; 217 return err;
221} 218}
222 219
220static int
221check_and_restore_fp_context32(struct sigcontext32 __user *sc)
222{
223 int err, sig;
224
225 err = sig = fpcsr_pending(&sc->sc_fpc_csr);
226 if (err > 0)
227 err = 0;
228 err |= restore_fp_context32(sc);
229 return err ?: sig;
230}
231
223static int restore_sigcontext32(struct pt_regs *regs, 232static int restore_sigcontext32(struct pt_regs *regs,
224 struct sigcontext32 __user *sc) 233 struct sigcontext32 __user *sc)
225{ 234{
@@ -250,19 +259,18 @@ static int restore_sigcontext32(struct pt_regs *regs,
250 err |= __get_user(used_math, &sc->sc_used_math); 259 err |= __get_user(used_math, &sc->sc_used_math);
251 conditional_used_math(used_math); 260 conditional_used_math(used_math);
252 261
253 preempt_disable(); 262 if (used_math) {
254
255 if (used_math()) {
256 /* restore fpu context if we have used it before */ 263 /* restore fpu context if we have used it before */
257 own_fpu(); 264 own_fpu(0);
258 err |= restore_fp_context32(sc); 265 enable_fp_in_kernel();
266 if (!err)
267 err = check_and_restore_fp_context32(sc);
268 disable_fp_in_kernel();
259 } else { 269 } else {
260 /* signal handler may have used FPU. Give it up. */ 270 /* signal handler may have used FPU. Give it up. */
261 lose_fpu(); 271 lose_fpu(0);
262 } 272 }
263 273
264 preempt_enable();
265
266 return err; 274 return err;
267} 275}
268 276
@@ -508,6 +516,7 @@ asmlinkage void sys32_sigreturn(nabi_no_regargs struct pt_regs regs)
508{ 516{
509 struct sigframe32 __user *frame; 517 struct sigframe32 __user *frame;
510 sigset_t blocked; 518 sigset_t blocked;
519 int sig;
511 520
512 frame = (struct sigframe32 __user *) regs.regs[29]; 521 frame = (struct sigframe32 __user *) regs.regs[29];
513 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 522 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
@@ -521,8 +530,11 @@ asmlinkage void sys32_sigreturn(nabi_no_regargs struct pt_regs regs)
521 recalc_sigpending(); 530 recalc_sigpending();
522 spin_unlock_irq(&current->sighand->siglock); 531 spin_unlock_irq(&current->sighand->siglock);
523 532
524 if (restore_sigcontext32(&regs, &frame->sf_sc)) 533 sig = restore_sigcontext32(&regs, &frame->sf_sc);
534 if (sig < 0)
525 goto badframe; 535 goto badframe;
536 else if (sig)
537 force_sig(sig, current);
526 538
527 /* 539 /*
528 * Don't let your children do this ... 540 * Don't let your children do this ...
@@ -545,6 +557,7 @@ asmlinkage void sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
545 sigset_t set; 557 sigset_t set;
546 stack_t st; 558 stack_t st;
547 s32 sp; 559 s32 sp;
560 int sig;
548 561
549 frame = (struct rt_sigframe32 __user *) regs.regs[29]; 562 frame = (struct rt_sigframe32 __user *) regs.regs[29];
550 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 563 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
@@ -558,8 +571,11 @@ asmlinkage void sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
558 recalc_sigpending(); 571 recalc_sigpending();
559 spin_unlock_irq(&current->sighand->siglock); 572 spin_unlock_irq(&current->sighand->siglock);
560 573
561 if (restore_sigcontext32(&regs, &frame->rs_uc.uc_mcontext)) 574 sig = restore_sigcontext32(&regs, &frame->rs_uc.uc_mcontext);
575 if (sig < 0)
562 goto badframe; 576 goto badframe;
577 else if (sig)
578 force_sig(sig, current);
563 579
564 /* The ucontext contains a stack32_t, so we must convert! */ 580 /* The ucontext contains a stack32_t, so we must convert! */
565 if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp)) 581 if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp))
diff --git a/arch/mips/kernel/signal_n32.c b/arch/mips/kernel/signal_n32.c
index ecf1f7ecaad..a9202fa9598 100644
--- a/arch/mips/kernel/signal_n32.c
+++ b/arch/mips/kernel/signal_n32.c
@@ -127,6 +127,7 @@ asmlinkage void sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
127 sigset_t set; 127 sigset_t set;
128 stack_t st; 128 stack_t st;
129 s32 sp; 129 s32 sp;
130 int sig;
130 131
131 frame = (struct rt_sigframe_n32 __user *) regs.regs[29]; 132 frame = (struct rt_sigframe_n32 __user *) regs.regs[29];
132 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 133 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
@@ -140,8 +141,11 @@ asmlinkage void sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
140 recalc_sigpending(); 141 recalc_sigpending();
141 spin_unlock_irq(&current->sighand->siglock); 142 spin_unlock_irq(&current->sighand->siglock);
142 143
143 if (restore_sigcontext(&regs, &frame->rs_uc.uc_mcontext)) 144 sig = restore_sigcontext(&regs, &frame->rs_uc.uc_mcontext);
145 if (sig < 0)
144 goto badframe; 146 goto badframe;
147 else if (sig)
148 force_sig(sig, current);
145 149
146 /* The ucontext contains a stack32_t, so we must convert! */ 150 /* The ucontext contains a stack32_t, so we must convert! */
147 if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp)) 151 if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp))
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 18f56a9dbcf..7d76a85422b 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -610,16 +610,6 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)
610 if (fcr31 & FPU_CSR_UNI_X) { 610 if (fcr31 & FPU_CSR_UNI_X) {
611 int sig; 611 int sig;
612 612
613 preempt_disable();
614
615#ifdef CONFIG_PREEMPT
616 if (!is_fpu_owner()) {
617 /* We might lose fpu before disabling preempt... */
618 own_fpu();
619 BUG_ON(!used_math());
620 restore_fp(current);
621 }
622#endif
623 /* 613 /*
624 * Unimplemented operation exception. If we've got the full 614 * Unimplemented operation exception. If we've got the full
625 * software emulator on-board, let's use it... 615 * software emulator on-board, let's use it...
@@ -630,18 +620,12 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)
630 * register operands before invoking the emulator, which seems 620 * register operands before invoking the emulator, which seems
631 * a bit extreme for what should be an infrequent event. 621 * a bit extreme for what should be an infrequent event.
632 */ 622 */
633 save_fp(current);
634 /* Ensure 'resume' not overwrite saved fp context again. */ 623 /* Ensure 'resume' not overwrite saved fp context again. */
635 lose_fpu(); 624 lose_fpu(1);
636
637 preempt_enable();
638 625
639 /* Run the emulator */ 626 /* Run the emulator */
640 sig = fpu_emulator_cop1Handler (regs, &current->thread.fpu, 1); 627 sig = fpu_emulator_cop1Handler (regs, &current->thread.fpu, 1);
641 628
642 preempt_disable();
643
644 own_fpu(); /* Using the FPU again. */
645 /* 629 /*
646 * We can't allow the emulated instruction to leave any of 630 * We can't allow the emulated instruction to leave any of
647 * the cause bit set in $fcr31. 631 * the cause bit set in $fcr31.
@@ -649,9 +633,7 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)
649 current->thread.fpu.fcr31 &= ~FPU_CSR_ALL_X; 633 current->thread.fpu.fcr31 &= ~FPU_CSR_ALL_X;
650 634
651 /* Restore the hardware register state */ 635 /* Restore the hardware register state */
652 restore_fp(current); 636 own_fpu(1); /* Using the FPU again. */
653
654 preempt_enable();
655 637
656 /* If something went wrong, signal */ 638 /* If something went wrong, signal */
657 if (sig) 639 if (sig)
@@ -775,12 +757,11 @@ asmlinkage void do_cpu(struct pt_regs *regs)
775{ 757{
776 unsigned int cpid; 758 unsigned int cpid;
777 759
778 die_if_kernel("do_cpu invoked from kernel context!", regs);
779
780 cpid = (regs->cp0_cause >> CAUSEB_CE) & 3; 760 cpid = (regs->cp0_cause >> CAUSEB_CE) & 3;
781 761
782 switch (cpid) { 762 switch (cpid) {
783 case 0: 763 case 0:
764 die_if_kernel("do_cpu invoked from kernel context!", regs);
784 if (!cpu_has_llsc) 765 if (!cpu_has_llsc)
785 if (!simulate_llsc(regs)) 766 if (!simulate_llsc(regs))
786 return; 767 return;
@@ -791,21 +772,30 @@ asmlinkage void do_cpu(struct pt_regs *regs)
791 break; 772 break;
792 773
793 case 1: 774 case 1:
794 preempt_disable(); 775 if (!test_thread_flag(TIF_ALLOW_FP_IN_KERNEL))
795 776 die_if_kernel("do_cpu invoked from kernel context!",
796 own_fpu(); 777 regs);
797 if (used_math()) { /* Using the FPU again. */ 778 if (used_math()) /* Using the FPU again. */
798 restore_fp(current); 779 own_fpu(1);
799 } else { /* First time FPU user. */ 780 else { /* First time FPU user. */
800 init_fpu(); 781 init_fpu();
801 set_used_math(); 782 set_used_math();
802 } 783 }
803 784
804 if (cpu_has_fpu) { 785 if (raw_cpu_has_fpu) {
805 preempt_enable(); 786 if (test_thread_flag(TIF_ALLOW_FP_IN_KERNEL)) {
787 local_irq_disable();
788 if (cpu_has_fpu)
789 regs->cp0_status |= ST0_CU1;
790 /*
791 * We must return without enabling
792 * interrupts to ensure keep FPU
793 * ownership until resume.
794 */
795 return;
796 }
806 } else { 797 } else {
807 int sig; 798 int sig;
808 preempt_enable();
809 sig = fpu_emulator_cop1Handler(regs, 799 sig = fpu_emulator_cop1Handler(regs,
810 &current->thread.fpu, 0); 800 &current->thread.fpu, 0);
811 if (sig) 801 if (sig)
@@ -1259,26 +1249,26 @@ static inline void mips_srs_init(void)
1259/* 1249/*
1260 * This is used by native signal handling 1250 * This is used by native signal handling
1261 */ 1251 */
1262asmlinkage int (*save_fp_context)(struct sigcontext *sc); 1252asmlinkage int (*save_fp_context)(struct sigcontext __user *sc);
1263asmlinkage int (*restore_fp_context)(struct sigcontext *sc); 1253asmlinkage int (*restore_fp_context)(struct sigcontext __user *sc);
1264 1254
1265extern asmlinkage int _save_fp_context(struct sigcontext *sc); 1255extern asmlinkage int _save_fp_context(struct sigcontext __user *sc);
1266extern asmlinkage int _restore_fp_context(struct sigcontext *sc); 1256extern asmlinkage int _restore_fp_context(struct sigcontext __user *sc);
1267 1257
1268extern asmlinkage int fpu_emulator_save_context(struct sigcontext *sc); 1258extern asmlinkage int fpu_emulator_save_context(struct sigcontext __user *sc);
1269extern asmlinkage int fpu_emulator_restore_context(struct sigcontext *sc); 1259extern asmlinkage int fpu_emulator_restore_context(struct sigcontext __user *sc);
1270 1260
1271#ifdef CONFIG_SMP 1261#ifdef CONFIG_SMP
1272static int smp_save_fp_context(struct sigcontext *sc) 1262static int smp_save_fp_context(struct sigcontext __user *sc)
1273{ 1263{
1274 return cpu_has_fpu 1264 return raw_cpu_has_fpu
1275 ? _save_fp_context(sc) 1265 ? _save_fp_context(sc)
1276 : fpu_emulator_save_context(sc); 1266 : fpu_emulator_save_context(sc);
1277} 1267}
1278 1268
1279static int smp_restore_fp_context(struct sigcontext *sc) 1269static int smp_restore_fp_context(struct sigcontext __user *sc)
1280{ 1270{
1281 return cpu_has_fpu 1271 return raw_cpu_has_fpu
1282 ? _restore_fp_context(sc) 1272 ? _restore_fp_context(sc)
1283 : fpu_emulator_restore_context(sc); 1273 : fpu_emulator_restore_context(sc);
1284} 1274}
@@ -1306,14 +1296,14 @@ static inline void signal_init(void)
1306/* 1296/*
1307 * This is used by 32-bit signal stuff on the 64-bit kernel 1297 * This is used by 32-bit signal stuff on the 64-bit kernel
1308 */ 1298 */
1309asmlinkage int (*save_fp_context32)(struct sigcontext32 *sc); 1299asmlinkage int (*save_fp_context32)(struct sigcontext32 __user *sc);
1310asmlinkage int (*restore_fp_context32)(struct sigcontext32 *sc); 1300asmlinkage int (*restore_fp_context32)(struct sigcontext32 __user *sc);
1311 1301
1312extern asmlinkage int _save_fp_context32(struct sigcontext32 *sc); 1302extern asmlinkage int _save_fp_context32(struct sigcontext32 __user *sc);
1313extern asmlinkage int _restore_fp_context32(struct sigcontext32 *sc); 1303extern asmlinkage int _restore_fp_context32(struct sigcontext32 __user *sc);
1314 1304
1315extern asmlinkage int fpu_emulator_save_context32(struct sigcontext32 *sc); 1305extern asmlinkage int fpu_emulator_save_context32(struct sigcontext32 __user *sc);
1316extern asmlinkage int fpu_emulator_restore_context32(struct sigcontext32 *sc); 1306extern asmlinkage int fpu_emulator_restore_context32(struct sigcontext32 __user *sc);
1317 1307
1318static inline void signal32_init(void) 1308static inline void signal32_init(void)
1319{ 1309{
diff --git a/arch/mips/math-emu/kernel_linkage.c b/arch/mips/math-emu/kernel_linkage.c
index 5b3390f6491..ed49ef01ac5 100644
--- a/arch/mips/math-emu/kernel_linkage.c
+++ b/arch/mips/math-emu/kernel_linkage.c
@@ -51,7 +51,7 @@ void fpu_emulator_init_fpu(void)
51 * with appropriate macros from uaccess.h 51 * with appropriate macros from uaccess.h
52 */ 52 */
53 53
54int fpu_emulator_save_context(struct sigcontext *sc) 54int fpu_emulator_save_context(struct sigcontext __user *sc)
55{ 55{
56 int i; 56 int i;
57 int err = 0; 57 int err = 0;
@@ -65,7 +65,7 @@ int fpu_emulator_save_context(struct sigcontext *sc)
65 return err; 65 return err;
66} 66}
67 67
68int fpu_emulator_restore_context(struct sigcontext *sc) 68int fpu_emulator_restore_context(struct sigcontext __user *sc)
69{ 69{
70 int i; 70 int i;
71 int err = 0; 71 int err = 0;
@@ -84,7 +84,7 @@ int fpu_emulator_restore_context(struct sigcontext *sc)
84 * This is the o32 version 84 * This is the o32 version
85 */ 85 */
86 86
87int fpu_emulator_save_context32(struct sigcontext32 *sc) 87int fpu_emulator_save_context32(struct sigcontext32 __user *sc)
88{ 88{
89 int i; 89 int i;
90 int err = 0; 90 int err = 0;
@@ -98,7 +98,7 @@ int fpu_emulator_save_context32(struct sigcontext32 *sc)
98 return err; 98 return err;
99} 99}
100 100
101int fpu_emulator_restore_context32(struct sigcontext32 *sc) 101int fpu_emulator_restore_context32(struct sigcontext32 __user *sc)
102{ 102{
103 int i; 103 int i;
104 int err = 0; 104 int err = 0;