]>
git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - arch/microblaze/kernel/traps.c
2 * Copyright (C) 2007-2009 Michal Simek <monstr@monstr.eu>
3 * Copyright (C) 2007-2009 PetaLogix
4 * Copyright (C) 2006 Atmark Techno, Inc.
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
11 #include <linux/kernel.h>
12 #include <linux/kallsyms.h>
13 #include <linux/module.h>
14 #include <linux/sched.h>
15 #include <linux/debug_locks.h>
17 #include <asm/exceptions.h>
18 #include <asm/system.h>
22 __enable_hw_exceptions();
25 void __bad_xchg(volatile void *ptr
, int size
)
27 printk(KERN_INFO
"xchg: bad data size: pc 0x%p, ptr 0x%p, size %d\n",
28 __builtin_return_address(0), ptr
, size
);
31 EXPORT_SYMBOL(__bad_xchg
);
33 static int kstack_depth_to_print
= 24;
35 static int __init
kstack_setup(char *s
)
37 kstack_depth_to_print
= strict_strtoul(s
, 0, 0);
41 __setup("kstack=", kstack_setup
);
43 void show_trace(struct task_struct
*task
, unsigned long *stack
)
48 stack
= (unsigned long *)&stack
;
50 printk(KERN_NOTICE
"Call Trace: ");
51 #ifdef CONFIG_KALLSYMS
52 printk(KERN_NOTICE
"\n");
54 while (!kstack_end(stack
)) {
57 * If the address is either in the text segment of the
58 * kernel, or in the region which contains vmalloc'ed
59 * memory, it *may* be the address of a calling
60 * routine; if so, print it so that someone tracing
61 * down the cause of the crash will be able to figure
62 * out the call path that was taken.
64 if (kernel_text_address(addr
))
67 printk(KERN_NOTICE
"\n");
72 debug_show_held_locks(task
);
75 void show_stack(struct task_struct
*task
, unsigned long *sp
)
82 sp
= (unsigned long *) ((struct thread_info
*)
83 (task
->stack
))->cpu_context
.r1
;
85 sp
= (unsigned long *)&sp
;
90 printk(KERN_INFO
"\nStack:\n ");
92 for (i
= 0; i
< kstack_depth_to_print
; i
++) {
95 if (i
&& ((i
% 8) == 0))
97 printk("%08lx ", *sp
++);
100 show_trace(task
, stack
);
103 void dump_stack(void)
105 show_stack(NULL
, NULL
);
107 EXPORT_SYMBOL(dump_stack
);