aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/math-emu
diff options
context:
space:
mode:
authorMarkos Chandras <markos.chandras@imgtec.com>2014-11-25 11:02:23 -0500
committerMarkos Chandras <markos.chandras@imgtec.com>2015-02-17 10:37:32 -0500
commit319824eabc3f1c1aab67f408d66f384fbb996ee2 (patch)
tree260bbaa71db86705f735b6c9e45bf32aad95c420 /arch/mips/math-emu
parent5f9f41c474befb4ebbc40b27f65bb7d649241581 (diff)
MIPS: kernel: branch: Do not emulate the branch likelies on MIPS R6
MIPS R6 removed the BLTZL, BGEZL, BLTZAL, BGEZAL, BEQL, BNEL, BLEZL, BGTZL branch likely instructions so we must not try to emulate them on MIPS R6 if the R2-to-R6 emulator is not present. Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Diffstat (limited to 'arch/mips/math-emu')
-rw-r--r--arch/mips/math-emu/cp1emu.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c
index 9bf82117b4f2..7bbaefe0434d 100644
--- a/arch/mips/math-emu/cp1emu.c
+++ b/arch/mips/math-emu/cp1emu.c
@@ -459,12 +459,18 @@ static int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
459 switch (insn.i_format.rt) { 459 switch (insn.i_format.rt) {
460 case bltzal_op: 460 case bltzal_op:
461 case bltzall_op: 461 case bltzall_op:
462 if (NO_R6EMU && (insn.i_format.rs ||
463 insn.i_format.rt == bltzall_op))
464 break;
465
462 regs->regs[31] = regs->cp0_epc + 466 regs->regs[31] = regs->cp0_epc +
463 dec_insn.pc_inc + 467 dec_insn.pc_inc +
464 dec_insn.next_pc_inc; 468 dec_insn.next_pc_inc;
465 /* Fall through */ 469 /* Fall through */
466 case bltz_op:
467 case bltzl_op: 470 case bltzl_op:
471 if (NO_R6EMU)
472 break;
473 case bltz_op:
468 if ((long)regs->regs[insn.i_format.rs] < 0) 474 if ((long)regs->regs[insn.i_format.rs] < 0)
469 *contpc = regs->cp0_epc + 475 *contpc = regs->cp0_epc +
470 dec_insn.pc_inc + 476 dec_insn.pc_inc +
@@ -476,12 +482,18 @@ static int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
476 return 1; 482 return 1;
477 case bgezal_op: 483 case bgezal_op:
478 case bgezall_op: 484 case bgezall_op:
485 if (NO_R6EMU && (insn.i_format.rs ||
486 insn.i_format.rt == bgezall_op))
487 break;
488
479 regs->regs[31] = regs->cp0_epc + 489 regs->regs[31] = regs->cp0_epc +
480 dec_insn.pc_inc + 490 dec_insn.pc_inc +
481 dec_insn.next_pc_inc; 491 dec_insn.next_pc_inc;
482 /* Fall through */ 492 /* Fall through */
483 case bgez_op:
484 case bgezl_op: 493 case bgezl_op:
494 if (NO_R6EMU)
495 break;
496 case bgez_op:
485 if ((long)regs->regs[insn.i_format.rs] >= 0) 497 if ((long)regs->regs[insn.i_format.rs] >= 0)
486 *contpc = regs->cp0_epc + 498 *contpc = regs->cp0_epc +
487 dec_insn.pc_inc + 499 dec_insn.pc_inc +
@@ -508,8 +520,10 @@ static int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
508 /* Set microMIPS mode bit: XOR for jalx. */ 520 /* Set microMIPS mode bit: XOR for jalx. */
509 *contpc ^= bit; 521 *contpc ^= bit;
510 return 1; 522 return 1;
511 case beq_op:
512 case beql_op: 523 case beql_op:
524 if (NO_R6EMU)
525 break;
526 case beq_op:
513 if (regs->regs[insn.i_format.rs] == 527 if (regs->regs[insn.i_format.rs] ==
514 regs->regs[insn.i_format.rt]) 528 regs->regs[insn.i_format.rt])
515 *contpc = regs->cp0_epc + 529 *contpc = regs->cp0_epc +
@@ -520,8 +534,10 @@ static int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
520 dec_insn.pc_inc + 534 dec_insn.pc_inc +
521 dec_insn.next_pc_inc; 535 dec_insn.next_pc_inc;
522 return 1; 536 return 1;
523 case bne_op:
524 case bnel_op: 537 case bnel_op:
538 if (NO_R6EMU)
539 break;
540 case bne_op:
525 if (regs->regs[insn.i_format.rs] != 541 if (regs->regs[insn.i_format.rs] !=
526 regs->regs[insn.i_format.rt]) 542 regs->regs[insn.i_format.rt])
527 *contpc = regs->cp0_epc + 543 *contpc = regs->cp0_epc +
@@ -532,8 +548,10 @@ static int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
532 dec_insn.pc_inc + 548 dec_insn.pc_inc +
533 dec_insn.next_pc_inc; 549 dec_insn.next_pc_inc;
534 return 1; 550 return 1;
535 case blez_op:
536 case blezl_op: 551 case blezl_op:
552 if (NO_R6EMU)
553 break;
554 case blez_op:
537 if ((long)regs->regs[insn.i_format.rs] <= 0) 555 if ((long)regs->regs[insn.i_format.rs] <= 0)
538 *contpc = regs->cp0_epc + 556 *contpc = regs->cp0_epc +
539 dec_insn.pc_inc + 557 dec_insn.pc_inc +
@@ -543,8 +561,10 @@ static int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
543 dec_insn.pc_inc + 561 dec_insn.pc_inc +
544 dec_insn.next_pc_inc; 562 dec_insn.next_pc_inc;
545 return 1; 563 return 1;
546 case bgtz_op:
547 case bgtzl_op: 564 case bgtzl_op:
565 if (NO_R6EMU)
566 break;
567 case bgtz_op:
548 if ((long)regs->regs[insn.i_format.rs] > 0) 568 if ((long)regs->regs[insn.i_format.rs] > 0)
549 *contpc = regs->cp0_epc + 569 *contpc = regs->cp0_epc +
550 dec_insn.pc_inc + 570 dec_insn.pc_inc +