2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 1996, 1997, 1998, 2001 by Ralf Baechle
11 #include <asm/ptrace.h>
14 extern int __isa_exception_epc(struct pt_regs
*regs
);
15 extern int __compute_return_epc(struct pt_regs
*regs
);
16 extern int __compute_return_epc_for_insn(struct pt_regs
*regs
,
17 union mips_instruction insn
);
18 extern int __microMIPS_compute_return_epc(struct pt_regs
*regs
);
19 extern int __MIPS16e_compute_return_epc(struct pt_regs
*regs
);
22 static inline int delay_slot(struct pt_regs
*regs
)
24 return regs
->cp0_cause
& CAUSEF_BD
;
27 static inline unsigned long exception_epc(struct pt_regs
*regs
)
29 if (likely(!delay_slot(regs
)))
32 if (get_isa16_mode(regs
->cp0_epc
))
33 return __isa_exception_epc(regs
);
35 return regs
->cp0_epc
+ 4;
38 #define BRANCH_LIKELY_TAKEN 0x0001
40 static inline int compute_return_epc(struct pt_regs
*regs
)
42 if (get_isa16_mode(regs
->cp0_epc
)) {
44 return __microMIPS_compute_return_epc(regs
);
46 return __MIPS16e_compute_return_epc(regs
);
50 if (!delay_slot(regs
)) {
55 return __compute_return_epc(regs
);
58 static inline int MIPS16e_compute_return_epc(struct pt_regs
*regs
,
59 union mips16e_instruction
*inst
)
61 if (likely(!delay_slot(regs
))) {
62 if (inst
->ri
.opcode
== MIPS16e_extend_op
) {
70 return __MIPS16e_compute_return_epc(regs
);
73 #endif /* _ASM_BRANCH_H */