aboutsummaryrefslogtreecommitdiffstats
path: root/arch/microblaze/kernel/exceptions.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /arch/microblaze/kernel/exceptions.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'arch/microblaze/kernel/exceptions.c')
-rw-r--r--arch/microblaze/kernel/exceptions.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/arch/microblaze/kernel/exceptions.c b/arch/microblaze/kernel/exceptions.c
index b98ee8d0c1cd..66fad2301221 100644
--- a/arch/microblaze/kernel/exceptions.c
+++ b/arch/microblaze/kernel/exceptions.c
@@ -25,6 +25,7 @@
25#include <linux/errno.h> 25#include <linux/errno.h>
26#include <linux/ptrace.h> 26#include <linux/ptrace.h>
27#include <asm/current.h> 27#include <asm/current.h>
28#include <asm/cacheflush.h>
28 29
29#define MICROBLAZE_ILL_OPCODE_EXCEPTION 0x02 30#define MICROBLAZE_ILL_OPCODE_EXCEPTION 0x02
30#define MICROBLAZE_IBUS_EXCEPTION 0x03 31#define MICROBLAZE_IBUS_EXCEPTION 0x03
@@ -49,9 +50,11 @@ void die(const char *str, struct pt_regs *fp, long err)
49} 50}
50 51
51/* for user application debugging */ 52/* for user application debugging */
52void sw_exception(struct pt_regs *regs) 53asmlinkage void sw_exception(struct pt_regs *regs)
53{ 54{
54 _exception(SIGTRAP, regs, TRAP_BRKPT, regs->r16); 55 _exception(SIGTRAP, regs, TRAP_BRKPT, regs->r16);
56 flush_dcache_range(regs->r16, regs->r16 + 0x4);
57 flush_icache_range(regs->r16, regs->r16 + 0x4);
55} 58}
56 59
57void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr) 60void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
@@ -72,7 +75,6 @@ asmlinkage void full_exception(struct pt_regs *regs, unsigned int type,
72 int fsr, int addr) 75 int fsr, int addr)
73{ 76{
74#ifdef CONFIG_MMU 77#ifdef CONFIG_MMU
75 int code;
76 addr = regs->pc; 78 addr = regs->pc;
77#endif 79#endif
78 80
@@ -86,8 +88,7 @@ asmlinkage void full_exception(struct pt_regs *regs, unsigned int type,
86 switch (type & 0x1F) { 88 switch (type & 0x1F) {
87 case MICROBLAZE_ILL_OPCODE_EXCEPTION: 89 case MICROBLAZE_ILL_OPCODE_EXCEPTION:
88 if (user_mode(regs)) { 90 if (user_mode(regs)) {
89 pr_debug(KERN_WARNING "Illegal opcode exception " \ 91 pr_debug("Illegal opcode exception in user mode\n");
90 "in user mode.\n");
91 _exception(SIGILL, regs, ILL_ILLOPC, addr); 92 _exception(SIGILL, regs, ILL_ILLOPC, addr);
92 return; 93 return;
93 } 94 }
@@ -97,8 +98,7 @@ asmlinkage void full_exception(struct pt_regs *regs, unsigned int type,
97 break; 98 break;
98 case MICROBLAZE_IBUS_EXCEPTION: 99 case MICROBLAZE_IBUS_EXCEPTION:
99 if (user_mode(regs)) { 100 if (user_mode(regs)) {
100 pr_debug(KERN_WARNING "Instruction bus error " \ 101 pr_debug("Instruction bus error exception in user mode\n");
101 "exception in user mode.\n");
102 _exception(SIGBUS, regs, BUS_ADRERR, addr); 102 _exception(SIGBUS, regs, BUS_ADRERR, addr);
103 return; 103 return;
104 } 104 }
@@ -108,8 +108,7 @@ asmlinkage void full_exception(struct pt_regs *regs, unsigned int type,
108 break; 108 break;
109 case MICROBLAZE_DBUS_EXCEPTION: 109 case MICROBLAZE_DBUS_EXCEPTION:
110 if (user_mode(regs)) { 110 if (user_mode(regs)) {
111 pr_debug(KERN_WARNING "Data bus error exception " \ 111 pr_debug("Data bus error exception in user mode\n");
112 "in user mode.\n");
113 _exception(SIGBUS, regs, BUS_ADRERR, addr); 112 _exception(SIGBUS, regs, BUS_ADRERR, addr);
114 return; 113 return;
115 } 114 }
@@ -119,8 +118,7 @@ asmlinkage void full_exception(struct pt_regs *regs, unsigned int type,
119 break; 118 break;
120 case MICROBLAZE_DIV_ZERO_EXCEPTION: 119 case MICROBLAZE_DIV_ZERO_EXCEPTION:
121 if (user_mode(regs)) { 120 if (user_mode(regs)) {
122 pr_debug(KERN_WARNING "Divide by zero exception " \ 121 pr_debug("Divide by zero exception in user mode\n");
123 "in user mode\n");
124 _exception(SIGILL, regs, FPE_INTDIV, addr); 122 _exception(SIGILL, regs, FPE_INTDIV, addr);
125 return; 123 return;
126 } 124 }
@@ -129,7 +127,7 @@ asmlinkage void full_exception(struct pt_regs *regs, unsigned int type,
129 die("Divide by zero exception", regs, SIGBUS); 127 die("Divide by zero exception", regs, SIGBUS);
130 break; 128 break;
131 case MICROBLAZE_FPU_EXCEPTION: 129 case MICROBLAZE_FPU_EXCEPTION:
132 pr_debug(KERN_WARNING "FPU exception\n"); 130 pr_debug("FPU exception\n");
133 /* IEEE FP exception */ 131 /* IEEE FP exception */
134 /* I removed fsr variable and use code var for storing fsr */ 132 /* I removed fsr variable and use code var for storing fsr */
135 if (fsr & FSR_IO) 133 if (fsr & FSR_IO)
@@ -147,14 +145,8 @@ asmlinkage void full_exception(struct pt_regs *regs, unsigned int type,
147 145
148#ifdef CONFIG_MMU 146#ifdef CONFIG_MMU
149 case MICROBLAZE_PRIVILEGED_EXCEPTION: 147 case MICROBLAZE_PRIVILEGED_EXCEPTION:
150 pr_debug(KERN_WARNING "Privileged exception\n"); 148 pr_debug("Privileged exception\n");
151 /* "brk r0,r0" - used as debug breakpoint - old toolchain */ 149 _exception(SIGILL, regs, ILL_PRVOPC, addr);
152 if (get_user(code, (unsigned long *)regs->pc) == 0
153 && code == 0x980c0000) {
154 _exception(SIGTRAP, regs, TRAP_BRKPT, addr);
155 } else {
156 _exception(SIGILL, regs, ILL_PRVOPC, addr);
157 }
158 break; 150 break;
159#endif 151#endif
160 default: 152 default: