aboutsummaryrefslogtreecommitdiffstats
path: root/arch/cris/kernel/traps.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/cris/kernel/traps.c')
-rw-r--r--arch/cris/kernel/traps.c64
1 files changed, 53 insertions, 11 deletions
diff --git a/arch/cris/kernel/traps.c b/arch/cris/kernel/traps.c
index d4dfa050e3a5..520d92205fed 100644
--- a/arch/cris/kernel/traps.c
+++ b/arch/cris/kernel/traps.c
@@ -1,4 +1,4 @@
1/* $Id: traps.c,v 1.9 2004/05/11 12:28:26 starvik Exp $ 1/* $Id: traps.c,v 1.11 2005/01/24 16:03:19 orjanf Exp $
2 * 2 *
3 * linux/arch/cris/traps.c 3 * linux/arch/cris/traps.c
4 * 4 *
@@ -20,13 +20,15 @@
20 20
21static int kstack_depth_to_print = 24; 21static int kstack_depth_to_print = 24;
22 22
23extern int raw_printk(const char *fmt, ...);
24
23void show_trace(unsigned long * stack) 25void show_trace(unsigned long * stack)
24{ 26{
25 unsigned long addr, module_start, module_end; 27 unsigned long addr, module_start, module_end;
26 extern char _stext, _etext; 28 extern char _stext, _etext;
27 int i; 29 int i;
28 30
29 printk("\nCall Trace: "); 31 raw_printk("\nCall Trace: ");
30 32
31 i = 1; 33 i = 1;
32 module_start = VMALLOC_START; 34 module_start = VMALLOC_START;
@@ -37,7 +39,7 @@ void show_trace(unsigned long * stack)
37 /* This message matches "failing address" marked 39 /* This message matches "failing address" marked
38 s390 in ksymoops, so lines containing it will 40 s390 in ksymoops, so lines containing it will
39 not be filtered out by ksymoops. */ 41 not be filtered out by ksymoops. */
40 printk ("Failing address 0x%lx\n", (unsigned long)stack); 42 raw_printk ("Failing address 0x%lx\n", (unsigned long)stack);
41 break; 43 break;
42 } 44 }
43 stack++; 45 stack++;
@@ -54,8 +56,8 @@ void show_trace(unsigned long * stack)
54 (addr <= (unsigned long) &_etext)) || 56 (addr <= (unsigned long) &_etext)) ||
55 ((addr >= module_start) && (addr <= module_end))) { 57 ((addr >= module_start) && (addr <= module_end))) {
56 if (i && ((i % 8) == 0)) 58 if (i && ((i % 8) == 0))
57 printk("\n "); 59 raw_printk("\n ");
58 printk("[<%08lx>] ", addr); 60 raw_printk("[<%08lx>] ", addr);
59 i++; 61 i++;
60 } 62 }
61 } 63 }
@@ -96,25 +98,59 @@ show_stack(struct task_struct *task, unsigned long *sp)
96 98
97 stack = sp; 99 stack = sp;
98 100
99 printk("\nStack from %08lx:\n ", (unsigned long)stack); 101 raw_printk("\nStack from %08lx:\n ", (unsigned long)stack);
100 for(i = 0; i < kstack_depth_to_print; i++) { 102 for(i = 0; i < kstack_depth_to_print; i++) {
101 if (((long) stack & (THREAD_SIZE-1)) == 0) 103 if (((long) stack & (THREAD_SIZE-1)) == 0)
102 break; 104 break;
103 if (i && ((i % 8) == 0)) 105 if (i && ((i % 8) == 0))
104 printk("\n "); 106 raw_printk("\n ");
105 if (__get_user (addr, stack)) { 107 if (__get_user (addr, stack)) {
106 /* This message matches "failing address" marked 108 /* This message matches "failing address" marked
107 s390 in ksymoops, so lines containing it will 109 s390 in ksymoops, so lines containing it will
108 not be filtered out by ksymoops. */ 110 not be filtered out by ksymoops. */
109 printk ("Failing address 0x%lx\n", (unsigned long)stack); 111 raw_printk ("Failing address 0x%lx\n", (unsigned long)stack);
110 break; 112 break;
111 } 113 }
112 stack++; 114 stack++;
113 printk("%08lx ", addr); 115 raw_printk("%08lx ", addr);
114 } 116 }
115 show_trace(sp); 117 show_trace(sp);
116} 118}
117 119
120static void (*nmi_handler)(struct pt_regs*);
121extern void arch_enable_nmi(void);
122
123void set_nmi_handler(void (*handler)(struct pt_regs*))
124{
125 nmi_handler = handler;
126 arch_enable_nmi();
127}
128
129void handle_nmi(struct pt_regs* regs)
130{
131 if (nmi_handler)
132 nmi_handler(regs);
133}
134
135#ifdef CONFIG_DEBUG_NMI_OOPS
136void oops_nmi_handler(struct pt_regs* regs)
137{
138 stop_watchdog();
139 raw_printk("NMI!\n");
140 show_registers(regs);
141}
142
143static int
144__init oops_nmi_register(void)
145{
146 set_nmi_handler(oops_nmi_handler);
147 return 0;
148}
149
150__initcall(oops_nmi_register);
151
152#endif
153
118#if 0 154#if 0
119/* displays a short stack trace */ 155/* displays a short stack trace */
120 156
@@ -123,9 +159,9 @@ show_stack()
123{ 159{
124 unsigned long *sp = (unsigned long *)rdusp(); 160 unsigned long *sp = (unsigned long *)rdusp();
125 int i; 161 int i;
126 printk("Stack dump [0x%08lx]:\n", (unsigned long)sp); 162 raw_printk("Stack dump [0x%08lx]:\n", (unsigned long)sp);
127 for(i = 0; i < 16; i++) 163 for(i = 0; i < 16; i++)
128 printk("sp + %d: 0x%08lx\n", i*4, sp[i]); 164 raw_printk("sp + %d: 0x%08lx\n", i*4, sp[i]);
129 return 0; 165 return 0;
130} 166}
131#endif 167#endif
@@ -142,3 +178,9 @@ trap_init(void)
142{ 178{
143 /* Nothing needs to be done */ 179 /* Nothing needs to be done */
144} 180}
181
182void spinning_cpu(void* addr)
183{
184 raw_printk("CPU %d spinning on %X\n", smp_processor_id(), addr);
185 dump_stack();
186}