summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Blanchard <anton@samba.org>2002-11-23 14:33:20 +1100
committerAnton Blanchard <anton@samba.org>2002-11-23 14:33:20 +1100
commit31fa8532ec0f32402fe3ebf97d87dc714cb96185 (patch)
tree057dcec02563b1ba977f12688f344508855e904f
parentb4bf25f2464b48a908c9a230d73877b6b12d96d7 (diff)
ppc64: clean up show_regs and remove print_backtrace
-rw-r--r--arch/ppc64/kernel/open_pic.c7
-rw-r--r--arch/ppc64/kernel/process.c78
-rw-r--r--arch/ppc64/kernel/traps.c2
-rw-r--r--arch/ppc64/kernel/xics.c3
-rw-r--r--include/asm-ppc64/hardirq.h9
-rw-r--r--include/asm-ppc64/system.h1
6 files changed, 39 insertions, 61 deletions
diff --git a/arch/ppc64/kernel/open_pic.c b/arch/ppc64/kernel/open_pic.c
index 3ab7887b453b..96979fe39a67 100644
--- a/arch/ppc64/kernel/open_pic.c
+++ b/arch/ppc64/kernel/open_pic.c
@@ -11,9 +11,10 @@
#include <linux/config.h>
#include <linux/types.h>
#include <linux/kernel.h>
-#include <linux/sched.h>
#include <linux/init.h>
#include <linux/irq.h>
+#include <linux/smp.h>
+#include <linux/interrupt.h>
#include <asm/ptrace.h>
#include <asm/signal.h>
#include <asm/io.h>
@@ -114,11 +115,11 @@ extern unsigned long* _get_SP(void);
#define check_arg_irq(irq) \
if (irq < open_pic_irq_offset || irq >= (NumSources+open_pic_irq_offset)){ \
printk(KERN_ERR "open_pic.c:%d: illegal irq %d\n", __LINE__, irq); \
- print_backtrace(_get_SP()); }
+ dump_stack(); }
#define check_arg_cpu(cpu) \
if (cpu < 0 || cpu >= OPENPIC_MAX_PROCESSORS){ \
printk(KERN_ERR "open_pic.c:%d: illegal cpu %d\n", __LINE__, cpu); \
- print_backtrace(_get_SP()); }
+ dump_stack(); }
#else
#define check_arg_ipi(ipi) do {} while (0)
#define check_arg_timer(timer) do {} while (0)
diff --git a/arch/ppc64/kernel/process.c b/arch/ppc64/kernel/process.c
index 962779ec9969..f21973c0a733 100644
--- a/arch/ppc64/kernel/process.c
+++ b/arch/ppc64/kernel/process.c
@@ -103,6 +103,8 @@ __switch_to(struct task_struct *prev, struct task_struct *new)
local_irq_restore(flags);
}
+static void show_tsk_stack(struct task_struct *p, unsigned long sp);
+
void show_regs(struct pt_regs * regs)
{
int i;
@@ -114,32 +116,26 @@ void show_regs(struct pt_regs * regs)
regs->msr & MSR_FP ? 1 : 0,regs->msr&MSR_ME ? 1 : 0,
regs->msr&MSR_IR ? 1 : 0,
regs->msr&MSR_DR ? 1 : 0);
+ if (regs->trap == 0x300 || regs->trap == 0x380 || regs->trap == 0x600)
+ printk("DAR: %016lx, DSISR: %016lx\n", regs->dar, regs->dsisr);
printk("TASK = %p[%d] '%s' ",
current, current->pid, current->comm);
- printk("\nlast math %p ", last_task_used_math);
-
+
#ifdef CONFIG_SMP
- /* printk(" CPU: %d last CPU: %d", current->processor,current->last_processor); */
+ printk(" CPU: %d", smp_processor_id());
#endif /* CONFIG_SMP */
-
- printk("\n");
- for (i = 0; i < 32; i++)
- {
+
+ for (i = 0; i < 32; i++) {
long r;
- if ((i % 4) == 0)
- {
- printk("GPR%02d: ", i);
+ if ((i % 4) == 0) {
+ printk("\n" KERN_INFO "GPR%02d: ", i);
}
-
- if ( __get_user(r, &(regs->gpr[i])) )
+ if (__get_user(r, &(regs->gpr[i])))
return;
-
printk("%016lX ", r);
- if ((i % 4) == 3)
- {
- printk("\n");
- }
}
+ printk("\n");
+ show_tsk_stack(current, regs->gpr[1]);
}
void exit_thread(void)
@@ -338,7 +334,7 @@ void initialize_paca_hardware_interrupt_stack(void)
if (!cpu_possible(i))
continue;
/* Carve out storage for the hardware interrupt stack */
- stack = __get_free_pages(GFP_KERNEL, get_order(8*PAGE_SIZE));
+ stack = __get_free_pages(GFP_ATOMIC, get_order(8*PAGE_SIZE));
if ( !stack ) {
printk("ERROR, cannot find space for hardware stack.\n");
@@ -413,26 +409,6 @@ char * ppc_find_proc_name( unsigned * p, char * buf, unsigned buflen )
return buf;
}
-void
-print_backtrace(unsigned long *sp)
-{
- int cnt = 0;
- unsigned long i;
- char name_buf[256];
-
- printk("Call backtrace: \n");
- while (sp) {
- if (__get_user( i, &sp[2] ))
- break;
- printk("%016lX ", i);
- printk("%s\n", ppc_find_proc_name( (unsigned *)i, name_buf, 256 ));
- if (cnt > 32) break;
- if (__get_user(sp, (unsigned long **)sp))
- break;
- }
- printk("\n");
-}
-
/*
* These bracket the sleeping functions..
*/
@@ -467,31 +443,41 @@ unsigned long get_wchan(struct task_struct *p)
return 0;
}
-void show_trace_task(struct task_struct *p)
+static void show_tsk_stack(struct task_struct *p, unsigned long sp)
{
- unsigned long ip, sp;
+ unsigned long ip;
unsigned long stack_page = (unsigned long)p->thread_info;
int count = 0;
+ char name_buf[256];
if (!p)
return;
printk("Call Trace: ");
- sp = p->thread.ksp;
do {
- sp = *(unsigned long *)sp;
+ if (__get_user(sp, (unsigned long *)sp))
+ break;
if (sp < (stack_page + sizeof(struct thread_struct)) ||
sp >= (stack_page + THREAD_SIZE))
break;
if (count > 0) {
- ip = *(unsigned long *)(sp + 16);
+ if (__get_user(ip, (unsigned long *)(sp + 16)))
+ break;
printk("[%016lx] ", ip);
+ printk("%s\n", ppc_find_proc_name((unsigned *)ip,
+ name_buf, 256 ));
}
- } while (count++ < 16);
- printk("\n");
+ } while (count++ < 32);
}
+extern unsigned long *_get_SP(void);
+
void dump_stack(void)
{
- show_stack(NULL);
+ show_tsk_stack(current, (unsigned long)_get_SP());
+}
+
+void show_trace_task(struct task_struct *tsk)
+{
+ show_tsk_stack(tsk, tsk->thread.ksp);
}
diff --git a/arch/ppc64/kernel/traps.c b/arch/ppc64/kernel/traps.c
index c80efc0bc4eb..520df24f08c9 100644
--- a/arch/ppc64/kernel/traps.c
+++ b/arch/ppc64/kernel/traps.c
@@ -67,7 +67,6 @@ void die(const char *str, struct pt_regs *regs, long err)
bust_spinlocks(1);
printk("Oops: %s, sig: %ld\n", str, err);
show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
bust_spinlocks(0);
spin_unlock_irq(&die_lock);
@@ -188,7 +187,6 @@ MachineCheckException(struct pt_regs *regs)
printk("Machine check in kernel mode.\n");
printk("Caused by (from SRR1=%lx): ", regs->msr);
show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
bust_spinlocks(0);
spin_unlock_irq(&die_lock);
panic("Unrecoverable Machine Check");
diff --git a/arch/ppc64/kernel/xics.c b/arch/ppc64/kernel/xics.c
index d928cbefbccb..9ae7993b36ce 100644
--- a/arch/ppc64/kernel/xics.c
+++ b/arch/ppc64/kernel/xics.c
@@ -12,8 +12,9 @@
#include <linux/types.h>
#include <linux/threads.h>
#include <linux/kernel.h>
-#include <linux/sched.h>
#include <linux/irq.h>
+#include <linux/smp.h>
+#include <linux/interrupt.h>
#include <asm/prom.h>
#include <asm/io.h>
#include <asm/pgtable.h>
diff --git a/include/asm-ppc64/hardirq.h b/include/asm-ppc64/hardirq.h
index 7fe87eabbc7f..b703d5982753 100644
--- a/include/asm-ppc64/hardirq.h
+++ b/include/asm-ppc64/hardirq.h
@@ -10,6 +10,7 @@
*/
#include <linux/config.h>
+#include <linux/cache.h>
#include <linux/preempt.h>
typedef struct {
@@ -104,12 +105,4 @@ do { \
#endif /* __KERNEL__ */
-#define show_stack(SP) \
-do { \
- if (SP) \
- print_backtrace(SP); \
- else \
- print_backtrace(_get_SP()); \
-} while (0)
-
#endif /* __ASM_HARDIRQ_H */
diff --git a/include/asm-ppc64/system.h b/include/asm-ppc64/system.h
index 24d7e057ae8f..68f31b97c314 100644
--- a/include/asm-ppc64/system.h
+++ b/include/asm-ppc64/system.h
@@ -79,7 +79,6 @@ extern int xmon_dabr_match(struct pt_regs *regs);
extern void (*xmon_fault_handler)(struct pt_regs *regs);
#endif
-extern void print_backtrace(unsigned long *);
extern void show_regs(struct pt_regs * regs);
extern void flush_instruction_cache(void);
extern int _get_PVR(void);