Commit 5c64e0d5 authored by Robin Getz's avatar Robin Getz Committed by Bryan Wu

Blackfin arch: Better error handling of unknown exceptions

Better error handling of unknown exceptions, allows userspace to do a
EXCPT n instruction for a not installed exception handler, and the
kernel doesn't crash (like it use to before this).
Signed-off-by: default avatarRobin Getz <rgetz@blackfin.uclinux.org>
Signed-off-by: default avatarBryan Wu <cooloney@kernel.org>
parent aca5e4aa
...@@ -59,6 +59,9 @@ ...@@ -59,6 +59,9 @@
level " or a 16-bit register is accessed with a 32-bit instruction.\n" level " or a 16-bit register is accessed with a 32-bit instruction.\n"
#define HWC_x3(level) \ #define HWC_x3(level) \
"External Memory Addressing Error\n" "External Memory Addressing Error\n"
#define EXC_0x04(level) \
"Unimplmented exception occured\n" \
level " - Maybe you forgot to install a custom exception handler?\n"
#define HWC_x12(level) \ #define HWC_x12(level) \
"Performance Monitor Overflow\n" "Performance Monitor Overflow\n"
#define HWC_x18(level) \ #define HWC_x18(level) \
...@@ -84,7 +87,7 @@ ...@@ -84,7 +87,7 @@
level " a particular processor implementation.\n" level " a particular processor implementation.\n"
#define EXC_0x22(level) \ #define EXC_0x22(level) \
"Illegal instruction combination\n" \ "Illegal instruction combination\n" \
level " - See section for multi-issue rules in the ADSP-BF53x Blackfin\n" \ level " - See section for multi-issue rules in the Blackfin\n" \
level " Processor Instruction Set Reference.\n" level " Processor Instruction Set Reference.\n"
#define EXC_0x23(level) \ #define EXC_0x23(level) \
"Data access CPLB protection violation\n" \ "Data access CPLB protection violation\n" \
......
...@@ -301,18 +301,28 @@ asmlinkage void trap_c(struct pt_regs *fp) ...@@ -301,18 +301,28 @@ asmlinkage void trap_c(struct pt_regs *fp)
printk(KERN_NOTICE EXC_0x03(KERN_NOTICE)); printk(KERN_NOTICE EXC_0x03(KERN_NOTICE));
CHK_DEBUGGER_TRAP_MAYBE(); CHK_DEBUGGER_TRAP_MAYBE();
break; break;
/* 0x04 - User Defined, Caught by default */ /* 0x04 - User Defined */
/* 0x05 - User Defined, Caught by default */ /* 0x05 - User Defined */
/* 0x06 - User Defined, Caught by default */ /* 0x06 - User Defined */
/* 0x07 - User Defined, Caught by default */ /* 0x07 - User Defined */
/* 0x08 - User Defined, Caught by default */ /* 0x08 - User Defined */
/* 0x09 - User Defined, Caught by default */ /* 0x09 - User Defined */
/* 0x0A - User Defined, Caught by default */ /* 0x0A - User Defined */
/* 0x0B - User Defined, Caught by default */ /* 0x0B - User Defined */
/* 0x0C - User Defined, Caught by default */ /* 0x0C - User Defined */
/* 0x0D - User Defined, Caught by default */ /* 0x0D - User Defined */
/* 0x0E - User Defined, Caught by default */ /* 0x0E - User Defined */
/* 0x0F - User Defined, Caught by default */ /* 0x0F - User Defined */
/*
* If we got here, it is most likely that someone was trying to use a
* custom exception handler, and it is not actually installed properly
*/
case VEC_EXCPT04 ... VEC_EXCPT15:
info.si_code = ILL_ILLPARAOP;
sig = SIGILL;
printk(KERN_NOTICE EXC_0x04(KERN_NOTICE));
CHK_DEBUGGER_TRAP_MAYBE();
break;
/* 0x10 HW Single step, handled here */ /* 0x10 HW Single step, handled here */
case VEC_STEP: case VEC_STEP:
info.si_code = TRAP_STEP; info.si_code = TRAP_STEP;
...@@ -507,9 +517,14 @@ asmlinkage void trap_c(struct pt_regs *fp) ...@@ -507,9 +517,14 @@ asmlinkage void trap_c(struct pt_regs *fp)
} }
CHK_DEBUGGER_TRAP_MAYBE(); CHK_DEBUGGER_TRAP_MAYBE();
break; break;
/*
* We should be handling all known exception types above,
* if we get here we hit a reserved one, so panic
*/
default: default:
info.si_code = TRAP_ILLTRAP; oops_in_progress = 1;
sig = SIGTRAP; info.si_code = ILL_ILLPARAOP;
sig = SIGILL;
printk(KERN_EMERG "Caught Unhandled Exception, code = %08lx\n", printk(KERN_EMERG "Caught Unhandled Exception, code = %08lx\n",
(fp->seqstat & SEQSTAT_EXCAUSE)); (fp->seqstat & SEQSTAT_EXCAUSE));
CHK_DEBUGGER_TRAP_MAYBE(); CHK_DEBUGGER_TRAP_MAYBE();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment