i386: consolidate show_regs and show_registers for i386
Both functions printk the same information, except for CRx and debug registers in the show_registers() one and a bit different manner. So move the common code into one place. This is already done for x86_64, so I think it's worth having the same on i386. This saves 100 bytes of .rodata section :) ... but only 8 from .text :( [ tglx: arch/x86 adaptation ] Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
committed by
Thomas Gleixner
parent
574a60421c
commit
9d975ebda5
@ -295,34 +295,52 @@ static int __init idle_setup(char *str)
|
||||
}
|
||||
early_param("idle", idle_setup);
|
||||
|
||||
void show_regs(struct pt_regs * regs)
|
||||
void __show_registers(struct pt_regs *regs, int all)
|
||||
{
|
||||
unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L;
|
||||
unsigned long d0, d1, d2, d3, d6, d7;
|
||||
unsigned long esp;
|
||||
unsigned short ss, gs;
|
||||
|
||||
if (user_mode_vm(regs)) {
|
||||
esp = regs->esp;
|
||||
ss = regs->xss & 0xffff;
|
||||
savesegment(gs, gs);
|
||||
} else {
|
||||
esp = (unsigned long) (®s->esp);
|
||||
savesegment(ss, ss);
|
||||
savesegment(gs, gs);
|
||||
}
|
||||
|
||||
printk("\n");
|
||||
printk("Pid: %d, comm: %20s\n", current->pid, current->comm);
|
||||
printk("EIP: %04x:[<%08lx>] CPU: %d\n",0xffff & regs->xcs,regs->eip, smp_processor_id());
|
||||
printk("Pid: %d, comm: %.*s %s (%s %.*s)\n",
|
||||
current->pid, TASK_COMM_LEN, current->comm,
|
||||
print_tainted(), init_utsname()->release,
|
||||
(int)strcspn(init_utsname()->version, " "),
|
||||
init_utsname()->version);
|
||||
|
||||
printk("EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n",
|
||||
0xffff & regs->xcs, regs->eip, regs->eflags,
|
||||
smp_processor_id());
|
||||
print_symbol("EIP is at %s\n", regs->eip);
|
||||
|
||||
if (user_mode_vm(regs))
|
||||
printk(" ESP: %04x:%08lx",0xffff & regs->xss,regs->esp);
|
||||
printk(" EFLAGS: %08lx %s (%s %.*s)\n",
|
||||
regs->eflags, print_tainted(), init_utsname()->release,
|
||||
(int)strcspn(init_utsname()->version, " "),
|
||||
init_utsname()->version);
|
||||
printk("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n",
|
||||
regs->eax,regs->ebx,regs->ecx,regs->edx);
|
||||
printk("ESI: %08lx EDI: %08lx EBP: %08lx",
|
||||
regs->esi, regs->edi, regs->ebp);
|
||||
printk(" DS: %04x ES: %04x FS: %04x\n",
|
||||
0xffff & regs->xds,0xffff & regs->xes, 0xffff & regs->xfs);
|
||||
regs->eax, regs->ebx, regs->ecx, regs->edx);
|
||||
printk("ESI: %08lx EDI: %08lx EBP: %08lx ESP: %08lx\n",
|
||||
regs->esi, regs->edi, regs->ebp, esp);
|
||||
printk(" DS: %04x ES: %04x FS: %04x GS: %04x SS: %04x\n",
|
||||
regs->xds & 0xffff, regs->xes & 0xffff,
|
||||
regs->xfs & 0xffff, gs, ss);
|
||||
|
||||
if (!all)
|
||||
return;
|
||||
|
||||
cr0 = read_cr0();
|
||||
cr2 = read_cr2();
|
||||
cr3 = read_cr3();
|
||||
cr4 = read_cr4_safe();
|
||||
printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4);
|
||||
printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n",
|
||||
cr0, cr2, cr3, cr4);
|
||||
|
||||
get_debugreg(d0, 0);
|
||||
get_debugreg(d1, 1);
|
||||
@ -330,10 +348,16 @@ void show_regs(struct pt_regs * regs)
|
||||
get_debugreg(d3, 3);
|
||||
printk("DR0: %08lx DR1: %08lx DR2: %08lx DR3: %08lx\n",
|
||||
d0, d1, d2, d3);
|
||||
|
||||
get_debugreg(d6, 6);
|
||||
get_debugreg(d7, 7);
|
||||
printk("DR6: %08lx DR7: %08lx\n", d6, d7);
|
||||
printk("DR6: %08lx DR7: %08lx\n",
|
||||
d6, d7);
|
||||
}
|
||||
|
||||
void show_regs(struct pt_regs *regs)
|
||||
{
|
||||
__show_registers(regs, 1);
|
||||
show_trace(NULL, regs, ®s->esp);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user