GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / arch / mips / include / asm / branch.h
blobec5e5ba5029159773f324471459dadd97ceb0a42
1 /*
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
4 * for more details.
6 * Copyright (C) 1996, 1997, 1998, 2001 by Ralf Baechle
7 */
8 #ifndef _ASM_BRANCH_H
9 #define _ASM_BRANCH_H
11 #include <asm/ptrace.h>
12 #include <asm/inst.h>
14 static inline int delay_slot(struct pt_regs *regs)
16 return regs->cp0_cause & CAUSEF_BD;
19 extern int __isa_exception_epc(struct pt_regs *regs);
21 static inline unsigned long exception_epc(struct pt_regs *regs)
23 if (likely(!delay_slot(regs)))
24 return regs->cp0_epc;
26 if (is16mode(regs))
27 return __isa_exception_epc(regs);
29 return regs->cp0_epc + 4;
32 extern int __compute_return_epc(struct pt_regs *regs);
33 extern int __MIPS16e_compute_return_epc(struct pt_regs *regs);
34 extern int __microMIPS_compute_return_epc(struct pt_regs *regs);
36 /* only for MIPS32/64 but not 16bits variants */
37 static inline int compute_return_epc(struct pt_regs *regs)
39 if (is16mode(regs)) {
40 if (cpu_has_mips16)
41 return __MIPS16e_compute_return_epc(regs);
42 if (cpu_has_mmips)
43 return __microMIPS_compute_return_epc(regs);
44 return regs->cp0_epc;
47 if (!delay_slot(regs)) {
48 regs->cp0_epc += 4;
49 return 0;
52 return __compute_return_epc(regs);
55 static inline int MIPS16e_compute_return_epc(struct pt_regs *regs,
56 union mips16e_instruction *inst)
58 if (likely(!delay_slot(regs))) {
59 if (inst->ri.opcode == MIPS16e_extend_op) {
60 regs->cp0_epc += 4;
61 return 0;
63 regs->cp0_epc += 2;
64 return 0;
67 return __MIPS16e_compute_return_epc(regs);
70 #endif /* _ASM_BRANCH_H */