Commit 059163ca authored by Mikael Starvik's avatar Mikael Starvik Committed by Linus Torvalds

[PATCH] CRIS update: debug

Improvements to crash debug code.
Signed-off-by: default avatarMikael Starvik <starvik@axis.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 05b4c28c
/* $Id: traps.c,v 1.2 2003/07/04 08:27:41 starvik Exp $ /* $Id: traps.c,v 1.4 2005/04/24 18:47:55 starvik Exp $
* *
* linux/arch/cris/arch-v10/traps.c * linux/arch/cris/arch-v10/traps.c
* *
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/arch/sv_addr_ag.h> #include <asm/arch/sv_addr_ag.h>
extern int raw_printk(const char *fmt, ...);
void void
show_registers(struct pt_regs * regs) show_registers(struct pt_regs * regs)
{ {
...@@ -26,18 +28,18 @@ show_registers(struct pt_regs * regs) ...@@ -26,18 +28,18 @@ show_registers(struct pt_regs * regs)
register. */ register. */
unsigned long usp = rdusp(); unsigned long usp = rdusp();
printk("IRP: %08lx SRP: %08lx DCCR: %08lx USP: %08lx MOF: %08lx\n", raw_printk("IRP: %08lx SRP: %08lx DCCR: %08lx USP: %08lx MOF: %08lx\n",
regs->irp, regs->srp, regs->dccr, usp, regs->mof ); regs->irp, regs->srp, regs->dccr, usp, regs->mof );
printk(" r0: %08lx r1: %08lx r2: %08lx r3: %08lx\n", raw_printk(" r0: %08lx r1: %08lx r2: %08lx r3: %08lx\n",
regs->r0, regs->r1, regs->r2, regs->r3); regs->r0, regs->r1, regs->r2, regs->r3);
printk(" r4: %08lx r5: %08lx r6: %08lx r7: %08lx\n", raw_printk(" r4: %08lx r5: %08lx r6: %08lx r7: %08lx\n",
regs->r4, regs->r5, regs->r6, regs->r7); regs->r4, regs->r5, regs->r6, regs->r7);
printk(" r8: %08lx r9: %08lx r10: %08lx r11: %08lx\n", raw_printk(" r8: %08lx r9: %08lx r10: %08lx r11: %08lx\n",
regs->r8, regs->r9, regs->r10, regs->r11); regs->r8, regs->r9, regs->r10, regs->r11);
printk("r12: %08lx r13: %08lx oR10: %08lx\n", raw_printk("r12: %08lx r13: %08lx oR10: %08lx sp: %08lx\n",
regs->r12, regs->r13, regs->orig_r10); regs->r12, regs->r13, regs->orig_r10, regs);
printk("R_MMU_CAUSE: %08lx\n", (unsigned long)*R_MMU_CAUSE); raw_printk("R_MMU_CAUSE: %08lx\n", (unsigned long)*R_MMU_CAUSE);
printk("Process %s (pid: %d, stackpage=%08lx)\n", raw_printk("Process %s (pid: %d, stackpage=%08lx)\n",
current->comm, current->pid, (unsigned long)current); current->comm, current->pid, (unsigned long)current);
/* /*
...@@ -53,7 +55,7 @@ show_registers(struct pt_regs * regs) ...@@ -53,7 +55,7 @@ show_registers(struct pt_regs * regs)
if (usp != 0) if (usp != 0)
show_stack (NULL, NULL); show_stack (NULL, NULL);
printk("\nCode: "); raw_printk("\nCode: ");
if(regs->irp < PAGE_OFFSET) if(regs->irp < PAGE_OFFSET)
goto bad; goto bad;
...@@ -70,16 +72,16 @@ show_registers(struct pt_regs * regs) ...@@ -70,16 +72,16 @@ show_registers(struct pt_regs * regs)
unsigned char c; unsigned char c;
if(__get_user(c, &((unsigned char*)regs->irp)[i])) { if(__get_user(c, &((unsigned char*)regs->irp)[i])) {
bad: bad:
printk(" Bad IP value."); raw_printk(" Bad IP value.");
break; break;
} }
if (i == 0) if (i == 0)
printk("(%02x) ", c); raw_printk("(%02x) ", c);
else else
printk("%02x ", c); raw_printk("%02x ", c);
} }
printk("\n"); raw_printk("\n");
} }
} }
...@@ -121,7 +123,7 @@ die_if_kernel(const char * str, struct pt_regs * regs, long err) ...@@ -121,7 +123,7 @@ die_if_kernel(const char * str, struct pt_regs * regs, long err)
stop_watchdog(); stop_watchdog();
#endif #endif
printk("%s: %04lx\n", str, err & 0xffff); raw_printk("%s: %04lx\n", str, err & 0xffff);
show_registers(regs); show_registers(regs);
...@@ -130,3 +132,8 @@ die_if_kernel(const char * str, struct pt_regs * regs, long err) ...@@ -130,3 +132,8 @@ die_if_kernel(const char * str, struct pt_regs * regs, long err)
#endif #endif
do_exit(SIGSEGV); do_exit(SIGSEGV);
} }
void arch_enable_nmi(void)
{
asm volatile("setf m");
}
/* $Id: traps.c,v 1.9 2004/05/11 12:28:26 starvik Exp $ /* $Id: traps.c,v 1.11 2005/01/24 16:03:19 orjanf Exp $
* *
* linux/arch/cris/traps.c * linux/arch/cris/traps.c
* *
...@@ -20,13 +20,15 @@ ...@@ -20,13 +20,15 @@
static int kstack_depth_to_print = 24; static int kstack_depth_to_print = 24;
extern int raw_printk(const char *fmt, ...);
void show_trace(unsigned long * stack) void show_trace(unsigned long * stack)
{ {
unsigned long addr, module_start, module_end; unsigned long addr, module_start, module_end;
extern char _stext, _etext; extern char _stext, _etext;
int i; int i;
printk("\nCall Trace: "); raw_printk("\nCall Trace: ");
i = 1; i = 1;
module_start = VMALLOC_START; module_start = VMALLOC_START;
...@@ -37,7 +39,7 @@ void show_trace(unsigned long * stack) ...@@ -37,7 +39,7 @@ void show_trace(unsigned long * stack)
/* This message matches "failing address" marked /* This message matches "failing address" marked
s390 in ksymoops, so lines containing it will s390 in ksymoops, so lines containing it will
not be filtered out by ksymoops. */ not be filtered out by ksymoops. */
printk ("Failing address 0x%lx\n", (unsigned long)stack); raw_printk ("Failing address 0x%lx\n", (unsigned long)stack);
break; break;
} }
stack++; stack++;
...@@ -54,8 +56,8 @@ void show_trace(unsigned long * stack) ...@@ -54,8 +56,8 @@ void show_trace(unsigned long * stack)
(addr <= (unsigned long) &_etext)) || (addr <= (unsigned long) &_etext)) ||
((addr >= module_start) && (addr <= module_end))) { ((addr >= module_start) && (addr <= module_end))) {
if (i && ((i % 8) == 0)) if (i && ((i % 8) == 0))
printk("\n "); raw_printk("\n ");
printk("[<%08lx>] ", addr); raw_printk("[<%08lx>] ", addr);
i++; i++;
} }
} }
...@@ -96,25 +98,59 @@ show_stack(struct task_struct *task, unsigned long *sp) ...@@ -96,25 +98,59 @@ show_stack(struct task_struct *task, unsigned long *sp)
stack = sp; stack = sp;
printk("\nStack from %08lx:\n ", (unsigned long)stack); raw_printk("\nStack from %08lx:\n ", (unsigned long)stack);
for(i = 0; i < kstack_depth_to_print; i++) { for(i = 0; i < kstack_depth_to_print; i++) {
if (((long) stack & (THREAD_SIZE-1)) == 0) if (((long) stack & (THREAD_SIZE-1)) == 0)
break; break;
if (i && ((i % 8) == 0)) if (i && ((i % 8) == 0))
printk("\n "); raw_printk("\n ");
if (__get_user (addr, stack)) { if (__get_user (addr, stack)) {
/* This message matches "failing address" marked /* This message matches "failing address" marked
s390 in ksymoops, so lines containing it will s390 in ksymoops, so lines containing it will
not be filtered out by ksymoops. */ not be filtered out by ksymoops. */
printk ("Failing address 0x%lx\n", (unsigned long)stack); raw_printk ("Failing address 0x%lx\n", (unsigned long)stack);
break; break;
} }
stack++; stack++;
printk("%08lx ", addr); raw_printk("%08lx ", addr);
} }
show_trace(sp); show_trace(sp);
} }
static void (*nmi_handler)(struct pt_regs*);
extern void arch_enable_nmi(void);
void set_nmi_handler(void (*handler)(struct pt_regs*))
{
nmi_handler = handler;
arch_enable_nmi();
}
void handle_nmi(struct pt_regs* regs)
{
if (nmi_handler)
nmi_handler(regs);
}
#ifdef CONFIG_DEBUG_NMI_OOPS
void oops_nmi_handler(struct pt_regs* regs)
{
stop_watchdog();
raw_printk("NMI!\n");
show_registers(regs);
}
static int
__init oops_nmi_register(void)
{
set_nmi_handler(oops_nmi_handler);
return 0;
}
__initcall(oops_nmi_register);
#endif
#if 0 #if 0
/* displays a short stack trace */ /* displays a short stack trace */
...@@ -123,9 +159,9 @@ show_stack() ...@@ -123,9 +159,9 @@ show_stack()
{ {
unsigned long *sp = (unsigned long *)rdusp(); unsigned long *sp = (unsigned long *)rdusp();
int i; int i;
printk("Stack dump [0x%08lx]:\n", (unsigned long)sp); raw_printk("Stack dump [0x%08lx]:\n", (unsigned long)sp);
for(i = 0; i < 16; i++) for(i = 0; i < 16; i++)
printk("sp + %d: 0x%08lx\n", i*4, sp[i]); raw_printk("sp + %d: 0x%08lx\n", i*4, sp[i]);
return 0; return 0;
} }
#endif #endif
...@@ -142,3 +178,9 @@ trap_init(void) ...@@ -142,3 +178,9 @@ trap_init(void)
{ {
/* Nothing needs to be done */ /* Nothing needs to be done */
} }
void spinning_cpu(void* addr)
{
raw_printk("CPU %d spinning on %X\n", smp_processor_id(), addr);
dump_stack();
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment