1 /* MN10300 Exception handling
2 *
3 * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd.
4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
5 * Modified by David Howells (dhowells@redhat.com)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public Licence
9 * as published by the Free Software Foundation; either version
10 * 2 of the Licence, or (at your option) any later version.
11 */
12 #include <linux/sched.h>
13 #include <linux/kernel.h>
14 #include <linux/string.h>
15 #include <linux/errno.h>
16 #include <linux/ptrace.h>
17 #include <linux/timer.h>
18 #include <linux/mm.h>
19 #include <linux/smp.h>
20 #include <linux/init.h>
21 #include <linux/delay.h>
22 #include <linux/spinlock.h>
23 #include <linux/interrupt.h>
24 #include <linux/kallsyms.h>
25 #include <linux/pci.h>
26 #include <linux/kdebug.h>
27 #include <linux/bug.h>
28 #include <linux/irq.h>
29 #include <asm/processor.h>
30 #include <linux/uaccess.h>
31 #include <asm/io.h>
32 #include <linux/atomic.h>
33 #include <asm/smp.h>
34 #include <asm/pgalloc.h>
35 #include <asm/cacheflush.h>
36 #include <asm/cpu-regs.h>
37 #include <asm/busctl-regs.h>
38 #include <unit/leds.h>
39 #include <asm/fpu.h>
40 #include <asm/sections.h>
41 #include <asm/debugger.h>
42 #include "internal.h"
43
44 #if (CONFIG_INTERRUPT_VECTOR_BASE & 0xffffff)
45 #error "INTERRUPT_VECTOR_BASE not aligned to 16MiB boundary!"
46 #endif
47
48 int kstack_depth_to_print = 24;
49
50 spinlock_t die_lock = __SPIN_LOCK_UNLOCKED(die_lock);
51
52 struct exception_to_signal_map {
53 u8 signo;
54 u32 si_code;
55 };
56
57 static const struct exception_to_signal_map exception_to_signal_map[256] = {
58 /* MMU exceptions */
59 [EXCEP_ITLBMISS >> 3] = { 0, 0 },
60 [EXCEP_DTLBMISS >> 3] = { 0, 0 },
61 [EXCEP_IAERROR >> 3] = { 0, 0 },
62 [EXCEP_DAERROR >> 3] = { 0, 0 },
63
64 /* system exceptions */
65 [EXCEP_TRAP >> 3] = { SIGTRAP, TRAP_BRKPT },
66 [EXCEP_ISTEP >> 3] = { SIGTRAP, TRAP_TRACE }, /* Monitor */
67 [EXCEP_IBREAK >> 3] = { SIGTRAP, TRAP_HWBKPT }, /* Monitor */
68 [EXCEP_OBREAK >> 3] = { SIGTRAP, TRAP_HWBKPT }, /* Monitor */
69 [EXCEP_PRIVINS >> 3] = { SIGILL, ILL_PRVOPC },
70 [EXCEP_UNIMPINS >> 3] = { SIGILL, ILL_ILLOPC },
71 [EXCEP_UNIMPEXINS >> 3] = { SIGILL, ILL_ILLOPC },
72 [EXCEP_MEMERR >> 3] = { SIGSEGV, SEGV_ACCERR },
73 [EXCEP_MISALIGN >> 3] = { SIGBUS, BUS_ADRALN },
74 [EXCEP_BUSERROR >> 3] = { SIGBUS, BUS_ADRERR },
75 [EXCEP_ILLINSACC >> 3] = { SIGSEGV, SEGV_ACCERR },
76 [EXCEP_ILLDATACC >> 3] = { SIGSEGV, SEGV_ACCERR },
77 [EXCEP_IOINSACC >> 3] = { SIGSEGV, SEGV_ACCERR },
78 [EXCEP_PRIVINSACC >> 3] = { SIGSEGV, SEGV_ACCERR }, /* userspace */
79 [EXCEP_PRIVDATACC >> 3] = { SIGSEGV, SEGV_ACCERR }, /* userspace */
80 [EXCEP_DATINSACC >> 3] = { SIGSEGV, SEGV_ACCERR },
81 [EXCEP_DOUBLE_FAULT >> 3] = { SIGILL, ILL_BADSTK },
82
83 /* FPU exceptions */
84 [EXCEP_FPU_DISABLED >> 3] = { SIGILL, ILL_COPROC },
85 [EXCEP_FPU_UNIMPINS >> 3] = { SIGILL, ILL_COPROC },
86 [EXCEP_FPU_OPERATION >> 3] = { SIGFPE, FPE_INTDIV },
87
88 /* interrupts */
89 [EXCEP_WDT >> 3] = { SIGALRM, 0 },
90 [EXCEP_NMI >> 3] = { SIGQUIT, 0 },
91 [EXCEP_IRQ_LEVEL0 >> 3] = { SIGINT, 0 },
92 [EXCEP_IRQ_LEVEL1 >> 3] = { 0, 0 },
93 [EXCEP_IRQ_LEVEL2 >> 3] = { 0, 0 },
94 [EXCEP_IRQ_LEVEL3 >> 3] = { 0, 0 },
95 [EXCEP_IRQ_LEVEL4 >> 3] = { 0, 0 },
96 [EXCEP_IRQ_LEVEL5 >> 3] = { 0, 0 },
97 [EXCEP_IRQ_LEVEL6 >> 3] = { 0, 0 },
98
99 /* system calls */
100 [EXCEP_SYSCALL0 >> 3] = { 0, 0 },
101 [EXCEP_SYSCALL1 >> 3] = { SIGILL, ILL_ILLTRP },
102 [EXCEP_SYSCALL2 >> 3] = { SIGILL, ILL_ILLTRP },
103 [EXCEP_SYSCALL3 >> 3] = { SIGILL, ILL_ILLTRP },
104 [EXCEP_SYSCALL4 >> 3] = { SIGILL, ILL_ILLTRP },
105 [EXCEP_SYSCALL5 >> 3] = { SIGILL, ILL_ILLTRP },
106 [EXCEP_SYSCALL6 >> 3] = { SIGILL, ILL_ILLTRP },
107 [EXCEP_SYSCALL7 >> 3] = { SIGILL, ILL_ILLTRP },
108 [EXCEP_SYSCALL8 >> 3] = { SIGILL, ILL_ILLTRP },
109 [EXCEP_SYSCALL9 >> 3] = { SIGILL, ILL_ILLTRP },
110 [EXCEP_SYSCALL10 >> 3] = { SIGILL, ILL_ILLTRP },
111 [EXCEP_SYSCALL11 >> 3] = { SIGILL, ILL_ILLTRP },
112 [EXCEP_SYSCALL12 >> 3] = { SIGILL, ILL_ILLTRP },
113 [EXCEP_SYSCALL13 >> 3] = { SIGILL, ILL_ILLTRP },
114 [EXCEP_SYSCALL14 >> 3] = { SIGILL, ILL_ILLTRP },
115 [EXCEP_SYSCALL15 >> 3] = { SIGABRT, 0 },
116 };
117
118 /*
119 * Handle kernel exceptions.
120 *
121 * See if there's a fixup handler we can force a jump to when an exception
122 * happens due to something kernel code did
123 */
die_if_no_fixup(const char * str,struct pt_regs * regs,enum exception_code code)124 int die_if_no_fixup(const char *str, struct pt_regs *regs,
125 enum exception_code code)
126 {
127 u8 opcode;
128 int signo, si_code;
129
130 if (user_mode(regs))
131 return 0;
132
133 peripheral_leds_display_exception(code);
134
135 signo = exception_to_signal_map[code >> 3].signo;
136 si_code = exception_to_signal_map[code >> 3].si_code;
137
138 switch (code) {
139 /* see if we can fixup the kernel accessing memory */
140 case EXCEP_ITLBMISS:
141 case EXCEP_DTLBMISS:
142 case EXCEP_IAERROR:
143 case EXCEP_DAERROR:
144 case EXCEP_MEMERR:
145 case EXCEP_MISALIGN:
146 case EXCEP_BUSERROR:
147 case EXCEP_ILLDATACC:
148 case EXCEP_IOINSACC:
149 case EXCEP_PRIVINSACC:
150 case EXCEP_PRIVDATACC:
151 case EXCEP_DATINSACC:
152 if (fixup_exception(regs))
153 return 1;
154 break;
155
156 case EXCEP_TRAP:
157 case EXCEP_UNIMPINS:
158 if (probe_kernel_read(&opcode, (u8 *)regs->pc, 1) < 0)
159 break;
160 if (opcode == 0xff) {
161 if (notify_die(DIE_BREAKPOINT, str, regs, code, 0, 0))
162 return 1;
163 if (at_debugger_breakpoint(regs))
164 regs->pc++;
165 signo = SIGTRAP;
166 si_code = TRAP_BRKPT;
167 }
168 break;
169
170 case EXCEP_SYSCALL1 ... EXCEP_SYSCALL14:
171 /* syscall return addr is _after_ the instruction */
172 regs->pc -= 2;
173 break;
174
175 case EXCEP_SYSCALL15:
176 if (report_bug(regs->pc, regs) == BUG_TRAP_TYPE_WARN)
177 return 1;
178
179 /* syscall return addr is _after_ the instruction */
180 regs->pc -= 2;
181 break;
182
183 default:
184 break;
185 }
186
187 if (debugger_intercept(code, signo, si_code, regs) == 0)
188 return 1;
189
190 if (notify_die(DIE_GPF, str, regs, code, 0, 0))
191 return 1;
192
193 /* make the process die as the last resort */
194 die(str, regs, code);
195 }
196
197 /*
198 * General exception handler
199 */
handle_exception(struct pt_regs * regs,u32 intcode)200 asmlinkage void handle_exception(struct pt_regs *regs, u32 intcode)
201 {
202 siginfo_t info;
203
204 /* deal with kernel exceptions here */
205 if (die_if_no_fixup(NULL, regs, intcode))
206 return;
207
208 /* otherwise it's a userspace exception */
209 info.si_signo = exception_to_signal_map[intcode >> 3].signo;
210 info.si_code = exception_to_signal_map[intcode >> 3].si_code;
211 info.si_errno = 0;
212 info.si_addr = (void *) regs->pc;
213 force_sig_info(info.si_signo, &info, current);
214 }
215
216 /*
217 * handle NMI
218 */
nmi(struct pt_regs * regs,enum exception_code code)219 asmlinkage void nmi(struct pt_regs *regs, enum exception_code code)
220 {
221 /* see if gdbstub wants to deal with it */
222 if (debugger_intercept(code, SIGQUIT, 0, regs))
223 return;
224
225 printk(KERN_WARNING "--- Register Dump ---\n");
226 show_registers(regs);
227 printk(KERN_WARNING "---------------------\n");
228 }
229
230 /*
231 * show a stack trace from the specified stack pointer
232 */
show_trace(unsigned long * sp)233 void show_trace(unsigned long *sp)
234 {
235 unsigned long bottom, stack, addr, fp, raslot;
236
237 printk(KERN_EMERG "\nCall Trace:\n");
238
239 //stack = (unsigned long)sp;
240 asm("mov sp,%0" : "=a"(stack));
241 asm("mov a3,%0" : "=r"(fp));
242
243 raslot = ULONG_MAX;
244 bottom = (stack + THREAD_SIZE) & ~(THREAD_SIZE - 1);
245 for (; stack < bottom; stack += sizeof(addr)) {
246 addr = *(unsigned long *)stack;
247 if (stack == fp) {
248 if (addr > stack && addr < bottom) {
249 fp = addr;
250 raslot = stack + sizeof(addr);
251 continue;
252 }
253 fp = 0;
254 raslot = ULONG_MAX;
255 }
256
257 if (__kernel_text_address(addr)) {
258 printk(" [<%08lx>]", addr);
259 if (stack >= raslot)
260 raslot = ULONG_MAX;
261 else
262 printk(" ?");
263 print_symbol(" %s", addr);
264 printk("\n");
265 }
266 }
267
268 printk("\n");
269 }
270
271 /*
272 * show the raw stack from the specified stack pointer
273 */
show_stack(struct task_struct * task,unsigned long * sp)274 void show_stack(struct task_struct *task, unsigned long *sp)
275 {
276 unsigned long *stack;
277 int i;
278
279 if (!sp)
280 sp = (unsigned long *) &sp;
281
282 stack = sp;
283 printk(KERN_EMERG "Stack:");
284 for (i = 0; i < kstack_depth_to_print; i++) {
285 if (((long) stack & (THREAD_SIZE - 1)) == 0)
286 break;
287 if ((i % 8) == 0)
288 printk(KERN_EMERG " ");
289 printk("%08lx ", *stack++);
290 }
291
292 show_trace(sp);
293 }
294
295 /*
296 * the architecture-independent dump_stack generator
297 */
dump_stack(void)298 void dump_stack(void)
299 {
300 unsigned long stack;
301
302 show_stack(current, &stack);
303 }
304 EXPORT_SYMBOL(dump_stack);
305
306 /*
307 * dump the register file in the specified exception frame
308 */
show_registers_only(struct pt_regs * regs)309 void show_registers_only(struct pt_regs *regs)
310 {
311 unsigned long ssp;
312
313 ssp = (unsigned long) regs + sizeof(*regs);
314
315 printk(KERN_EMERG "PC: %08lx EPSW: %08lx SSP: %08lx mode: %s\n",
316 regs->pc, regs->epsw, ssp, user_mode(regs) ? "User" : "Super");
317 printk(KERN_EMERG "d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n",
318 regs->d0, regs->d1, regs->d2, regs->d3);
319 printk(KERN_EMERG "a0: %08lx a1: %08lx a2: %08lx a3: %08lx\n",
320 regs->a0, regs->a1, regs->a2, regs->a3);
321 printk(KERN_EMERG "e0: %08lx e1: %08lx e2: %08lx e3: %08lx\n",
322 regs->e0, regs->e1, regs->e2, regs->e3);
323 printk(KERN_EMERG "e4: %08lx e5: %08lx e6: %08lx e7: %08lx\n",
324 regs->e4, regs->e5, regs->e6, regs->e7);
325 printk(KERN_EMERG "lar: %08lx lir: %08lx mdr: %08lx usp: %08lx\n",
326 regs->lar, regs->lir, regs->mdr, regs->sp);
327 printk(KERN_EMERG "cvf: %08lx crl: %08lx crh: %08lx drq: %08lx\n",
328 regs->mcvf, regs->mcrl, regs->mcrh, regs->mdrq);
329 printk(KERN_EMERG "threadinfo=%p task=%p)\n",
330 current_thread_info(), current);
331
332 if ((unsigned long) current >= PAGE_OFFSET &&
333 (unsigned long) current < (unsigned long)high_memory)
334 printk(KERN_EMERG "Process %s (pid: %d)\n",
335 current->comm, current->pid);
336
337 #ifdef CONFIG_SMP
338 printk(KERN_EMERG "CPUID: %08x\n", CPUID);
339 #endif
340 printk(KERN_EMERG "CPUP: %04hx\n", CPUP);
341 printk(KERN_EMERG "TBR: %08x\n", TBR);
342 printk(KERN_EMERG "DEAR: %08x\n", DEAR);
343 printk(KERN_EMERG "sISR: %08x\n", sISR);
344 printk(KERN_EMERG "NMICR: %04hx\n", NMICR);
345 printk(KERN_EMERG "BCBERR: %08x\n", BCBERR);
346 printk(KERN_EMERG "BCBEAR: %08x\n", BCBEAR);
347 printk(KERN_EMERG "MMUFCR: %08x\n", MMUFCR);
348 printk(KERN_EMERG "IPTEU : %08x IPTEL2: %08x\n", IPTEU, IPTEL2);
349 printk(KERN_EMERG "DPTEU: %08x DPTEL2: %08x\n", DPTEU, DPTEL2);
350 }
351
352 /*
353 * dump the registers and the stack
354 */
show_registers(struct pt_regs * regs)355 void show_registers(struct pt_regs *regs)
356 {
357 unsigned long sp;
358 int i;
359
360 show_registers_only(regs);
361
362 if (!user_mode(regs))
363 sp = (unsigned long) regs + sizeof(*regs);
364 else
365 sp = regs->sp;
366
367 /* when in-kernel, we also print out the stack and code at the
368 * time of the fault..
369 */
370 if (!user_mode(regs)) {
371 printk(KERN_EMERG "\n");
372 show_stack(current, (unsigned long *) sp);
373
374 #if 0
375 printk(KERN_EMERG "\nCode: ");
376 if (regs->pc < PAGE_OFFSET)
377 goto bad;
378
379 for (i = 0; i < 20; i++) {
380 unsigned char c;
381 if (__get_user(c, &((unsigned char *) regs->pc)[i]))
382 goto bad;
383 printk("%02x ", c);
384 }
385 #else
386 i = 0;
387 #endif
388 }
389
390 printk("\n");
391 return;
392
393 #if 0
394 bad:
395 printk(KERN_EMERG " Bad PC value.");
396 break;
397 #endif
398 }
399
400 /*
401 *
402 */
show_trace_task(struct task_struct * tsk)403 void show_trace_task(struct task_struct *tsk)
404 {
405 unsigned long sp = tsk->thread.sp;
406
407 /* User space on another CPU? */
408 if ((sp ^ (unsigned long) tsk) & (PAGE_MASK << 1))
409 return;
410
411 show_trace((unsigned long *) sp);
412 }
413
414 /*
415 * note the untimely death of part of the kernel
416 */
die(const char * str,struct pt_regs * regs,enum exception_code code)417 void die(const char *str, struct pt_regs *regs, enum exception_code code)
418 {
419 console_verbose();
420 spin_lock_irq(&die_lock);
421 printk(KERN_EMERG "\n%s: %04x\n",
422 str, code & 0xffff);
423 show_registers(regs);
424
425 if (regs->pc >= 0x02000000 && regs->pc < 0x04000000 &&
426 (regs->epsw & (EPSW_IM | EPSW_IE)) != (EPSW_IM | EPSW_IE)) {
427 printk(KERN_EMERG "Exception in usermode interrupt handler\n");
428 printk(KERN_EMERG "\nPlease connect to kernel debugger !!\n");
429 asm volatile ("0: bra 0b");
430 }
431
432 spin_unlock_irq(&die_lock);
433 do_exit(SIGSEGV);
434 }
435
436 /*
437 * display the register file when the stack pointer gets clobbered
438 */
do_double_fault(struct pt_regs * regs)439 asmlinkage void do_double_fault(struct pt_regs *regs)
440 {
441 struct task_struct *tsk = current;
442
443 strcpy(tsk->comm, "emergency tsk");
444 tsk->pid = 0;
445 console_verbose();
446 printk(KERN_EMERG "--- double fault ---\n");
447 show_registers(regs);
448 }
449
450 /*
451 * asynchronous bus error (external, usually I/O DMA)
452 */
io_bus_error(u32 bcberr,u32 bcbear,struct pt_regs * regs)453 asmlinkage void io_bus_error(u32 bcberr, u32 bcbear, struct pt_regs *regs)
454 {
455 console_verbose();
456
457 printk(KERN_EMERG "Asynchronous I/O Bus Error\n");
458 printk(KERN_EMERG "==========================\n");
459
460 if (bcberr & BCBERR_BEME)
461 printk(KERN_EMERG "- Multiple recorded errors\n");
462
463 printk(KERN_EMERG "- Faulting Buses:%s%s%s\n",
464 bcberr & BCBERR_BEMR_CI ? " CPU-Ins-Fetch" : "",
465 bcberr & BCBERR_BEMR_CD ? " CPU-Data" : "",
466 bcberr & BCBERR_BEMR_DMA ? " DMA" : "");
467
468 printk(KERN_EMERG "- %s %s access made to %s at address %08x\n",
469 bcberr & BCBERR_BEBST ? "Burst" : "Single",
470 bcberr & BCBERR_BERW ? "Read" : "Write",
471 bcberr & BCBERR_BESB_MON ? "Monitor Space" :
472 bcberr & BCBERR_BESB_IO ? "Internal CPU I/O Space" :
473 bcberr & BCBERR_BESB_EX ? "External I/O Bus" :
474 bcberr & BCBERR_BESB_OPEX ? "External Memory Bus" :
475 "On Chip Memory",
476 bcbear
477 );
478
479 printk(KERN_EMERG "- Detected by the %s\n",
480 bcberr&BCBERR_BESD ? "Bus Control Unit" : "Slave Bus");
481
482 #ifdef CONFIG_PCI
483 #define BRIDGEREGB(X) (*(volatile __u8 *)(0xBE040000 + (X)))
484 #define BRIDGEREGW(X) (*(volatile __u16 *)(0xBE040000 + (X)))
485 #define BRIDGEREGL(X) (*(volatile __u32 *)(0xBE040000 + (X)))
486
487 printk(KERN_EMERG "- PCI Memory Paging Reg: %08x\n",
488 *(volatile __u32 *) (0xBFFFFFF4));
489 printk(KERN_EMERG "- PCI Bridge Base Address 0: %08x\n",
490 BRIDGEREGL(PCI_BASE_ADDRESS_0));
491 printk(KERN_EMERG "- PCI Bridge AMPCI Base Address: %08x\n",
492 BRIDGEREGL(0x48));
493 printk(KERN_EMERG "- PCI Bridge Command: %04hx\n",
494 BRIDGEREGW(PCI_COMMAND));
495 printk(KERN_EMERG "- PCI Bridge Status: %04hx\n",
496 BRIDGEREGW(PCI_STATUS));
497 printk(KERN_EMERG "- PCI Bridge Int Status: %08hx\n",
498 BRIDGEREGL(0x4c));
499 #endif
500
501 printk(KERN_EMERG "\n");
502 show_registers(regs);
503
504 panic("Halted due to asynchronous I/O Bus Error\n");
505 }
506
507 /*
508 * handle an exception for which a handler has not yet been installed
509 */
uninitialised_exception(struct pt_regs * regs,enum exception_code code)510 asmlinkage void uninitialised_exception(struct pt_regs *regs,
511 enum exception_code code)
512 {
513
514 /* see if gdbstub wants to deal with it */
515 if (debugger_intercept(code, SIGSYS, 0, regs) == 0)
516 return;
517
518 peripheral_leds_display_exception(code);
519 printk(KERN_EMERG "Uninitialised Exception 0x%04x\n", code & 0xFFFF);
520 show_registers(regs);
521
522 for (;;)
523 continue;
524 }
525
526 /*
527 * set an interrupt stub to jump to a handler
528 * ! NOTE: this does *not* flush the caches
529 */
__set_intr_stub(enum exception_code code,void * handler)530 void __init __set_intr_stub(enum exception_code code, void *handler)
531 {
532 unsigned long addr;
533 u8 *vector = (u8 *)(CONFIG_INTERRUPT_VECTOR_BASE + code);
534
535 addr = (unsigned long) handler - (unsigned long) vector;
536 vector[0] = 0xdc; /* JMP handler */
537 vector[1] = addr;
538 vector[2] = addr >> 8;
539 vector[3] = addr >> 16;
540 vector[4] = addr >> 24;
541 vector[5] = 0xcb;
542 vector[6] = 0xcb;
543 vector[7] = 0xcb;
544 }
545
546 /*
547 * set an interrupt stub to jump to a handler
548 */
set_intr_stub(enum exception_code code,void * handler)549 void __init set_intr_stub(enum exception_code code, void *handler)
550 {
551 unsigned long addr;
552 u8 *vector = (u8 *)(CONFIG_INTERRUPT_VECTOR_BASE + code);
553 unsigned long flags;
554
555 addr = (unsigned long) handler - (unsigned long) vector;
556
557 flags = arch_local_cli_save();
558
559 vector[0] = 0xdc; /* JMP handler */
560 vector[1] = addr;
561 vector[2] = addr >> 8;
562 vector[3] = addr >> 16;
563 vector[4] = addr >> 24;
564 vector[5] = 0xcb;
565 vector[6] = 0xcb;
566 vector[7] = 0xcb;
567
568 arch_local_irq_restore(flags);
569
570 #ifndef CONFIG_MN10300_CACHE_SNOOP
571 mn10300_dcache_flush_inv();
572 mn10300_icache_inv();
573 #endif
574 }
575
576 /*
577 * initialise the exception table
578 */
trap_init(void)579 void __init trap_init(void)
580 {
581 set_excp_vector(EXCEP_TRAP, handle_exception);
582 set_excp_vector(EXCEP_ISTEP, handle_exception);
583 set_excp_vector(EXCEP_IBREAK, handle_exception);
584 set_excp_vector(EXCEP_OBREAK, handle_exception);
585
586 set_excp_vector(EXCEP_PRIVINS, handle_exception);
587 set_excp_vector(EXCEP_UNIMPINS, handle_exception);
588 set_excp_vector(EXCEP_UNIMPEXINS, handle_exception);
589 set_excp_vector(EXCEP_MEMERR, handle_exception);
590 set_excp_vector(EXCEP_MISALIGN, misalignment);
591 set_excp_vector(EXCEP_BUSERROR, handle_exception);
592 set_excp_vector(EXCEP_ILLINSACC, handle_exception);
593 set_excp_vector(EXCEP_ILLDATACC, handle_exception);
594 set_excp_vector(EXCEP_IOINSACC, handle_exception);
595 set_excp_vector(EXCEP_PRIVINSACC, handle_exception);
596 set_excp_vector(EXCEP_PRIVDATACC, handle_exception);
597 set_excp_vector(EXCEP_DATINSACC, handle_exception);
598 set_excp_vector(EXCEP_FPU_UNIMPINS, handle_exception);
599 set_excp_vector(EXCEP_FPU_OPERATION, fpu_exception);
600
601 set_excp_vector(EXCEP_NMI, nmi);
602
603 set_excp_vector(EXCEP_SYSCALL1, handle_exception);
604 set_excp_vector(EXCEP_SYSCALL2, handle_exception);
605 set_excp_vector(EXCEP_SYSCALL3, handle_exception);
606 set_excp_vector(EXCEP_SYSCALL4, handle_exception);
607 set_excp_vector(EXCEP_SYSCALL5, handle_exception);
608 set_excp_vector(EXCEP_SYSCALL6, handle_exception);
609 set_excp_vector(EXCEP_SYSCALL7, handle_exception);
610 set_excp_vector(EXCEP_SYSCALL8, handle_exception);
611 set_excp_vector(EXCEP_SYSCALL9, handle_exception);
612 set_excp_vector(EXCEP_SYSCALL10, handle_exception);
613 set_excp_vector(EXCEP_SYSCALL11, handle_exception);
614 set_excp_vector(EXCEP_SYSCALL12, handle_exception);
615 set_excp_vector(EXCEP_SYSCALL13, handle_exception);
616 set_excp_vector(EXCEP_SYSCALL14, handle_exception);
617 set_excp_vector(EXCEP_SYSCALL15, handle_exception);
618 }
619
620 /*
621 * determine if a program counter value is a valid bug address
622 */
is_valid_bugaddr(unsigned long pc)623 int is_valid_bugaddr(unsigned long pc)
624 {
625 return pc >= PAGE_OFFSET;
626 }
627