diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2007-10-19 14:35:03 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2007-10-19 14:35:03 -0400 |
commit | 9d975ebda56699c1b8480e9736caf33a61ccb810 (patch) | |
tree | 5d02e22725dff5b6a44c8d8aca035981fc084006 /arch/x86/kernel/process_32.c | |
parent | 574a60421c8ea5383a54ebee1f37fa871d00e1b9 (diff) |
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>
Diffstat (limited to 'arch/x86/kernel/process_32.c')
-rw-r--r-- | arch/x86/kernel/process_32.c | 56 |
1 files changed, 40 insertions, 16 deletions
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index 097aeafce5f..ba4b6411708 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c | |||
@@ -295,34 +295,52 @@ static int __init idle_setup(char *str) | |||
295 | } | 295 | } |
296 | early_param("idle", idle_setup); | 296 | early_param("idle", idle_setup); |
297 | 297 | ||
298 | void show_regs(struct pt_regs * regs) | 298 | void __show_registers(struct pt_regs *regs, int all) |
299 | { | 299 | { |
300 | unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L; | 300 | unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L; |
301 | unsigned long d0, d1, d2, d3, d6, d7; | 301 | unsigned long d0, d1, d2, d3, d6, d7; |
302 | unsigned long esp; | ||
303 | unsigned short ss, gs; | ||
304 | |||
305 | if (user_mode_vm(regs)) { | ||
306 | esp = regs->esp; | ||
307 | ss = regs->xss & 0xffff; | ||
308 | savesegment(gs, gs); | ||
309 | } else { | ||
310 | esp = (unsigned long) (®s->esp); | ||
311 | savesegment(ss, ss); | ||
312 | savesegment(gs, gs); | ||
313 | } | ||
302 | 314 | ||
303 | printk("\n"); | 315 | printk("\n"); |
304 | printk("Pid: %d, comm: %20s\n", current->pid, current->comm); | 316 | printk("Pid: %d, comm: %.*s %s (%s %.*s)\n", |
305 | printk("EIP: %04x:[<%08lx>] CPU: %d\n",0xffff & regs->xcs,regs->eip, smp_processor_id()); | 317 | current->pid, TASK_COMM_LEN, current->comm, |
318 | print_tainted(), init_utsname()->release, | ||
319 | (int)strcspn(init_utsname()->version, " "), | ||
320 | init_utsname()->version); | ||
321 | |||
322 | printk("EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n", | ||
323 | 0xffff & regs->xcs, regs->eip, regs->eflags, | ||
324 | smp_processor_id()); | ||
306 | print_symbol("EIP is at %s\n", regs->eip); | 325 | print_symbol("EIP is at %s\n", regs->eip); |
307 | 326 | ||
308 | if (user_mode_vm(regs)) | ||
309 | printk(" ESP: %04x:%08lx",0xffff & regs->xss,regs->esp); | ||
310 | printk(" EFLAGS: %08lx %s (%s %.*s)\n", | ||
311 | regs->eflags, print_tainted(), init_utsname()->release, | ||
312 | (int)strcspn(init_utsname()->version, " "), | ||
313 | init_utsname()->version); | ||
314 | printk("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n", | 327 | printk("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n", |
315 | regs->eax,regs->ebx,regs->ecx,regs->edx); | 328 | regs->eax, regs->ebx, regs->ecx, regs->edx); |
316 | printk("ESI: %08lx EDI: %08lx EBP: %08lx", | 329 | printk("ESI: %08lx EDI: %08lx EBP: %08lx ESP: %08lx\n", |
317 | regs->esi, regs->edi, regs->ebp); | 330 | regs->esi, regs->edi, regs->ebp, esp); |
318 | printk(" DS: %04x ES: %04x FS: %04x\n", | 331 | printk(" DS: %04x ES: %04x FS: %04x GS: %04x SS: %04x\n", |
319 | 0xffff & regs->xds,0xffff & regs->xes, 0xffff & regs->xfs); | 332 | regs->xds & 0xffff, regs->xes & 0xffff, |
333 | regs->xfs & 0xffff, gs, ss); | ||
334 | |||
335 | if (!all) | ||
336 | return; | ||
320 | 337 | ||
321 | cr0 = read_cr0(); | 338 | cr0 = read_cr0(); |
322 | cr2 = read_cr2(); | 339 | cr2 = read_cr2(); |
323 | cr3 = read_cr3(); | 340 | cr3 = read_cr3(); |
324 | cr4 = read_cr4_safe(); | 341 | cr4 = read_cr4_safe(); |
325 | printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4); | 342 | printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", |
343 | cr0, cr2, cr3, cr4); | ||
326 | 344 | ||
327 | get_debugreg(d0, 0); | 345 | get_debugreg(d0, 0); |
328 | get_debugreg(d1, 1); | 346 | get_debugreg(d1, 1); |
@@ -330,10 +348,16 @@ void show_regs(struct pt_regs * regs) | |||
330 | get_debugreg(d3, 3); | 348 | get_debugreg(d3, 3); |
331 | printk("DR0: %08lx DR1: %08lx DR2: %08lx DR3: %08lx\n", | 349 | printk("DR0: %08lx DR1: %08lx DR2: %08lx DR3: %08lx\n", |
332 | d0, d1, d2, d3); | 350 | d0, d1, d2, d3); |
351 | |||
333 | get_debugreg(d6, 6); | 352 | get_debugreg(d6, 6); |
334 | get_debugreg(d7, 7); | 353 | get_debugreg(d7, 7); |
335 | printk("DR6: %08lx DR7: %08lx\n", d6, d7); | 354 | printk("DR6: %08lx DR7: %08lx\n", |
355 | d6, d7); | ||
356 | } | ||
336 | 357 | ||
358 | void show_regs(struct pt_regs *regs) | ||
359 | { | ||
360 | __show_registers(regs, 1); | ||
337 | show_trace(NULL, regs, ®s->esp); | 361 | show_trace(NULL, regs, ®s->esp); |
338 | } | 362 | } |
339 | 363 | ||