aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/kernel/branch.c')
-rw-r--r--arch/mips/kernel/branch.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/arch/mips/kernel/branch.c b/arch/mips/kernel/branch.c
index d8f9b357b222..71e8f4c0b8da 100644
--- a/arch/mips/kernel/branch.c
+++ b/arch/mips/kernel/branch.c
@@ -399,7 +399,7 @@ int __MIPS16e_compute_return_epc(struct pt_regs *regs)
399 * 399 *
400 * @regs: Pointer to pt_regs 400 * @regs: Pointer to pt_regs
401 * @insn: branch instruction to decode 401 * @insn: branch instruction to decode
402 * @returns: -EFAULT on error and forces SIGBUS, and on success 402 * @returns: -EFAULT on error and forces SIGILL, and on success
403 * returns 0 or BRANCH_LIKELY_TAKEN as appropriate after 403 * returns 0 or BRANCH_LIKELY_TAKEN as appropriate after
404 * evaluating the branch. 404 * evaluating the branch.
405 * 405 *
@@ -431,7 +431,7 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
431 /* Fall through */ 431 /* Fall through */
432 case jr_op: 432 case jr_op:
433 if (NO_R6EMU && insn.r_format.func == jr_op) 433 if (NO_R6EMU && insn.r_format.func == jr_op)
434 goto sigill_r6; 434 goto sigill_r2r6;
435 regs->cp0_epc = regs->regs[insn.r_format.rs]; 435 regs->cp0_epc = regs->regs[insn.r_format.rs];
436 break; 436 break;
437 } 437 }
@@ -446,7 +446,7 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
446 switch (insn.i_format.rt) { 446 switch (insn.i_format.rt) {
447 case bltzl_op: 447 case bltzl_op:
448 if (NO_R6EMU) 448 if (NO_R6EMU)
449 goto sigill_r6; 449 goto sigill_r2r6;
450 case bltz_op: 450 case bltz_op:
451 if ((long)regs->regs[insn.i_format.rs] < 0) { 451 if ((long)regs->regs[insn.i_format.rs] < 0) {
452 epc = epc + 4 + (insn.i_format.simmediate << 2); 452 epc = epc + 4 + (insn.i_format.simmediate << 2);
@@ -459,7 +459,7 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
459 459
460 case bgezl_op: 460 case bgezl_op:
461 if (NO_R6EMU) 461 if (NO_R6EMU)
462 goto sigill_r6; 462 goto sigill_r2r6;
463 case bgez_op: 463 case bgez_op:
464 if ((long)regs->regs[insn.i_format.rs] >= 0) { 464 if ((long)regs->regs[insn.i_format.rs] >= 0) {
465 epc = epc + 4 + (insn.i_format.simmediate << 2); 465 epc = epc + 4 + (insn.i_format.simmediate << 2);
@@ -473,10 +473,8 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
473 case bltzal_op: 473 case bltzal_op:
474 case bltzall_op: 474 case bltzall_op:
475 if (NO_R6EMU && (insn.i_format.rs || 475 if (NO_R6EMU && (insn.i_format.rs ||
476 insn.i_format.rt == bltzall_op)) { 476 insn.i_format.rt == bltzall_op))
477 ret = -SIGILL; 477 goto sigill_r2r6;
478 break;
479 }
480 regs->regs[31] = epc + 8; 478 regs->regs[31] = epc + 8;
481 /* 479 /*
482 * OK we are here either because we hit a NAL 480 * OK we are here either because we hit a NAL
@@ -507,10 +505,8 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
507 case bgezal_op: 505 case bgezal_op:
508 case bgezall_op: 506 case bgezall_op:
509 if (NO_R6EMU && (insn.i_format.rs || 507 if (NO_R6EMU && (insn.i_format.rs ||
510 insn.i_format.rt == bgezall_op)) { 508 insn.i_format.rt == bgezall_op))
511 ret = -SIGILL; 509 goto sigill_r2r6;
512 break;
513 }
514 regs->regs[31] = epc + 8; 510 regs->regs[31] = epc + 8;
515 /* 511 /*
516 * OK we are here either because we hit a BAL 512 * OK we are here either because we hit a BAL
@@ -556,6 +552,7 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
556 /* 552 /*
557 * These are unconditional and in j_format. 553 * These are unconditional and in j_format.
558 */ 554 */
555 case jalx_op:
559 case jal_op: 556 case jal_op:
560 regs->regs[31] = regs->cp0_epc + 8; 557 regs->regs[31] = regs->cp0_epc + 8;
561 case j_op: 558 case j_op:
@@ -573,7 +570,7 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
573 */ 570 */
574 case beql_op: 571 case beql_op:
575 if (NO_R6EMU) 572 if (NO_R6EMU)
576 goto sigill_r6; 573 goto sigill_r2r6;
577 case beq_op: 574 case beq_op:
578 if (regs->regs[insn.i_format.rs] == 575 if (regs->regs[insn.i_format.rs] ==
579 regs->regs[insn.i_format.rt]) { 576 regs->regs[insn.i_format.rt]) {
@@ -587,7 +584,7 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
587 584
588 case bnel_op: 585 case bnel_op:
589 if (NO_R6EMU) 586 if (NO_R6EMU)
590 goto sigill_r6; 587 goto sigill_r2r6;
591 case bne_op: 588 case bne_op:
592 if (regs->regs[insn.i_format.rs] != 589 if (regs->regs[insn.i_format.rs] !=
593 regs->regs[insn.i_format.rt]) { 590 regs->regs[insn.i_format.rt]) {
@@ -601,7 +598,7 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
601 598
602 case blezl_op: /* not really i_format */ 599 case blezl_op: /* not really i_format */
603 if (!insn.i_format.rt && NO_R6EMU) 600 if (!insn.i_format.rt && NO_R6EMU)
604 goto sigill_r6; 601 goto sigill_r2r6;
605 case blez_op: 602 case blez_op:
606 /* 603 /*
607 * Compact branches for R6 for the 604 * Compact branches for R6 for the
@@ -636,7 +633,7 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
636 633
637 case bgtzl_op: 634 case bgtzl_op:
638 if (!insn.i_format.rt && NO_R6EMU) 635 if (!insn.i_format.rt && NO_R6EMU)
639 goto sigill_r6; 636 goto sigill_r2r6;
640 case bgtz_op: 637 case bgtz_op:
641 /* 638 /*
642 * Compact branches for R6 for the 639 * Compact branches for R6 for the
@@ -816,8 +813,10 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
816 break; 813 break;
817 } 814 }
818 /* Compact branch: BNEZC || JIALC */ 815 /* Compact branch: BNEZC || JIALC */
819 if (insn.i_format.rs) 816 if (!insn.i_format.rs) {
817 /* JIALC: set $31/ra */
820 regs->regs[31] = epc + 4; 818 regs->regs[31] = epc + 4;
819 }
821 regs->cp0_epc += 8; 820 regs->cp0_epc += 8;
822 break; 821 break;
823#endif 822#endif
@@ -841,11 +840,12 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
841 return ret; 840 return ret;
842 841
843sigill_dsp: 842sigill_dsp:
844 printk("%s: DSP branch but not DSP ASE - sending SIGBUS.\n", current->comm); 843 pr_info("%s: DSP branch but not DSP ASE - sending SIGILL.\n",
845 force_sig(SIGBUS, current); 844 current->comm);
845 force_sig(SIGILL, current);
846 return -EFAULT; 846 return -EFAULT;
847sigill_r6: 847sigill_r2r6:
848 pr_info("%s: R2 branch but r2-to-r6 emulator is not preset - sending SIGILL.\n", 848 pr_info("%s: R2 branch but r2-to-r6 emulator is not present - sending SIGILL.\n",
849 current->comm); 849 current->comm);
850 force_sig(SIGILL, current); 850 force_sig(SIGILL, current);
851 return -EFAULT; 851 return -EFAULT;