aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/unaligned.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2007-07-29 04:16:19 -0400
committerRalf Baechle <ralf@linux-mips.org>2007-07-31 16:35:30 -0400
commit7f18f151f474b11c0fb7f1c9b7bb59b6d04a6fc2 (patch)
tree013335bdff51adbb317d31b3ff233e0f6ff34621 /arch/mips/kernel/unaligned.c
parentc3dd8cdf8563ac46b27b0cacfda5e7e6b18c4a46 (diff)
[MIPS] Fix build warning in unaligned load/store emulator.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/unaligned.c')
-rw-r--r--arch/mips/kernel/unaligned.c51
1 files changed, 20 insertions, 31 deletions
diff --git a/arch/mips/kernel/unaligned.c b/arch/mips/kernel/unaligned.c
index 5565b89b98e6..d34b1fb3665d 100644
--- a/arch/mips/kernel/unaligned.c
+++ b/arch/mips/kernel/unaligned.c
@@ -101,16 +101,14 @@ static u32 unaligned_action;
101#endif 101#endif
102extern void show_registers(struct pt_regs *regs); 102extern void show_registers(struct pt_regs *regs);
103 103
104static inline int emulate_load_store_insn(struct pt_regs *regs, 104static void emulate_load_store_insn(struct pt_regs *regs,
105 void __user *addr, unsigned int __user *pc, 105 void __user *addr, unsigned int __user *pc)
106 unsigned long **regptr, unsigned long *newvalue)
107{ 106{
108 union mips_instruction insn; 107 union mips_instruction insn;
109 unsigned long value; 108 unsigned long value;
110 unsigned int res; 109 unsigned int res;
111 110
112 regs->regs[0] = 0; 111 regs->regs[0] = 0;
113 *regptr=NULL;
114 112
115 /* 113 /*
116 * This load never faults. 114 * This load never faults.
@@ -179,8 +177,8 @@ static inline int emulate_load_store_insn(struct pt_regs *regs,
179 : "r" (addr), "i" (-EFAULT)); 177 : "r" (addr), "i" (-EFAULT));
180 if (res) 178 if (res)
181 goto fault; 179 goto fault;
182 *newvalue = value; 180 compute_return_epc(regs);
183 *regptr = &regs->regs[insn.i_format.rt]; 181 regs->regs[insn.i_format.rt] = value;
184 break; 182 break;
185 183
186 case lw_op: 184 case lw_op:
@@ -209,8 +207,8 @@ static inline int emulate_load_store_insn(struct pt_regs *regs,
209 : "r" (addr), "i" (-EFAULT)); 207 : "r" (addr), "i" (-EFAULT));
210 if (res) 208 if (res)
211 goto fault; 209 goto fault;
212 *newvalue = value; 210 compute_return_epc(regs);
213 *regptr = &regs->regs[insn.i_format.rt]; 211 regs->regs[insn.i_format.rt] = value;
214 break; 212 break;
215 213
216 case lhu_op: 214 case lhu_op:
@@ -243,8 +241,8 @@ static inline int emulate_load_store_insn(struct pt_regs *regs,
243 : "r" (addr), "i" (-EFAULT)); 241 : "r" (addr), "i" (-EFAULT));
244 if (res) 242 if (res)
245 goto fault; 243 goto fault;
246 *newvalue = value; 244 compute_return_epc(regs);
247 *regptr = &regs->regs[insn.i_format.rt]; 245 regs->regs[insn.i_format.rt] = value;
248 break; 246 break;
249 247
250 case lwu_op: 248 case lwu_op:
@@ -283,8 +281,8 @@ static inline int emulate_load_store_insn(struct pt_regs *regs,
283 : "r" (addr), "i" (-EFAULT)); 281 : "r" (addr), "i" (-EFAULT));
284 if (res) 282 if (res)
285 goto fault; 283 goto fault;
286 *newvalue = value; 284 compute_return_epc(regs);
287 *regptr = &regs->regs[insn.i_format.rt]; 285 regs->regs[insn.i_format.rt] = value;
288 break; 286 break;
289#endif /* CONFIG_64BIT */ 287#endif /* CONFIG_64BIT */
290 288
@@ -325,8 +323,8 @@ static inline int emulate_load_store_insn(struct pt_regs *regs,
325 : "r" (addr), "i" (-EFAULT)); 323 : "r" (addr), "i" (-EFAULT));
326 if (res) 324 if (res)
327 goto fault; 325 goto fault;
328 *newvalue = value; 326 compute_return_epc(regs);
329 *regptr = &regs->regs[insn.i_format.rt]; 327 regs->regs[insn.i_format.rt] = value;
330 break; 328 break;
331#endif /* CONFIG_64BIT */ 329#endif /* CONFIG_64BIT */
332 330
@@ -367,6 +365,7 @@ static inline int emulate_load_store_insn(struct pt_regs *regs,
367 : "r" (value), "r" (addr), "i" (-EFAULT)); 365 : "r" (value), "r" (addr), "i" (-EFAULT));
368 if (res) 366 if (res)
369 goto fault; 367 goto fault;
368 compute_return_epc(regs);
370 break; 369 break;
371 370
372 case sw_op: 371 case sw_op:
@@ -397,6 +396,7 @@ static inline int emulate_load_store_insn(struct pt_regs *regs,
397 : "r" (value), "r" (addr), "i" (-EFAULT)); 396 : "r" (value), "r" (addr), "i" (-EFAULT));
398 if (res) 397 if (res)
399 goto fault; 398 goto fault;
399 compute_return_epc(regs);
400 break; 400 break;
401 401
402 case sd_op: 402 case sd_op:
@@ -435,6 +435,7 @@ static inline int emulate_load_store_insn(struct pt_regs *regs,
435 : "r" (value), "r" (addr), "i" (-EFAULT)); 435 : "r" (value), "r" (addr), "i" (-EFAULT));
436 if (res) 436 if (res)
437 goto fault; 437 goto fault;
438 compute_return_epc(regs);
438 break; 439 break;
439#endif /* CONFIG_64BIT */ 440#endif /* CONFIG_64BIT */
440 441
@@ -473,34 +474,31 @@ static inline int emulate_load_store_insn(struct pt_regs *regs,
473 unaligned_instructions++; 474 unaligned_instructions++;
474#endif 475#endif
475 476
476 return 0; 477 return;
477 478
478fault: 479fault:
479 /* Did we have an exception handler installed? */ 480 /* Did we have an exception handler installed? */
480 if (fixup_exception(regs)) 481 if (fixup_exception(regs))
481 return 1; 482 return;
482 483
483 die_if_kernel ("Unhandled kernel unaligned access", regs); 484 die_if_kernel ("Unhandled kernel unaligned access", regs);
484 send_sig(SIGSEGV, current, 1); 485 send_sig(SIGSEGV, current, 1);
485 486
486 return 0; 487 return;
487 488
488sigbus: 489sigbus:
489 die_if_kernel("Unhandled kernel unaligned access", regs); 490 die_if_kernel("Unhandled kernel unaligned access", regs);
490 send_sig(SIGBUS, current, 1); 491 send_sig(SIGBUS, current, 1);
491 492
492 return 0; 493 return;
493 494
494sigill: 495sigill:
495 die_if_kernel("Unhandled kernel unaligned access or invalid instruction", regs); 496 die_if_kernel("Unhandled kernel unaligned access or invalid instruction", regs);
496 send_sig(SIGILL, current, 1); 497 send_sig(SIGILL, current, 1);
497
498 return 0;
499} 498}
500 499
501asmlinkage void do_ade(struct pt_regs *regs) 500asmlinkage void do_ade(struct pt_regs *regs)
502{ 501{
503 unsigned long *regptr, newval;
504 extern int do_dsemulret(struct pt_regs *); 502 extern int do_dsemulret(struct pt_regs *);
505 unsigned int __user *pc; 503 unsigned int __user *pc;
506 mm_segment_t seg; 504 mm_segment_t seg;
@@ -538,16 +536,7 @@ asmlinkage void do_ade(struct pt_regs *regs)
538 seg = get_fs(); 536 seg = get_fs();
539 if (!user_mode(regs)) 537 if (!user_mode(regs))
540 set_fs(KERNEL_DS); 538 set_fs(KERNEL_DS);
541 if (!emulate_load_store_insn(regs, (void __user *)regs->cp0_badvaddr, pc, 539 emulate_load_store_insn(regs, (void __user *)regs->cp0_badvaddr, pc);
542 &regptr, &newval)) {
543 compute_return_epc(regs);
544 /*
545 * Now that branch is evaluated, update the dest
546 * register if necessary
547 */
548 if (regptr)
549 *regptr = newval;
550 }
551 set_fs(seg); 540 set_fs(seg);
552 541
553 return; 542 return;