aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/include/asm/branch.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/include/asm/branch.h')
-rw-r--r--arch/mips/include/asm/branch.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/mips/include/asm/branch.h b/arch/mips/include/asm/branch.h
index 40bb9ebcc7aa..e28a3e0eb3cb 100644
--- a/arch/mips/include/asm/branch.h
+++ b/arch/mips/include/asm/branch.h
@@ -16,6 +16,7 @@ extern int __compute_return_epc(struct pt_regs *regs);
16extern int __compute_return_epc_for_insn(struct pt_regs *regs, 16extern int __compute_return_epc_for_insn(struct pt_regs *regs,
17 union mips_instruction insn); 17 union mips_instruction insn);
18extern int __microMIPS_compute_return_epc(struct pt_regs *regs); 18extern int __microMIPS_compute_return_epc(struct pt_regs *regs);
19extern int __MIPS16e_compute_return_epc(struct pt_regs *regs);
19 20
20 21
21static inline int delay_slot(struct pt_regs *regs) 22static inline int delay_slot(struct pt_regs *regs)
@@ -41,6 +42,8 @@ static inline int compute_return_epc(struct pt_regs *regs)
41 if (get_isa16_mode(regs->cp0_epc)) { 42 if (get_isa16_mode(regs->cp0_epc)) {
42 if (cpu_has_mmips) 43 if (cpu_has_mmips)
43 return __microMIPS_compute_return_epc(regs); 44 return __microMIPS_compute_return_epc(regs);
45 if (cpu_has_mips16)
46 return __MIPS16e_compute_return_epc(regs);
44 return regs->cp0_epc; 47 return regs->cp0_epc;
45 } 48 }
46 49
@@ -52,4 +55,19 @@ static inline int compute_return_epc(struct pt_regs *regs)
52 return __compute_return_epc(regs); 55 return __compute_return_epc(regs);
53} 56}
54 57
58static inline int MIPS16e_compute_return_epc(struct pt_regs *regs,
59 union mips16e_instruction *inst)
60{
61 if (likely(!delay_slot(regs))) {
62 if (inst->ri.opcode == MIPS16e_extend_op) {
63 regs->cp0_epc += 4;
64 return 0;
65 }
66 regs->cp0_epc += 2;
67 return 0;
68 }
69
70 return __MIPS16e_compute_return_epc(regs);
71}
72
55#endif /* _ASM_BRANCH_H */ 73#endif /* _ASM_BRANCH_H */