diff options
author | Mike Frysinger <michael.frysinger@analog.com> | 2007-11-21 03:46:49 -0500 |
---|---|---|
committer | Bryan Wu <bryan.wu@analog.com> | 2007-11-21 03:46:49 -0500 |
commit | 49dce9124b41984bf1e918847bc17929c2e8f80f (patch) | |
tree | 6b973ed6cc1861da973dc67b3681c0fa95178522 /arch | |
parent | 9cb07b23dbc1c4c6ded49ba31d51b639a13970e3 (diff) |
Blackfin arch: split apart dump_bfin_regs and merge/remove show_regs from process.c, which was largely duplicated
Signed-off-by: Mike Frysinger <michael.frysinger@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/blackfin/kernel/early_printk.c | 3 | ||||
-rw-r--r-- | arch/blackfin/kernel/process.c | 21 | ||||
-rw-r--r-- | arch/blackfin/kernel/traps.c | 85 | ||||
-rw-r--r-- | arch/blackfin/mach-common/irqpanic.c | 4 |
4 files changed, 59 insertions, 54 deletions
diff --git a/arch/blackfin/kernel/early_printk.c b/arch/blackfin/kernel/early_printk.c index 6ec518a81113..724f4a5a1d46 100644 --- a/arch/blackfin/kernel/early_printk.c +++ b/arch/blackfin/kernel/early_printk.c | |||
@@ -205,7 +205,8 @@ asmlinkage void __init early_trap_c(struct pt_regs *fp, void *retaddr) | |||
205 | if (likely(early_console == NULL)) | 205 | if (likely(early_console == NULL)) |
206 | setup_early_printk(DEFAULT_EARLY_PORT); | 206 | setup_early_printk(DEFAULT_EARLY_PORT); |
207 | 207 | ||
208 | dump_bfin_regs(fp, retaddr); | 208 | dump_bfin_mem((void *)fp->retx); |
209 | show_regs(fp); | ||
209 | dump_bfin_trace_buffer(); | 210 | dump_bfin_trace_buffer(); |
210 | 211 | ||
211 | panic("Died early"); | 212 | panic("Died early"); |
diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c index 1a8cf3364e92..5bf15125f0d6 100644 --- a/arch/blackfin/kernel/process.c +++ b/arch/blackfin/kernel/process.c | |||
@@ -134,27 +134,6 @@ void cpu_idle(void) | |||
134 | } | 134 | } |
135 | } | 135 | } |
136 | 136 | ||
137 | void show_regs(struct pt_regs *regs) | ||
138 | { | ||
139 | printk(KERN_NOTICE "\n"); | ||
140 | printk(KERN_NOTICE | ||
141 | "PC: %08lu Status: %04lu SysStatus: %04lu RETS: %08lu\n", | ||
142 | regs->pc, regs->astat, regs->seqstat, regs->rets); | ||
143 | printk(KERN_NOTICE | ||
144 | "A0.x: %08lx A0.w: %08lx A1.x: %08lx A1.w: %08lx\n", | ||
145 | regs->a0x, regs->a0w, regs->a1x, regs->a1w); | ||
146 | printk(KERN_NOTICE "P0: %08lx P1: %08lx P2: %08lx P3: %08lx\n", | ||
147 | regs->p0, regs->p1, regs->p2, regs->p3); | ||
148 | printk(KERN_NOTICE "P4: %08lx P5: %08lx\n", regs->p4, regs->p5); | ||
149 | printk(KERN_NOTICE "R0: %08lx R1: %08lx R2: %08lx R3: %08lx\n", | ||
150 | regs->r0, regs->r1, regs->r2, regs->r3); | ||
151 | printk(KERN_NOTICE "R4: %08lx R5: %08lx R6: %08lx R7: %08lx\n", | ||
152 | regs->r4, regs->r5, regs->r6, regs->r7); | ||
153 | |||
154 | if (!regs->ipend) | ||
155 | printk(KERN_NOTICE "USP: %08lx\n", rdusp()); | ||
156 | } | ||
157 | |||
158 | /* Fill in the fpu structure for a core dump. */ | 137 | /* Fill in the fpu structure for a core dump. */ |
159 | 138 | ||
160 | int dump_fpu(struct pt_regs *regs, elf_fpregset_t * fpregs) | 139 | int dump_fpu(struct pt_regs *regs, elf_fpregset_t * fpregs) |
diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c index 910cdd43fe60..21a55ef19cbd 100644 --- a/arch/blackfin/kernel/traps.c +++ b/arch/blackfin/kernel/traps.c | |||
@@ -169,7 +169,9 @@ asmlinkage void double_fault_c(struct pt_regs *fp) | |||
169 | console_verbose(); | 169 | console_verbose(); |
170 | oops_in_progress = 1; | 170 | oops_in_progress = 1; |
171 | printk(KERN_EMERG "\n" KERN_EMERG "Double Fault\n"); | 171 | printk(KERN_EMERG "\n" KERN_EMERG "Double Fault\n"); |
172 | dump_bfin_regs(fp, (void *)fp->retx); | 172 | dump_bfin_process(fp); |
173 | dump_bfin_mem((void *)fp->retx); | ||
174 | show_regs(fp); | ||
173 | panic("Double Fault - unrecoverable event\n"); | 175 | panic("Double Fault - unrecoverable event\n"); |
174 | 176 | ||
175 | } | 177 | } |
@@ -444,7 +446,9 @@ asmlinkage void trap_c(struct pt_regs *fp) | |||
444 | 446 | ||
445 | if (sig != SIGTRAP) { | 447 | if (sig != SIGTRAP) { |
446 | unsigned long stack; | 448 | unsigned long stack; |
447 | dump_bfin_regs(fp, (void *)fp->retx); | 449 | dump_bfin_process(fp); |
450 | dump_bfin_mem((void *)fp->retx); | ||
451 | show_regs(fp); | ||
448 | 452 | ||
449 | /* Print out the trace buffer if it makes sense */ | 453 | /* Print out the trace buffer if it makes sense */ |
450 | #ifndef CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE | 454 | #ifndef CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE |
@@ -601,38 +605,48 @@ void dump_stack(void) | |||
601 | show_stack(current, &stack); | 605 | show_stack(current, &stack); |
602 | trace_buffer_restore(tflags); | 606 | trace_buffer_restore(tflags); |
603 | } | 607 | } |
604 | |||
605 | EXPORT_SYMBOL(dump_stack); | 608 | EXPORT_SYMBOL(dump_stack); |
606 | 609 | ||
607 | void dump_bfin_regs(struct pt_regs *fp, void *retaddr) | 610 | void dump_bfin_process(struct pt_regs *fp) |
608 | { | 611 | { |
609 | char buf [150]; | 612 | /* We should be able to look at fp->ipend, but we don't push it on the |
613 | * stack all the time, so do this until we fix that */ | ||
614 | unsigned int context = bfin_read_IPEND(); | ||
615 | |||
616 | if (oops_in_progress) | ||
617 | printk(KERN_EMERG "Kernel OOPS in progress\n"); | ||
618 | |||
619 | if (context & 0x0020) | ||
620 | printk(KERN_NOTICE "Deferred excecption or HW Error context\n"); | ||
621 | else if (context & 0x3FC0) | ||
622 | printk(KERN_NOTICE "Interrupt context\n"); | ||
623 | else if (context & 0x4000) | ||
624 | printk(KERN_NOTICE "Deferred Interrupt context\n"); | ||
625 | else if (context & 0x8000) | ||
626 | printk(KERN_NOTICE "Kernel process context\n"); | ||
627 | |||
628 | if (current->pid && current->mm) { | ||
629 | printk(KERN_NOTICE "CURRENT PROCESS:\n"); | ||
630 | printk(KERN_NOTICE "COMM=%s PID=%d\n", | ||
631 | current->comm, current->pid); | ||
632 | |||
633 | printk(KERN_NOTICE "TEXT = 0x%p-0x%p DATA = 0x%p-0x%p\n" | ||
634 | KERN_NOTICE "BSS = 0x%p-0x%p USER-STACK = 0x%p\n" | ||
635 | KERN_NOTICE "\n", | ||
636 | (void *)current->mm->start_code, | ||
637 | (void *)current->mm->end_code, | ||
638 | (void *)current->mm->start_data, | ||
639 | (void *)current->mm->end_data, | ||
640 | (void *)current->mm->end_data, | ||
641 | (void *)current->mm->brk, | ||
642 | (void *)current->mm->start_stack); | ||
643 | } else | ||
644 | printk(KERN_NOTICE "\n" KERN_NOTICE | ||
645 | "No Valid process in current context\n"); | ||
646 | } | ||
610 | 647 | ||
611 | if (!oops_in_progress) { | 648 | void dump_bfin_mem(void *retaddr) |
612 | if (current->pid && current->mm) { | 649 | { |
613 | printk(KERN_NOTICE "\n" KERN_NOTICE "CURRENT PROCESS:\n"); | ||
614 | printk(KERN_NOTICE "COMM=%s PID=%d\n", | ||
615 | current->comm, current->pid); | ||
616 | |||
617 | printk(KERN_NOTICE "TEXT = 0x%p-0x%p DATA = 0x%p-0x%p\n" | ||
618 | KERN_NOTICE "BSS = 0x%p-0x%p USER-STACK = 0x%p\n" | ||
619 | KERN_NOTICE "\n", | ||
620 | (void *)current->mm->start_code, | ||
621 | (void *)current->mm->end_code, | ||
622 | (void *)current->mm->start_data, | ||
623 | (void *)current->mm->end_data, | ||
624 | (void *)current->mm->end_data, | ||
625 | (void *)current->mm->brk, | ||
626 | (void *)current->mm->start_stack); | ||
627 | } else { | ||
628 | printk (KERN_NOTICE "\n" KERN_NOTICE | ||
629 | "No Valid pid - Either things are really messed up," | ||
630 | " or you are in the kernel\n"); | ||
631 | } | ||
632 | } else { | ||
633 | printk(KERN_NOTICE "Kernel or interrupt exception\n"); | ||
634 | print_modules(); | ||
635 | } | ||
636 | 650 | ||
637 | if (retaddr >= (void *)FIXED_CODE_START && retaddr < (void *)physical_mem_end | 651 | if (retaddr >= (void *)FIXED_CODE_START && retaddr < (void *)physical_mem_end |
638 | #if L1_CODE_LENGTH != 0 | 652 | #if L1_CODE_LENGTH != 0 |
@@ -675,6 +689,11 @@ void dump_bfin_regs(struct pt_regs *fp, void *retaddr) | |||
675 | printk("\n" KERN_NOTICE | 689 | printk("\n" KERN_NOTICE |
676 | "Cannot look at the [PC] <%p> for it is" | 690 | "Cannot look at the [PC] <%p> for it is" |
677 | " in unreadable memory - sorry\n", retaddr); | 691 | " in unreadable memory - sorry\n", retaddr); |
692 | } | ||
693 | |||
694 | void show_regs(struct pt_regs *fp) | ||
695 | { | ||
696 | char buf [150]; | ||
678 | 697 | ||
679 | printk(KERN_NOTICE "\n" KERN_NOTICE "SEQUENCER STATUS:\n"); | 698 | printk(KERN_NOTICE "\n" KERN_NOTICE "SEQUENCER STATUS:\n"); |
680 | printk(KERN_NOTICE " SEQSTAT: %08lx IPEND: %04lx SYSCFG: %04lx\n", | 699 | printk(KERN_NOTICE " SEQSTAT: %08lx IPEND: %04lx SYSCFG: %04lx\n", |
@@ -688,6 +707,8 @@ void dump_bfin_regs(struct pt_regs *fp, void *retaddr) | |||
688 | printk(KERN_NOTICE " RETX: %s\n", buf); | 707 | printk(KERN_NOTICE " RETX: %s\n", buf); |
689 | decode_address(buf, fp->rets); | 708 | decode_address(buf, fp->rets); |
690 | printk(KERN_NOTICE " RETS: %s\n", buf); | 709 | printk(KERN_NOTICE " RETS: %s\n", buf); |
710 | decode_address(buf, fp->pc); | ||
711 | printk(KERN_NOTICE " PC: %s\n", buf); | ||
691 | 712 | ||
692 | if ((long)fp->seqstat & SEQSTAT_EXCAUSE) { | 713 | if ((long)fp->seqstat & SEQSTAT_EXCAUSE) { |
693 | decode_address(buf, bfin_read_DCPLB_FAULT_ADDR()); | 714 | decode_address(buf, bfin_read_DCPLB_FAULT_ADDR()); |
@@ -802,7 +823,9 @@ void panic_cplb_error(int cplb_panic, struct pt_regs *fp) | |||
802 | 823 | ||
803 | printk(KERN_EMERG "DCPLB_FAULT_ADDR=%p\n", (void *)bfin_read_DCPLB_FAULT_ADDR()); | 824 | printk(KERN_EMERG "DCPLB_FAULT_ADDR=%p\n", (void *)bfin_read_DCPLB_FAULT_ADDR()); |
804 | printk(KERN_EMERG "ICPLB_FAULT_ADDR=%p\n", (void *)bfin_read_ICPLB_FAULT_ADDR()); | 825 | printk(KERN_EMERG "ICPLB_FAULT_ADDR=%p\n", (void *)bfin_read_ICPLB_FAULT_ADDR()); |
805 | dump_bfin_regs(fp, (void *)fp->retx); | 826 | dump_bfin_process(fp); |
827 | dump_bfin_mem((void *)fp->retx); | ||
828 | show_regs(fp); | ||
806 | dump_stack(); | 829 | dump_stack(); |
807 | panic("Unrecoverable event\n"); | 830 | panic("Unrecoverable event\n"); |
808 | } | 831 | } |
diff --git a/arch/blackfin/mach-common/irqpanic.c b/arch/blackfin/mach-common/irqpanic.c index d62c2e277d7b..b22959b197e5 100644 --- a/arch/blackfin/mach-common/irqpanic.c +++ b/arch/blackfin/mach-common/irqpanic.c | |||
@@ -173,7 +173,9 @@ asmlinkage void irq_panic(int reason, struct pt_regs *regs) | |||
173 | } | 173 | } |
174 | 174 | ||
175 | regs->ipend = bfin_read_IPEND(); | 175 | regs->ipend = bfin_read_IPEND(); |
176 | dump_bfin_regs(regs, (void *)regs->pc); | 176 | dump_bfin_process(regs); |
177 | dump_bfin_mem((void *)regs->pc); | ||
178 | show_regs(regs); | ||
177 | if (0 == (info.si_signo = sig) || 0 == user_mode(regs)) /* in kernelspace */ | 179 | if (0 == (info.si_signo = sig) || 0 == user_mode(regs)) /* in kernelspace */ |
178 | panic("Unhandled IRQ or exceptions!\n"); | 180 | panic("Unhandled IRQ or exceptions!\n"); |
179 | else { /* in userspace */ | 181 | else { /* in userspace */ |