aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mn10300
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2008-11-12 10:35:55 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-11-12 13:41:18 -0500
commit58a47481b6ecb6dd05ab4a788e1f2ae3c7c46f57 (patch)
tree2ffa67fd1236c9770418f9e5e7518ee7e098c535 /arch/mn10300
parentbd9384a9fdd6c15da6b01b2844c3471d07a45d64 (diff)
MN10300: Don't do misalignment handling for userspace
Don't do misalignment handling for userspace misalignment faults: just generate an appropriate SIGBUS instead. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/mn10300')
-rw-r--r--arch/mn10300/mm/misalignment.c52
1 files changed, 23 insertions, 29 deletions
diff --git a/arch/mn10300/mm/misalignment.c b/arch/mn10300/mm/misalignment.c
index 7b670a3d7659..94c4a4358065 100644
--- a/arch/mn10300/mm/misalignment.c
+++ b/arch/mn10300/mm/misalignment.c
@@ -329,10 +329,11 @@ asmlinkage void misalignment(struct pt_regs *regs, enum exception_code code)
329 void *address; 329 void *address;
330 unsigned tmp, npop, dispsz, loop; 330 unsigned tmp, npop, dispsz, loop;
331 331
332 /* we don't fix up userspace misalignment faults */
332 if (user_mode(regs)) 333 if (user_mode(regs))
333 sp = regs->sp; 334 goto bus_error;
334 else 335
335 sp = (unsigned long) regs + sizeof(*regs); 336 sp = (unsigned long) regs + sizeof(*regs);
336 337
337 kdebug("==>misalignment({pc=%lx,sp=%lx})", regs->pc, sp); 338 kdebug("==>misalignment({pc=%lx,sp=%lx})", regs->pc, sp);
338 339
@@ -386,15 +387,15 @@ asmlinkage void misalignment(struct pt_regs *regs, enum exception_code code)
386 } 387 }
387 388
388 /* didn't manage to find a fixup */ 389 /* didn't manage to find a fixup */
389 if (!user_mode(regs)) 390 printk(KERN_CRIT "MISALIGN: %lx: unsupported instruction %x\n",
390 printk(KERN_CRIT "MISALIGN: %lx: unsupported instruction %x\n", 391 regs->pc, opcode);
391 regs->pc, opcode);
392 392
393failed: 393failed:
394 set_fs(seg); 394 set_fs(seg);
395 if (die_if_no_fixup("misalignment error", regs, code)) 395 if (die_if_no_fixup("misalignment error", regs, code))
396 return; 396 return;
397 397
398bus_error:
398 info.si_signo = SIGBUS; 399 info.si_signo = SIGBUS;
399 info.si_errno = 0; 400 info.si_errno = 0;
400 info.si_code = BUS_ADRALN; 401 info.si_code = BUS_ADRALN;
@@ -404,31 +405,27 @@ failed:
404 405
405 /* error reading opcodes */ 406 /* error reading opcodes */
406fetch_error: 407fetch_error:
407 if (!user_mode(regs)) 408 printk(KERN_CRIT
408 printk(KERN_CRIT 409 "MISALIGN: %p: fault whilst reading instruction data\n",
409 "MISALIGN: %p: fault whilst reading instruction data\n", 410 pc);
410 pc);
411 goto failed; 411 goto failed;
412 412
413bad_addr_mode: 413bad_addr_mode:
414 if (!user_mode(regs)) 414 printk(KERN_CRIT
415 printk(KERN_CRIT 415 "MISALIGN: %lx: unsupported addressing mode %x\n",
416 "MISALIGN: %lx: unsupported addressing mode %x\n", 416 regs->pc, opcode);
417 regs->pc, opcode);
418 goto failed; 417 goto failed;
419 418
420bad_reg_mode: 419bad_reg_mode:
421 if (!user_mode(regs)) 420 printk(KERN_CRIT
422 printk(KERN_CRIT 421 "MISALIGN: %lx: unsupported register mode %x\n",
423 "MISALIGN: %lx: unsupported register mode %x\n", 422 regs->pc, opcode);
424 regs->pc, opcode);
425 goto failed; 423 goto failed;
426 424
427unsupported_instruction: 425unsupported_instruction:
428 if (!user_mode(regs)) 426 printk(KERN_CRIT
429 printk(KERN_CRIT 427 "MISALIGN: %lx: unsupported instruction %x (%s)\n",
430 "MISALIGN: %lx: unsupported instruction %x (%s)\n", 428 regs->pc, opcode, pop->name);
431 regs->pc, opcode, pop->name);
432 goto failed; 429 goto failed;
433 430
434transfer_failed: 431transfer_failed:
@@ -476,16 +473,14 @@ found_opcode:
476 kdebug("disp=%lx", disp); 473 kdebug("disp=%lx", disp);
477 474
478 set_fs(KERNEL_XDS); 475 set_fs(KERNEL_XDS);
479 if (fixup || regs->epsw & EPSW_nSL) 476 if (fixup)
480 set_fs(seg); 477 set_fs(seg);
481 478
482 tmp = (pop->params[0] ^ pop->params[1]) & 0x80000000; 479 tmp = (pop->params[0] ^ pop->params[1]) & 0x80000000;
483 if (!tmp) { 480 if (!tmp) {
484 if (!user_mode(regs)) 481 printk(KERN_CRIT
485 printk(KERN_CRIT 482 "MISALIGN: %lx: insn not move to/from memory %x\n",
486 "MISALIGN: %lx:" 483 regs->pc, opcode);
487 " insn not move to/from memory %x\n",
488 regs->pc, opcode);
489 goto failed; 484 goto failed;
490 } 485 }
491 486
@@ -548,7 +543,6 @@ found_opcode:
548 misalignment_MOV_Lcc(regs, opcode); 543 misalignment_MOV_Lcc(regs, opcode);
549 544
550 set_fs(seg); 545 set_fs(seg);
551 return;
552} 546}
553 547
554/* 548/*