diff options
author | Robin Getz <rgetz@blackfin.uclinux.org> | 2008-10-08 02:43:47 -0400 |
---|---|---|
committer | Bryan Wu <cooloney@kernel.org> | 2008-10-08 02:43:47 -0400 |
commit | 5c64e0d5109532f8184be29c1dc163059e3ded4b (patch) | |
tree | b39ae82bbdc99dba134c48c00e16d949ef742541 /arch | |
parent | aca5e4aac88a0ee84e9dc63e3d4189adbaef24ca (diff) |
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: Robin Getz <rgetz@blackfin.uclinux.org>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/blackfin/include/asm/traps.h | 5 | ||||
-rw-r--r-- | arch/blackfin/kernel/traps.c | 43 |
2 files changed, 33 insertions, 15 deletions
diff --git a/arch/blackfin/include/asm/traps.h b/arch/blackfin/include/asm/traps.h index f0e5f940d9ca..34f7295fb070 100644 --- a/arch/blackfin/include/asm/traps.h +++ b/arch/blackfin/include/asm/traps.h | |||
@@ -59,6 +59,9 @@ | |||
59 | level " or a 16-bit register is accessed with a 32-bit instruction.\n" | 59 | level " or a 16-bit register is accessed with a 32-bit instruction.\n" |
60 | #define HWC_x3(level) \ | 60 | #define HWC_x3(level) \ |
61 | "External Memory Addressing Error\n" | 61 | "External Memory Addressing Error\n" |
62 | #define EXC_0x04(level) \ | ||
63 | "Unimplmented exception occured\n" \ | ||
64 | level " - Maybe you forgot to install a custom exception handler?\n" | ||
62 | #define HWC_x12(level) \ | 65 | #define HWC_x12(level) \ |
63 | "Performance Monitor Overflow\n" | 66 | "Performance Monitor Overflow\n" |
64 | #define HWC_x18(level) \ | 67 | #define HWC_x18(level) \ |
@@ -84,7 +87,7 @@ | |||
84 | level " a particular processor implementation.\n" | 87 | level " a particular processor implementation.\n" |
85 | #define EXC_0x22(level) \ | 88 | #define EXC_0x22(level) \ |
86 | "Illegal instruction combination\n" \ | 89 | "Illegal instruction combination\n" \ |
87 | level " - See section for multi-issue rules in the ADSP-BF53x Blackfin\n" \ | 90 | level " - See section for multi-issue rules in the Blackfin\n" \ |
88 | level " Processor Instruction Set Reference.\n" | 91 | level " Processor Instruction Set Reference.\n" |
89 | #define EXC_0x23(level) \ | 92 | #define EXC_0x23(level) \ |
90 | "Data access CPLB protection violation\n" \ | 93 | "Data access CPLB protection violation\n" \ |
diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c index 8d561baef896..be5ae7fabc5f 100644 --- a/arch/blackfin/kernel/traps.c +++ b/arch/blackfin/kernel/traps.c | |||
@@ -301,18 +301,28 @@ asmlinkage void trap_c(struct pt_regs *fp) | |||
301 | printk(KERN_NOTICE EXC_0x03(KERN_NOTICE)); | 301 | printk(KERN_NOTICE EXC_0x03(KERN_NOTICE)); |
302 | CHK_DEBUGGER_TRAP_MAYBE(); | 302 | CHK_DEBUGGER_TRAP_MAYBE(); |
303 | break; | 303 | break; |
304 | /* 0x04 - User Defined, Caught by default */ | 304 | /* 0x04 - User Defined */ |
305 | /* 0x05 - User Defined, Caught by default */ | 305 | /* 0x05 - User Defined */ |
306 | /* 0x06 - User Defined, Caught by default */ | 306 | /* 0x06 - User Defined */ |
307 | /* 0x07 - User Defined, Caught by default */ | 307 | /* 0x07 - User Defined */ |
308 | /* 0x08 - User Defined, Caught by default */ | 308 | /* 0x08 - User Defined */ |
309 | /* 0x09 - User Defined, Caught by default */ | 309 | /* 0x09 - User Defined */ |
310 | /* 0x0A - User Defined, Caught by default */ | 310 | /* 0x0A - User Defined */ |
311 | /* 0x0B - User Defined, Caught by default */ | 311 | /* 0x0B - User Defined */ |
312 | /* 0x0C - User Defined, Caught by default */ | 312 | /* 0x0C - User Defined */ |
313 | /* 0x0D - User Defined, Caught by default */ | 313 | /* 0x0D - User Defined */ |
314 | /* 0x0E - User Defined, Caught by default */ | 314 | /* 0x0E - User Defined */ |
315 | /* 0x0F - User Defined, Caught by default */ | 315 | /* 0x0F - User Defined */ |
316 | /* | ||
317 | * If we got here, it is most likely that someone was trying to use a | ||
318 | * custom exception handler, and it is not actually installed properly | ||
319 | */ | ||
320 | case VEC_EXCPT04 ... VEC_EXCPT15: | ||
321 | info.si_code = ILL_ILLPARAOP; | ||
322 | sig = SIGILL; | ||
323 | printk(KERN_NOTICE EXC_0x04(KERN_NOTICE)); | ||
324 | CHK_DEBUGGER_TRAP_MAYBE(); | ||
325 | break; | ||
316 | /* 0x10 HW Single step, handled here */ | 326 | /* 0x10 HW Single step, handled here */ |
317 | case VEC_STEP: | 327 | case VEC_STEP: |
318 | info.si_code = TRAP_STEP; | 328 | info.si_code = TRAP_STEP; |
@@ -507,9 +517,14 @@ asmlinkage void trap_c(struct pt_regs *fp) | |||
507 | } | 517 | } |
508 | CHK_DEBUGGER_TRAP_MAYBE(); | 518 | CHK_DEBUGGER_TRAP_MAYBE(); |
509 | break; | 519 | break; |
520 | /* | ||
521 | * We should be handling all known exception types above, | ||
522 | * if we get here we hit a reserved one, so panic | ||
523 | */ | ||
510 | default: | 524 | default: |
511 | info.si_code = TRAP_ILLTRAP; | 525 | oops_in_progress = 1; |
512 | sig = SIGTRAP; | 526 | info.si_code = ILL_ILLPARAOP; |
527 | sig = SIGILL; | ||
513 | printk(KERN_EMERG "Caught Unhandled Exception, code = %08lx\n", | 528 | printk(KERN_EMERG "Caught Unhandled Exception, code = %08lx\n", |
514 | (fp->seqstat & SEQSTAT_EXCAUSE)); | 529 | (fp->seqstat & SEQSTAT_EXCAUSE)); |
515 | CHK_DEBUGGER_TRAP_MAYBE(); | 530 | CHK_DEBUGGER_TRAP_MAYBE(); |