diff options
author | Steven J. Hill <Steven.Hill@imgtec.com> | 2013-03-25 14:45:19 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2013-05-09 11:55:20 -0400 |
commit | 8508488fe7028b95bc86c7447c205fbc765cc4cf (patch) | |
tree | d1d10ce3f94efb5ade53e3aaa09d1c0c31afd3a4 /arch/mips/include | |
parent | cd574704ec06904c7b7dd2c897fea5a54f944a95 (diff) |
MIPS: MIPS16e: Support handling of delay slots.
Add logic needed to properly calculate exceptions for delay slots
when in MIPS16e mode.
Signed-off-by: Steven J. Hill <Steven.Hill@imgtec.com>
Diffstat (limited to 'arch/mips/include')
-rw-r--r-- | arch/mips/include/asm/branch.h | 18 | ||||
-rw-r--r-- | arch/mips/include/asm/inst.h | 3 |
2 files changed, 21 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); | |||
16 | extern int __compute_return_epc_for_insn(struct pt_regs *regs, | 16 | extern int __compute_return_epc_for_insn(struct pt_regs *regs, |
17 | union mips_instruction insn); | 17 | union mips_instruction insn); |
18 | extern int __microMIPS_compute_return_epc(struct pt_regs *regs); | 18 | extern int __microMIPS_compute_return_epc(struct pt_regs *regs); |
19 | extern int __MIPS16e_compute_return_epc(struct pt_regs *regs); | ||
19 | 20 | ||
20 | 21 | ||
21 | static inline int delay_slot(struct pt_regs *regs) | 22 | static 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 | ||
58 | static 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 */ |
diff --git a/arch/mips/include/asm/inst.h b/arch/mips/include/asm/inst.h index b27091e676c1..22912f78401c 100644 --- a/arch/mips/include/asm/inst.h +++ b/arch/mips/include/asm/inst.h | |||
@@ -82,4 +82,7 @@ struct mm_decoded_insn { | |||
82 | int micro_mips_mode; | 82 | int micro_mips_mode; |
83 | }; | 83 | }; |
84 | 84 | ||
85 | /* Recode table from 16-bit register notation to 32-bit GPR. Do NOT export!!! */ | ||
86 | extern const int reg16to32[]; | ||
87 | |||
85 | #endif /* _ASM_INST_H */ | 88 | #endif /* _ASM_INST_H */ |