diff options
Diffstat (limited to 'arch/microblaze/include/asm/exceptions.h')
-rw-r--r-- | arch/microblaze/include/asm/exceptions.h | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/arch/microblaze/include/asm/exceptions.h b/arch/microblaze/include/asm/exceptions.h new file mode 100644 index 000000000000..24ca540e77c0 --- /dev/null +++ b/arch/microblaze/include/asm/exceptions.h | |||
@@ -0,0 +1,99 @@ | |||
1 | /* | ||
2 | * Preliminary support for HW exception handing for Microblaze | ||
3 | * | ||
4 | * Copyright (C) 2008 Michal Simek | ||
5 | * Copyright (C) 2008 PetaLogix | ||
6 | * Copyright (C) 2005 John Williams <jwilliams@itee.uq.edu.au> | ||
7 | * | ||
8 | * This file is subject to the terms and conditions of the GNU General | ||
9 | * Public License. See the file COPYING in the main directory of this | ||
10 | * archive for more details. | ||
11 | */ | ||
12 | |||
13 | #ifndef _ASM_MICROBLAZE_EXCEPTIONS_H | ||
14 | #define _ASM_MICROBLAZE_EXCEPTIONS_H | ||
15 | |||
16 | #ifdef __KERNEL__ | ||
17 | #ifndef __ASSEMBLY__ | ||
18 | |||
19 | /* Macros to enable and disable HW exceptions in the MSR */ | ||
20 | /* Define MSR enable bit for HW exceptions */ | ||
21 | #define HWEX_MSR_BIT (1 << 8) | ||
22 | |||
23 | #if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR | ||
24 | #define __enable_hw_exceptions() \ | ||
25 | __asm__ __volatile__ (" msrset r0, %0; \ | ||
26 | nop;" \ | ||
27 | : \ | ||
28 | : "i" (HWEX_MSR_BIT) \ | ||
29 | : "memory") | ||
30 | |||
31 | #define __disable_hw_exceptions() \ | ||
32 | __asm__ __volatile__ (" msrclr r0, %0; \ | ||
33 | nop;" \ | ||
34 | : \ | ||
35 | : "i" (HWEX_MSR_BIT) \ | ||
36 | : "memory") | ||
37 | #else /* !CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */ | ||
38 | #define __enable_hw_exceptions() \ | ||
39 | __asm__ __volatile__ (" \ | ||
40 | mfs r12, rmsr; \ | ||
41 | nop; \ | ||
42 | ori r12, r12, %0; \ | ||
43 | mts rmsr, r12; \ | ||
44 | nop;" \ | ||
45 | : \ | ||
46 | : "i" (HWEX_MSR_BIT) \ | ||
47 | : "memory", "r12") | ||
48 | |||
49 | #define __disable_hw_exceptions() \ | ||
50 | __asm__ __volatile__ (" \ | ||
51 | mfs r12, rmsr; \ | ||
52 | nop; \ | ||
53 | andi r12, r12, ~%0; \ | ||
54 | mts rmsr, r12; \ | ||
55 | nop;" \ | ||
56 | : \ | ||
57 | : "i" (HWEX_MSR_BIT) \ | ||
58 | : "memory", "r12") | ||
59 | #endif /* CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */ | ||
60 | |||
61 | asmlinkage void full_exception(struct pt_regs *regs, unsigned int type, | ||
62 | int fsr, int addr); | ||
63 | |||
64 | void die(const char *str, struct pt_regs *fp, long err); | ||
65 | void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr); | ||
66 | |||
67 | #if defined(CONFIG_XMON) | ||
68 | extern void xmon(struct pt_regs *regs); | ||
69 | extern int xmon_bpt(struct pt_regs *regs); | ||
70 | extern int xmon_sstep(struct pt_regs *regs); | ||
71 | extern int xmon_iabr_match(struct pt_regs *regs); | ||
72 | extern int xmon_dabr_match(struct pt_regs *regs); | ||
73 | extern void (*xmon_fault_handler)(struct pt_regs *regs); | ||
74 | |||
75 | void (*debugger)(struct pt_regs *regs) = xmon; | ||
76 | int (*debugger_bpt)(struct pt_regs *regs) = xmon_bpt; | ||
77 | int (*debugger_sstep)(struct pt_regs *regs) = xmon_sstep; | ||
78 | int (*debugger_iabr_match)(struct pt_regs *regs) = xmon_iabr_match; | ||
79 | int (*debugger_dabr_match)(struct pt_regs *regs) = xmon_dabr_match; | ||
80 | void (*debugger_fault_handler)(struct pt_regs *regs); | ||
81 | #elif defined(CONFIG_KGDB) | ||
82 | void (*debugger)(struct pt_regs *regs); | ||
83 | int (*debugger_bpt)(struct pt_regs *regs); | ||
84 | int (*debugger_sstep)(struct pt_regs *regs); | ||
85 | int (*debugger_iabr_match)(struct pt_regs *regs); | ||
86 | int (*debugger_dabr_match)(struct pt_regs *regs); | ||
87 | void (*debugger_fault_handler)(struct pt_regs *regs); | ||
88 | #else | ||
89 | #define debugger(regs) do { } while (0) | ||
90 | #define debugger_bpt(regs) 0 | ||
91 | #define debugger_sstep(regs) 0 | ||
92 | #define debugger_iabr_match(regs) 0 | ||
93 | #define debugger_dabr_match(regs) 0 | ||
94 | #define debugger_fault_handler ((void (*)(struct pt_regs *))0) | ||
95 | #endif | ||
96 | |||
97 | #endif /*__ASSEMBLY__ */ | ||
98 | #endif /* __KERNEL__ */ | ||
99 | #endif /* _ASM_MICROBLAZE_EXCEPTIONS_H */ | ||