/* (microMIPS) Convert 16-bit register encoding to 32-bit register encoding. */
static const unsigned int reg16to32map[8] = {16, 17, 2, 3, 4, 5, 6, 7};
-int __mm_isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
- unsigned long *contpc)
+int __mm_isBranchInstr(struct pt_regs *regs,
+ const struct mm_decoded_insn * const dec_insn, unsigned long *contpc)
{
- union mips_instruction insn = (union mips_instruction)dec_insn.insn;
+ union mips_instruction insn = (union mips_instruction)dec_insn->insn;
int bc_false = 0;
unsigned int fcr31;
unsigned int bit;
if (insn.mm_i_format.rt != 0) /* Not mm_jr */
regs->regs[insn.mm_i_format.rt] =
regs->cp0_epc +
- dec_insn.pc_inc +
- dec_insn.next_pc_inc;
+ dec_insn->pc_inc +
+ dec_insn->next_pc_inc;
*contpc = regs->regs[insn.mm_i_format.rs];
return 1;
}
case mm_bltzals_op:
case mm_bltzal_op:
regs->regs[31] = regs->cp0_epc +
- dec_insn.pc_inc +
- dec_insn.next_pc_inc;
+ dec_insn->pc_inc +
+ dec_insn->next_pc_inc;
/* Fall through */
case mm_bltz_op:
if ((long)regs->regs[insn.mm_i_format.rs] < 0)
*contpc = regs->cp0_epc +
- dec_insn.pc_inc +
+ dec_insn->pc_inc +
(insn.mm_i_format.simmediate << 1);
else
*contpc = regs->cp0_epc +
- dec_insn.pc_inc +
- dec_insn.next_pc_inc;
+ dec_insn->pc_inc +
+ dec_insn->next_pc_inc;
return 1;
case mm_bgezals_op:
case mm_bgezal_op:
regs->regs[31] = regs->cp0_epc +
- dec_insn.pc_inc +
- dec_insn.next_pc_inc;
+ dec_insn->pc_inc +
+ dec_insn->next_pc_inc;
/* Fall through */
case mm_bgez_op:
if ((long)regs->regs[insn.mm_i_format.rs] >= 0)
*contpc = regs->cp0_epc +
- dec_insn.pc_inc +
+ dec_insn->pc_inc +
(insn.mm_i_format.simmediate << 1);
else
*contpc = regs->cp0_epc +
- dec_insn.pc_inc +
- dec_insn.next_pc_inc;
+ dec_insn->pc_inc +
+ dec_insn->next_pc_inc;
return 1;
case mm_blez_op:
if ((long)regs->regs[insn.mm_i_format.rs] <= 0)
*contpc = regs->cp0_epc +
- dec_insn.pc_inc +
+ dec_insn->pc_inc +
(insn.mm_i_format.simmediate << 1);
else
*contpc = regs->cp0_epc +
- dec_insn.pc_inc +
- dec_insn.next_pc_inc;
+ dec_insn->pc_inc +
+ dec_insn->next_pc_inc;
return 1;
case mm_bgtz_op:
if ((long)regs->regs[insn.mm_i_format.rs] <= 0)
*contpc = regs->cp0_epc +
- dec_insn.pc_inc +
+ dec_insn->pc_inc +
(insn.mm_i_format.simmediate << 1);
else
*contpc = regs->cp0_epc +
- dec_insn.pc_inc +
- dec_insn.next_pc_inc;
+ dec_insn->pc_inc +
+ dec_insn->next_pc_inc;
return 1;
case mm_bc2f_op:
case mm_bc1f_op:
bit += 23;
if (fcr31 & (1 << bit))
*contpc = regs->cp0_epc +
- dec_insn.pc_inc +
+ dec_insn->pc_inc +
(insn.mm_i_format.simmediate << 1);
else
*contpc = regs->cp0_epc +
- dec_insn.pc_inc + dec_insn.next_pc_inc;
+ dec_insn->pc_inc + dec_insn->next_pc_inc;
return 1;
}
break;
case mm_jalr16_op:
case mm_jalrs16_op:
regs->regs[31] = regs->cp0_epc +
- dec_insn.pc_inc + dec_insn.next_pc_inc;
+ dec_insn->pc_inc + dec_insn->next_pc_inc;
/* Fall through */
case mm_jr16_op:
*contpc = regs->regs[insn.mm_i_format.rs];
case mm_beqz16_op:
if ((long)regs->regs[reg16to32map[insn.mm_b1_format.rs]] == 0)
*contpc = regs->cp0_epc +
- dec_insn.pc_inc +
+ dec_insn->pc_inc +
(insn.mm_b1_format.simmediate << 1);
else
*contpc = regs->cp0_epc +
- dec_insn.pc_inc + dec_insn.next_pc_inc;
+ dec_insn->pc_inc + dec_insn->next_pc_inc;
return 1;
case mm_bnez16_op:
if ((long)regs->regs[reg16to32map[insn.mm_b1_format.rs]] != 0)
*contpc = regs->cp0_epc +
- dec_insn.pc_inc +
+ dec_insn->pc_inc +
(insn.mm_b1_format.simmediate << 1);
else
*contpc = regs->cp0_epc +
- dec_insn.pc_inc + dec_insn.next_pc_inc;
+ dec_insn->pc_inc + dec_insn->next_pc_inc;
return 1;
case mm_b16_op:
- *contpc = regs->cp0_epc + dec_insn.pc_inc +
+ *contpc = regs->cp0_epc + dec_insn->pc_inc +
(insn.mm_b0_format.simmediate << 1);
return 1;
case mm_beq32_op:
if (regs->regs[insn.mm_i_format.rs] ==
regs->regs[insn.mm_i_format.rt])
*contpc = regs->cp0_epc +
- dec_insn.pc_inc +
+ dec_insn->pc_inc +
(insn.mm_i_format.simmediate << 1);
else
*contpc = regs->cp0_epc +
- dec_insn.pc_inc +
- dec_insn.next_pc_inc;
+ dec_insn->pc_inc +
+ dec_insn->next_pc_inc;
return 1;
case mm_bne32_op:
if (regs->regs[insn.mm_i_format.rs] !=
regs->regs[insn.mm_i_format.rt])
*contpc = regs->cp0_epc +
- dec_insn.pc_inc +
+ dec_insn->pc_inc +
(insn.mm_i_format.simmediate << 1);
else
*contpc = regs->cp0_epc +
- dec_insn.pc_inc + dec_insn.next_pc_inc;
+ dec_insn->pc_inc + dec_insn->next_pc_inc;
return 1;
case mm_jalx32_op:
regs->regs[31] = regs->cp0_epc +
- dec_insn.pc_inc + dec_insn.next_pc_inc;
- *contpc = regs->cp0_epc + dec_insn.pc_inc;
+ dec_insn->pc_inc + dec_insn->next_pc_inc;
+ *contpc = regs->cp0_epc + dec_insn->pc_inc;
*contpc >>= 28;
*contpc <<= 28;
*contpc |= (insn.j_format.target << 2);
case mm_jals32_op:
case mm_jal32_op:
regs->regs[31] = regs->cp0_epc +
- dec_insn.pc_inc + dec_insn.next_pc_inc;
+ dec_insn->pc_inc + dec_insn->next_pc_inc;
/* Fall through */
case mm_j32_op:
- *contpc = regs->cp0_epc + dec_insn.pc_inc;
+ *contpc = regs->cp0_epc + dec_insn->pc_inc;
*contpc >>= 27;
*contpc <<= 27;
*contpc |= (insn.j_format.target << 1);
}
mminsn.next_insn = word;
- mm_isBranchInstr(regs, mminsn, &contpc);
+ mm_isBranchInstr(regs, &mminsn, &contpc);
regs->cp0_epc = contpc;
* a single subroutine should be used across both
* modules.
*/
-static int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
- unsigned long *contpc)
+static int isBranchInstr(struct pt_regs *regs,
+ const struct mm_decoded_insn * const dec_insn, unsigned long *contpc)
{
- union mips_instruction insn = (union mips_instruction)dec_insn.insn;
+ union mips_instruction insn = (union mips_instruction)dec_insn->insn;
unsigned int fcr31;
unsigned int bit = 0;
switch (insn.r_format.func) {
case jalr_op:
regs->regs[insn.r_format.rd] =
- regs->cp0_epc + dec_insn.pc_inc +
- dec_insn.next_pc_inc;
+ regs->cp0_epc + dec_insn->pc_inc +
+ dec_insn->next_pc_inc;
/* Fall through */
case jr_op:
*contpc = regs->regs[insn.r_format.rs];
case bltzal_op:
case bltzall_op:
regs->regs[31] = regs->cp0_epc +
- dec_insn.pc_inc +
- dec_insn.next_pc_inc;
+ dec_insn->pc_inc +
+ dec_insn->next_pc_inc;
/* Fall through */
case bltz_op:
case bltzl_op:
if ((long)regs->regs[insn.i_format.rs] < 0)
*contpc = regs->cp0_epc +
- dec_insn.pc_inc +
+ dec_insn->pc_inc +
(insn.i_format.simmediate << 2);
else
*contpc = regs->cp0_epc +
- dec_insn.pc_inc +
- dec_insn.next_pc_inc;
+ dec_insn->pc_inc +
+ dec_insn->next_pc_inc;
return 1;
case bgezal_op:
case bgezall_op:
regs->regs[31] = regs->cp0_epc +
- dec_insn.pc_inc +
- dec_insn.next_pc_inc;
+ dec_insn->pc_inc +
+ dec_insn->next_pc_inc;
/* Fall through */
case bgez_op:
case bgezl_op:
if ((long)regs->regs[insn.i_format.rs] >= 0)
*contpc = regs->cp0_epc +
- dec_insn.pc_inc +
+ dec_insn->pc_inc +
(insn.i_format.simmediate << 2);
else
*contpc = regs->cp0_epc +
- dec_insn.pc_inc +
- dec_insn.next_pc_inc;
+ dec_insn->pc_inc +
+ dec_insn->next_pc_inc;
return 1;
}
break;
set_isa16_mode(bit);
case jal_op:
regs->regs[31] = regs->cp0_epc +
- dec_insn.pc_inc +
- dec_insn.next_pc_inc;
+ dec_insn->pc_inc +
+ dec_insn->next_pc_inc;
/* Fall through */
case j_op:
- *contpc = regs->cp0_epc + dec_insn.pc_inc;
+ *contpc = regs->cp0_epc + dec_insn->pc_inc;
*contpc >>= 28;
*contpc <<= 28;
*contpc |= (insn.j_format.target << 2);
if (regs->regs[insn.i_format.rs] ==
regs->regs[insn.i_format.rt])
*contpc = regs->cp0_epc +
- dec_insn.pc_inc +
+ dec_insn->pc_inc +
(insn.i_format.simmediate << 2);
else
*contpc = regs->cp0_epc +
- dec_insn.pc_inc +
- dec_insn.next_pc_inc;
+ dec_insn->pc_inc +
+ dec_insn->next_pc_inc;
return 1;
case bne_op:
case bnel_op:
if (regs->regs[insn.i_format.rs] !=
regs->regs[insn.i_format.rt])
*contpc = regs->cp0_epc +
- dec_insn.pc_inc +
+ dec_insn->pc_inc +
(insn.i_format.simmediate << 2);
else
*contpc = regs->cp0_epc +
- dec_insn.pc_inc +
- dec_insn.next_pc_inc;
+ dec_insn->pc_inc +
+ dec_insn->next_pc_inc;
return 1;
case blez_op:
case blezl_op:
if ((long)regs->regs[insn.i_format.rs] <= 0)
*contpc = regs->cp0_epc +
- dec_insn.pc_inc +
+ dec_insn->pc_inc +
(insn.i_format.simmediate << 2);
else
*contpc = regs->cp0_epc +
- dec_insn.pc_inc +
- dec_insn.next_pc_inc;
+ dec_insn->pc_inc +
+ dec_insn->next_pc_inc;
return 1;
case bgtz_op:
case bgtzl_op:
if ((long)regs->regs[insn.i_format.rs] > 0)
*contpc = regs->cp0_epc +
- dec_insn.pc_inc +
+ dec_insn->pc_inc +
(insn.i_format.simmediate << 2);
else
*contpc = regs->cp0_epc +
- dec_insn.pc_inc +
- dec_insn.next_pc_inc;
+ dec_insn->pc_inc +
+ dec_insn->next_pc_inc;
return 1;
#ifdef CONFIG_CPU_CAVIUM_OCTEON
case lwc2_op: /* This is bbit0 on Octeon */
case 2: /* bc1fl */
if (~fcr31 & (1 << bit))
*contpc = regs->cp0_epc +
- dec_insn.pc_inc +
+ dec_insn->pc_inc +
(insn.i_format.simmediate << 2);
else
*contpc = regs->cp0_epc +
- dec_insn.pc_inc +
- dec_insn.next_pc_inc;
+ dec_insn->pc_inc +
+ dec_insn->next_pc_inc;
return 1;
case 1: /* bc1t */
case 3: /* bc1tl */
if (fcr31 & (1 << bit))
*contpc = regs->cp0_epc +
- dec_insn.pc_inc +
+ dec_insn->pc_inc +
(insn.i_format.simmediate << 2);
else
*contpc = regs->cp0_epc +
- dec_insn.pc_inc +
- dec_insn.next_pc_inc;
+ dec_insn->pc_inc +
+ dec_insn->next_pc_inc;
return 1;
}
}
/* XXX NEC Vr54xx bug workaround */
if (delay_slot(xcp)) {
if (dec_insn.micro_mips_mode) {
- if (!mm_isBranchInstr(xcp, dec_insn, &contpc))
+ if (!mm_isBranchInstr(xcp, &dec_insn, &contpc))
clear_delay_slot(xcp);
} else {
- if (!isBranchInstr(xcp, dec_insn, &contpc))
+ if (!isBranchInstr(xcp, &dec_insn, &contpc))
clear_delay_slot(xcp);
}
}