blob: 9b5c345d2b4f306a4a1e03da98a1901e45c5af18 [file] [log] [blame]
Chris Zankel5a0015d2005-06-23 22:01:16 -07001/*
2 * arch/xtensa/kernel/traps.c
3 *
4 * Exception handling.
5 *
6 * Derived from code with the following copyrights:
7 * Copyright (C) 1994 - 1999 by Ralf Baechle
8 * Modified for R3000 by Paul M. Antoine, 1995, 1996
9 * Complete output from die() by Ulf Carlsson, 1998
10 * Copyright (C) 1999 Silicon Graphics, Inc.
11 *
12 * Essentially rewritten for the Xtensa architecture port.
13 *
14 * Copyright (C) 2001 - 2005 Tensilica Inc.
15 *
16 * Joe Taylor <joe@tensilica.com, joetylr@yahoo.com>
17 * Chris Zankel <chris@zankel.net>
18 * Marc Gauthier<marc@tensilica.com, marc@alumni.uwaterloo.ca>
19 * Kevin Chea
20 *
21 * This file is subject to the terms and conditions of the GNU General Public
22 * License. See the file "COPYING" in the main directory of this archive
23 * for more details.
24 */
25
26#include <linux/kernel.h>
27#include <linux/sched.h>
28#include <linux/init.h>
29#include <linux/module.h>
30#include <linux/stringify.h>
31#include <linux/kallsyms.h>
Nishanth Aravamudan5c888d52005-07-12 13:58:26 -070032#include <linux/delay.h>
Alexey Dobriyan5a891ed2009-03-10 12:55:49 -070033#include <linux/hardirq.h>
Chris Zankel5a0015d2005-06-23 22:01:16 -070034
35#include <asm/ptrace.h>
36#include <asm/timex.h>
37#include <asm/uaccess.h>
38#include <asm/pgtable.h>
39#include <asm/processor.h>
40
41#ifdef CONFIG_KGDB
42extern int gdb_enter;
43extern int return_from_debug_flag;
44#endif
45
46/*
47 * Machine specific interrupt handlers
48 */
49
50extern void kernel_exception(void);
51extern void user_exception(void);
52
53extern void fast_syscall_kernel(void);
54extern void fast_syscall_user(void);
55extern void fast_alloca(void);
56extern void fast_unaligned(void);
57extern void fast_second_level_miss(void);
58extern void fast_store_prohibited(void);
59extern void fast_coprocessor(void);
60
61extern void do_illegal_instruction (struct pt_regs*);
62extern void do_interrupt (struct pt_regs*);
63extern void do_unaligned_user (struct pt_regs*);
64extern void do_multihit (struct pt_regs*, unsigned long);
65extern void do_page_fault (struct pt_regs*, unsigned long);
66extern void do_debug (struct pt_regs*);
67extern void system_call (struct pt_regs*);
68
69/*
70 * The vector table must be preceded by a save area (which
71 * implies it must be in RAM, unless one places RAM immediately
72 * before a ROM and puts the vector at the start of the ROM (!))
73 */
74
75#define KRNL 0x01
76#define USER 0x02
77
78#define COPROCESSOR(x) \
Chris Zankel173d6682006-12-10 02:18:48 -080079{ EXCCAUSE_COPROCESSOR ## x ## _DISABLED, USER, fast_coprocessor }
Chris Zankel5a0015d2005-06-23 22:01:16 -070080
81typedef struct {
82 int cause;
83 int fast;
84 void* handler;
85} dispatch_init_table_t;
86
Chris Zankelb91dc332007-08-03 15:54:36 -070087static dispatch_init_table_t __initdata dispatch_init_table[] = {
Chris Zankel5a0015d2005-06-23 22:01:16 -070088
Chris Zankel173d6682006-12-10 02:18:48 -080089{ EXCCAUSE_ILLEGAL_INSTRUCTION, 0, do_illegal_instruction},
90{ EXCCAUSE_SYSTEM_CALL, KRNL, fast_syscall_kernel },
91{ EXCCAUSE_SYSTEM_CALL, USER, fast_syscall_user },
92{ EXCCAUSE_SYSTEM_CALL, 0, system_call },
93/* EXCCAUSE_INSTRUCTION_FETCH unhandled */
94/* EXCCAUSE_LOAD_STORE_ERROR unhandled*/
95{ EXCCAUSE_LEVEL1_INTERRUPT, 0, do_interrupt },
96{ EXCCAUSE_ALLOCA, USER|KRNL, fast_alloca },
97/* EXCCAUSE_INTEGER_DIVIDE_BY_ZERO unhandled */
98/* EXCCAUSE_PRIVILEGED unhandled */
Chris Zankel5a0015d2005-06-23 22:01:16 -070099#if XCHAL_UNALIGNED_LOAD_EXCEPTION || XCHAL_UNALIGNED_STORE_EXCEPTION
Max Filippov4ded6282012-10-15 21:23:02 +0400100#ifdef CONFIG_XTENSA_UNALIGNED_USER
Chris Zankel173d6682006-12-10 02:18:48 -0800101{ EXCCAUSE_UNALIGNED, USER, fast_unaligned },
Chris Zankel5a0015d2005-06-23 22:01:16 -0700102#else
Chris Zankel173d6682006-12-10 02:18:48 -0800103{ EXCCAUSE_UNALIGNED, 0, do_unaligned_user },
Chris Zankel5a0015d2005-06-23 22:01:16 -0700104#endif
Chris Zankel173d6682006-12-10 02:18:48 -0800105{ EXCCAUSE_UNALIGNED, KRNL, fast_unaligned },
Chris Zankel5a0015d2005-06-23 22:01:16 -0700106#endif
Johannes Weinere5083a62009-03-04 16:21:31 +0100107#ifdef CONFIG_MMU
Chris Zankel173d6682006-12-10 02:18:48 -0800108{ EXCCAUSE_ITLB_MISS, 0, do_page_fault },
109{ EXCCAUSE_ITLB_MISS, USER|KRNL, fast_second_level_miss},
110{ EXCCAUSE_ITLB_MULTIHIT, 0, do_multihit },
111{ EXCCAUSE_ITLB_PRIVILEGE, 0, do_page_fault },
112/* EXCCAUSE_SIZE_RESTRICTION unhandled */
113{ EXCCAUSE_FETCH_CACHE_ATTRIBUTE, 0, do_page_fault },
114{ EXCCAUSE_DTLB_MISS, USER|KRNL, fast_second_level_miss},
115{ EXCCAUSE_DTLB_MISS, 0, do_page_fault },
116{ EXCCAUSE_DTLB_MULTIHIT, 0, do_multihit },
117{ EXCCAUSE_DTLB_PRIVILEGE, 0, do_page_fault },
118/* EXCCAUSE_DTLB_SIZE_RESTRICTION unhandled */
119{ EXCCAUSE_STORE_CACHE_ATTRIBUTE, USER|KRNL, fast_store_prohibited },
120{ EXCCAUSE_STORE_CACHE_ATTRIBUTE, 0, do_page_fault },
121{ EXCCAUSE_LOAD_CACHE_ATTRIBUTE, 0, do_page_fault },
Johannes Weinere5083a62009-03-04 16:21:31 +0100122#endif /* CONFIG_MMU */
Chris Zankel5a0015d2005-06-23 22:01:16 -0700123/* XCCHAL_EXCCAUSE_FLOATING_POINT unhandled */
Chris Zankelc658eac2008-02-12 13:17:07 -0800124#if XTENSA_HAVE_COPROCESSOR(0)
Chris Zankel5a0015d2005-06-23 22:01:16 -0700125COPROCESSOR(0),
126#endif
Chris Zankelc658eac2008-02-12 13:17:07 -0800127#if XTENSA_HAVE_COPROCESSOR(1)
Chris Zankel5a0015d2005-06-23 22:01:16 -0700128COPROCESSOR(1),
129#endif
Chris Zankelc658eac2008-02-12 13:17:07 -0800130#if XTENSA_HAVE_COPROCESSOR(2)
Chris Zankel5a0015d2005-06-23 22:01:16 -0700131COPROCESSOR(2),
132#endif
Chris Zankelc658eac2008-02-12 13:17:07 -0800133#if XTENSA_HAVE_COPROCESSOR(3)
Chris Zankel5a0015d2005-06-23 22:01:16 -0700134COPROCESSOR(3),
135#endif
Chris Zankelc658eac2008-02-12 13:17:07 -0800136#if XTENSA_HAVE_COPROCESSOR(4)
Chris Zankel5a0015d2005-06-23 22:01:16 -0700137COPROCESSOR(4),
138#endif
Chris Zankelc658eac2008-02-12 13:17:07 -0800139#if XTENSA_HAVE_COPROCESSOR(5)
Chris Zankel5a0015d2005-06-23 22:01:16 -0700140COPROCESSOR(5),
141#endif
Chris Zankelc658eac2008-02-12 13:17:07 -0800142#if XTENSA_HAVE_COPROCESSOR(6)
Chris Zankel5a0015d2005-06-23 22:01:16 -0700143COPROCESSOR(6),
144#endif
Chris Zankelc658eac2008-02-12 13:17:07 -0800145#if XTENSA_HAVE_COPROCESSOR(7)
Chris Zankel5a0015d2005-06-23 22:01:16 -0700146COPROCESSOR(7),
147#endif
148{ EXCCAUSE_MAPPED_DEBUG, 0, do_debug },
149{ -1, -1, 0 }
150
151};
152
153/* The exception table <exc_table> serves two functions:
154 * 1. it contains three dispatch tables (fast_user, fast_kernel, default-c)
155 * 2. it is a temporary memory buffer for the exception handlers.
156 */
157
158unsigned long exc_table[EXC_TABLE_SIZE/4];
159
160void die(const char*, struct pt_regs*, long);
161
162static inline void
163__die_if_kernel(const char *str, struct pt_regs *regs, long err)
164{
165 if (!user_mode(regs))
166 die(str, regs, err);
167}
168
169/*
170 * Unhandled Exceptions. Kill user task or panic if in kernel space.
171 */
172
173void do_unhandled(struct pt_regs *regs, unsigned long exccause)
174{
175 __die_if_kernel("Caught unhandled exception - should not happen",
176 regs, SIGKILL);
177
178 /* If in user mode, send SIGILL signal to current process */
179 printk("Caught unhandled exception in '%s' "
180 "(pid = %d, pc = %#010lx) - should not happen\n"
181 "\tEXCCAUSE is %ld\n",
Alexey Dobriyan19c58702007-10-18 23:40:41 -0700182 current->comm, task_pid_nr(current), regs->pc, exccause);
Chris Zankel5a0015d2005-06-23 22:01:16 -0700183 force_sig(SIGILL, current);
184}
185
186/*
187 * Multi-hit exception. This if fatal!
188 */
189
190void do_multihit(struct pt_regs *regs, unsigned long exccause)
191{
192 die("Caught multihit exception", regs, SIGKILL);
193}
194
195/*
Marc Gauthier2d1c6452013-01-05 04:57:17 +0400196 * IRQ handler.
197 * PS.INTLEVEL is the current IRQ priority level.
Chris Zankel5a0015d2005-06-23 22:01:16 -0700198 */
199
Chris Zankel5a0015d2005-06-23 22:01:16 -0700200extern void do_IRQ(int, struct pt_regs *);
201
Marc Gauthier2d1c6452013-01-05 04:57:17 +0400202void do_interrupt(struct pt_regs *regs)
Chris Zankel5a0015d2005-06-23 22:01:16 -0700203{
Marc Gauthier2d1c6452013-01-05 04:57:17 +0400204 static const unsigned int_level_mask[] = {
205 0,
206 XCHAL_INTLEVEL1_MASK,
207 XCHAL_INTLEVEL2_MASK,
208 XCHAL_INTLEVEL3_MASK,
209 XCHAL_INTLEVEL4_MASK,
210 XCHAL_INTLEVEL5_MASK,
211 XCHAL_INTLEVEL6_MASK,
212 XCHAL_INTLEVEL7_MASK,
213 };
214 unsigned level = get_sr(ps) & PS_INTLEVEL_MASK;
Chris Zankel5a0015d2005-06-23 22:01:16 -0700215
Marc Gauthier2d1c6452013-01-05 04:57:17 +0400216 if (WARN_ON_ONCE(level >= ARRAY_SIZE(int_level_mask)))
217 return;
Chris Zankel5a0015d2005-06-23 22:01:16 -0700218
Marc Gauthier2d1c6452013-01-05 04:57:17 +0400219 for (;;) {
220 unsigned intread = get_sr(interrupt);
221 unsigned intenable = get_sr(intenable);
222 unsigned int_at_level = intread & intenable &
223 int_level_mask[level];
224
225 if (!int_at_level)
226 return;
227
228 /*
229 * Clear the interrupt before processing, in case it's
230 * edge-triggered or software-generated
231 */
232 while (int_at_level) {
233 unsigned i = __ffs(int_at_level);
234 unsigned mask = 1 << i;
235
236 int_at_level ^= mask;
237 set_sr(mask, intclear);
238 do_IRQ(i, regs);
Chris Zankel5a0015d2005-06-23 22:01:16 -0700239 }
240 }
241}
242
243/*
244 * Illegal instruction. Fatal if in kernel space.
245 */
246
247void
248do_illegal_instruction(struct pt_regs *regs)
249{
250 __die_if_kernel("Illegal instruction in kernel", regs, SIGKILL);
251
252 /* If in user mode, send SIGILL signal to current process. */
253
254 printk("Illegal Instruction in '%s' (pid = %d, pc = %#010lx)\n",
Alexey Dobriyan19c58702007-10-18 23:40:41 -0700255 current->comm, task_pid_nr(current), regs->pc);
Chris Zankel5a0015d2005-06-23 22:01:16 -0700256 force_sig(SIGILL, current);
257}
258
259
260/*
261 * Handle unaligned memory accesses from user space. Kill task.
262 *
263 * If CONFIG_UNALIGNED_USER is not set, we don't allow unaligned memory
264 * accesses causes from user space.
265 */
266
267#if XCHAL_UNALIGNED_LOAD_EXCEPTION || XCHAL_UNALIGNED_STORE_EXCEPTION
Max Filippov4ded6282012-10-15 21:23:02 +0400268#ifndef CONFIG_XTENSA_UNALIGNED_USER
Chris Zankel5a0015d2005-06-23 22:01:16 -0700269void
270do_unaligned_user (struct pt_regs *regs)
271{
272 siginfo_t info;
273
274 __die_if_kernel("Unhandled unaligned exception in kernel",
275 regs, SIGKILL);
276
277 current->thread.bad_vaddr = regs->excvaddr;
278 current->thread.error_code = -3;
279 printk("Unaligned memory access to %08lx in '%s' "
280 "(pid = %d, pc = %#010lx)\n",
Alexey Dobriyan19c58702007-10-18 23:40:41 -0700281 regs->excvaddr, current->comm, task_pid_nr(current), regs->pc);
Chris Zankel5a0015d2005-06-23 22:01:16 -0700282 info.si_signo = SIGBUS;
283 info.si_errno = 0;
284 info.si_code = BUS_ADRALN;
285 info.si_addr = (void *) regs->excvaddr;
286 force_sig_info(SIGSEGV, &info, current);
287
288}
289#endif
290#endif
291
292void
293do_debug(struct pt_regs *regs)
294{
295#ifdef CONFIG_KGDB
296 /* If remote debugging is configured AND enabled, we give control to
297 * kgdb. Otherwise, we fall through, perhaps giving control to the
298 * native debugger.
299 */
300
301 if (gdb_enter) {
302 extern void gdb_handle_exception(struct pt_regs *);
303 gdb_handle_exception(regs);
304 return_from_debug_flag = 1;
305 return;
306 }
307#endif
308
309 __die_if_kernel("Breakpoint in kernel", regs, SIGKILL);
310
311 /* If in user mode, send SIGTRAP signal to current process */
312
313 force_sig(SIGTRAP, current);
314}
315
316
Max Filippov28570e82012-11-19 08:30:15 +0400317/* Set exception C handler - for temporary use when probing exceptions */
318
319void * __init trap_set_handler(int cause, void *handler)
320{
321 unsigned long *entry = &exc_table[EXC_TABLE_DEFAULT / 4 + cause];
322 void *previous = (void *)*entry;
323 *entry = (unsigned long)handler;
324 return previous;
325}
326
327
Chris Zankel5a0015d2005-06-23 22:01:16 -0700328/*
329 * Initialize dispatch tables.
330 *
331 * The exception vectors are stored compressed the __init section in the
332 * dispatch_init_table. This function initializes the following three tables
333 * from that compressed table:
334 * - fast user first dispatch table for user exceptions
335 * - fast kernel first dispatch table for kernel exceptions
336 * - default C-handler C-handler called by the default fast handler.
337 *
338 * See vectors.S for more details.
339 */
340
341#define set_handler(idx,handler) (exc_table[idx] = (unsigned long) (handler))
342
Chris Zankelb91dc332007-08-03 15:54:36 -0700343void __init trap_init(void)
Chris Zankel5a0015d2005-06-23 22:01:16 -0700344{
345 int i;
346
347 /* Setup default vectors. */
348
349 for(i = 0; i < 64; i++) {
350 set_handler(EXC_TABLE_FAST_USER/4 + i, user_exception);
351 set_handler(EXC_TABLE_FAST_KERNEL/4 + i, kernel_exception);
352 set_handler(EXC_TABLE_DEFAULT/4 + i, do_unhandled);
353 }
354
355 /* Setup specific handlers. */
356
357 for(i = 0; dispatch_init_table[i].cause >= 0; i++) {
358
359 int fast = dispatch_init_table[i].fast;
360 int cause = dispatch_init_table[i].cause;
361 void *handler = dispatch_init_table[i].handler;
362
363 if (fast == 0)
364 set_handler (EXC_TABLE_DEFAULT/4 + cause, handler);
365 if (fast && fast & USER)
366 set_handler (EXC_TABLE_FAST_USER/4 + cause, handler);
367 if (fast && fast & KRNL)
368 set_handler (EXC_TABLE_FAST_KERNEL/4 + cause, handler);
369 }
370
371 /* Initialize EXCSAVE_1 to hold the address of the exception table. */
372
373 i = (unsigned long)exc_table;
Max Filippovbc5378f2012-10-15 03:55:38 +0400374 __asm__ __volatile__("wsr %0, excsave1\n" : : "a" (i));
Chris Zankel5a0015d2005-06-23 22:01:16 -0700375}
376
377/*
378 * This function dumps the current valid window frame and other base registers.
379 */
380
381void show_regs(struct pt_regs * regs)
382{
383 int i, wmask;
384
385 wmask = regs->wmask & ~1;
386
Chris Zankel8d7e8242008-02-12 11:55:32 -0800387 for (i = 0; i < 16; i++) {
Chris Zankel5a0015d2005-06-23 22:01:16 -0700388 if ((i % 8) == 0)
Joe Perchesad361c92009-07-06 13:05:40 -0700389 printk(KERN_INFO "a%02d:", i);
390 printk(KERN_CONT " %08lx", regs->areg[i]);
Chris Zankel5a0015d2005-06-23 22:01:16 -0700391 }
Joe Perchesad361c92009-07-06 13:05:40 -0700392 printk(KERN_CONT "\n");
Chris Zankel5a0015d2005-06-23 22:01:16 -0700393
394 printk("pc: %08lx, ps: %08lx, depc: %08lx, excvaddr: %08lx\n",
395 regs->pc, regs->ps, regs->depc, regs->excvaddr);
396 printk("lbeg: %08lx, lend: %08lx lcount: %08lx, sar: %08lx\n",
397 regs->lbeg, regs->lend, regs->lcount, regs->sar);
398 if (user_mode(regs))
399 printk("wb: %08lx, ws: %08lx, wmask: %08lx, syscall: %ld\n",
400 regs->windowbase, regs->windowstart, regs->wmask,
401 regs->syscall);
402}
403
Johannes Weiner586411d2009-05-11 15:43:33 +0200404static __always_inline unsigned long *stack_pointer(struct task_struct *task)
405{
406 unsigned long *sp;
407
408 if (!task || task == current)
409 __asm__ __volatile__ ("mov %0, a1\n" : "=a"(sp));
410 else
411 sp = (unsigned long *)task->thread.sp;
412
413 return sp;
414}
415
David Howellsf9aa7e12012-03-28 18:30:03 +0100416static inline void spill_registers(void)
417{
418 unsigned int a0, ps;
419
420 __asm__ __volatile__ (
Marc Gauthier2d1c6452013-01-05 04:57:17 +0400421 "movi a14, " __stringify(PS_EXCM_BIT | LOCKLEVEL) "\n\t"
David Howellsf9aa7e12012-03-28 18:30:03 +0100422 "mov a12, a0\n\t"
Max Filippovbc5378f2012-10-15 03:55:38 +0400423 "rsr a13, sar\n\t"
424 "xsr a14, ps\n\t"
David Howellsf9aa7e12012-03-28 18:30:03 +0100425 "movi a0, _spill_registers\n\t"
426 "rsync\n\t"
427 "callx0 a0\n\t"
428 "mov a0, a12\n\t"
Max Filippovbc5378f2012-10-15 03:55:38 +0400429 "wsr a13, sar\n\t"
430 "wsr a14, ps\n\t"
David Howellsf9aa7e12012-03-28 18:30:03 +0100431 :: "a" (&a0), "a" (&ps)
Chris Zankelc4c45942012-11-28 16:53:51 -0800432 : "a2", "a3", "a4", "a7", "a11", "a12", "a13", "a14", "a15",
433 "memory");
David Howellsf9aa7e12012-03-28 18:30:03 +0100434}
435
Chris Zankel5a0015d2005-06-23 22:01:16 -0700436void show_trace(struct task_struct *task, unsigned long *sp)
437{
438 unsigned long a0, a1, pc;
439 unsigned long sp_start, sp_end;
440
Johannes Weiner28a0ce72009-03-04 16:21:29 +0100441 if (sp)
442 a1 = (unsigned long)sp;
443 else
Johannes Weiner586411d2009-05-11 15:43:33 +0200444 a1 = (unsigned long)stack_pointer(task);
Chris Zankel5a0015d2005-06-23 22:01:16 -0700445
446 sp_start = a1 & ~(THREAD_SIZE-1);
447 sp_end = sp_start + THREAD_SIZE;
448
449 printk("Call Trace:");
450#ifdef CONFIG_KALLSYMS
451 printk("\n");
452#endif
453 spill_registers();
454
455 while (a1 > sp_start && a1 < sp_end) {
456 sp = (unsigned long*)a1;
457
458 a0 = *(sp - 4);
459 a1 = *(sp - 3);
460
461 if (a1 <= (unsigned long) sp)
462 break;
463
464 pc = MAKE_PC_FROM_RA(a0, a1);
465
466 if (kernel_text_address(pc)) {
467 printk(" [<%08lx>] ", pc);
468 print_symbol("%s\n", pc);
469 }
470 }
471 printk("\n");
472}
473
474/*
475 * This routine abuses get_user()/put_user() to reference pointers
476 * with at least a bit of error checking ...
477 */
478
479static int kstack_depth_to_print = 24;
480
481void show_stack(struct task_struct *task, unsigned long *sp)
482{
483 int i = 0;
484 unsigned long *stack;
485
Johannes Weiner28a0ce72009-03-04 16:21:29 +0100486 if (!sp)
Johannes Weiner586411d2009-05-11 15:43:33 +0200487 sp = stack_pointer(task);
Chris Zankelc4c45942012-11-28 16:53:51 -0800488 stack = sp;
Chris Zankel5a0015d2005-06-23 22:01:16 -0700489
490 printk("\nStack: ");
491
492 for (i = 0; i < kstack_depth_to_print; i++) {
493 if (kstack_end(sp))
494 break;
495 if (i && ((i % 8) == 0))
496 printk("\n ");
497 printk("%08lx ", *sp++);
498 }
499 printk("\n");
500 show_trace(task, stack);
501}
502
503void dump_stack(void)
504{
505 show_stack(current, NULL);
506}
507
508EXPORT_SYMBOL(dump_stack);
509
510
511void show_code(unsigned int *pc)
512{
513 long i;
514
515 printk("\nCode:");
516
517 for(i = -3 ; i < 6 ; i++) {
518 unsigned long insn;
519 if (__get_user(insn, pc + i)) {
520 printk(" (Bad address in pc)\n");
521 break;
522 }
523 printk("%c%08lx%c",(i?' ':'<'),insn,(i?' ':'>'));
524 }
525}
526
Ingo Molnar34af9462006-06-27 02:53:55 -0700527DEFINE_SPINLOCK(die_lock);
Chris Zankel5a0015d2005-06-23 22:01:16 -0700528
529void die(const char * str, struct pt_regs * regs, long err)
530{
531 static int die_counter;
532 int nl = 0;
533
534 console_verbose();
535 spin_lock_irq(&die_lock);
536
537 printk("%s: sig: %ld [#%d]\n", str, err, ++die_counter);
538#ifdef CONFIG_PREEMPT
539 printk("PREEMPT ");
540 nl = 1;
541#endif
542 if (nl)
543 printk("\n");
544 show_regs(regs);
545 if (!user_mode(regs))
546 show_stack(NULL, (unsigned long*)regs->areg[1]);
547
Pavel Emelianovbcdcd8e2007-07-17 04:03:42 -0700548 add_taint(TAINT_DIE);
Chris Zankel5a0015d2005-06-23 22:01:16 -0700549 spin_unlock_irq(&die_lock);
550
551 if (in_interrupt())
552 panic("Fatal exception in interrupt");
553
Hormscea6a4b2006-07-30 03:03:34 -0700554 if (panic_on_oops)
Horms012c4372006-08-13 23:24:22 -0700555 panic("Fatal exception");
Hormscea6a4b2006-07-30 03:03:34 -0700556
Chris Zankel5a0015d2005-06-23 22:01:16 -0700557 do_exit(err);
558}