[PATCH] m68k: fix show_registers()

Move some of the prints in die_if_kernel() to show_registers() and call that
instead of show_stack(), so show_registers() prints now similiar info as other
archs.  Clean up the function a little.

Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Roman Zippel 2006-06-25 05:46:58 -07:00 committed by Linus Torvalds
parent 742636f5bf
commit f2325ecebc
1 changed files with 68 additions and 58 deletions

View File

@ -927,12 +927,26 @@ void show_trace(unsigned long *stack)
void show_registers(struct pt_regs *regs) void show_registers(struct pt_regs *regs)
{ {
struct frame *fp = (struct frame *)regs; struct frame *fp = (struct frame *)regs;
mm_segment_t old_fs = get_fs();
u16 c, *cp;
unsigned long addr; unsigned long addr;
int i; int i;
print_modules();
printk("PC: [<%08lx>]",regs->pc);
print_symbol(" %s", regs->pc);
printk("\nSR: %04x SP: %p a2: %08lx\n",
regs->sr, regs, regs->a2);
printk("d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n",
regs->d0, regs->d1, regs->d2, regs->d3);
printk("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
regs->d4, regs->d5, regs->a0, regs->a1);
printk("Process %s (pid: %d, task=%p)\n",
current->comm, current->pid, current);
addr = (unsigned long)&fp->un; addr = (unsigned long)&fp->un;
printk("Frame format=%X ", fp->ptregs.format); printk("Frame format=%X ", regs->format);
switch (fp->ptregs.format) { switch (regs->format) {
case 0x2: case 0x2:
printk("instr addr=%08lx\n", fp->un.fmt2.iaddr); printk("instr addr=%08lx\n", fp->un.fmt2.iaddr);
addr += sizeof(fp->un.fmt2); addr += sizeof(fp->un.fmt2);
@ -984,9 +998,17 @@ void show_registers(struct pt_regs *regs)
} }
show_stack(NULL, (unsigned long *)addr); show_stack(NULL, (unsigned long *)addr);
printk("Code: "); printk("Code:");
for (i = 0; i < 10; i++) set_fs(KERNEL_DS);
printk("%04x ", 0xffff & ((short *) fp->ptregs.pc)[i]); cp = (u16 *)regs->pc;
for (i = -8; i < 16; i++) {
if (get_user(c, cp + i) && i >= 0) {
printk(" Bad PC value.");
break;
}
printk(i ? " %04x" : " <%04x>", c);
}
set_fs(old_fs);
printk ("\n"); printk ("\n");
} }
@ -1190,19 +1212,7 @@ void die_if_kernel (char *str, struct pt_regs *fp, int nr)
console_verbose(); console_verbose();
printk("%s: %08x\n",str,nr); printk("%s: %08x\n",str,nr);
print_modules(); show_registers(fp);
printk("PC: [<%08lx>]",fp->pc);
print_symbol(" %s\n", fp->pc);
printk("\nSR: %04x SP: %p a2: %08lx\n",
fp->sr, fp, fp->a2);
printk("d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n",
fp->d0, fp->d1, fp->d2, fp->d3);
printk("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
fp->d4, fp->d5, fp->a0, fp->a1);
printk("Process %s (pid: %d, stackpage=%08lx)\n",
current->comm, current->pid, PAGE_SIZE+(unsigned long)current);
show_stack(NULL, (unsigned long *)fp);
do_exit(SIGSEGV); do_exit(SIGSEGV);
} }