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/traps_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/traps_32.c')
-rw-r--r-- | arch/x86/kernel/traps_32.c | 32 |
1 files changed, 4 insertions, 28 deletions
diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c index b132d3957dfc..746fad2c504f 100644 --- a/arch/x86/kernel/traps_32.c +++ b/arch/x86/kernel/traps_32.c | |||
@@ -288,33 +288,9 @@ EXPORT_SYMBOL(dump_stack); | |||
288 | void show_registers(struct pt_regs *regs) | 288 | void show_registers(struct pt_regs *regs) |
289 | { | 289 | { |
290 | int i; | 290 | int i; |
291 | int in_kernel = 1; | 291 | |
292 | unsigned long esp; | ||
293 | unsigned short ss, gs; | ||
294 | |||
295 | esp = (unsigned long) (®s->esp); | ||
296 | savesegment(ss, ss); | ||
297 | savesegment(gs, gs); | ||
298 | if (user_mode_vm(regs)) { | ||
299 | in_kernel = 0; | ||
300 | esp = regs->esp; | ||
301 | ss = regs->xss & 0xffff; | ||
302 | } | ||
303 | print_modules(); | 292 | print_modules(); |
304 | printk(KERN_EMERG "CPU: %d\n" | 293 | __show_registers(regs, 0); |
305 | KERN_EMERG "EIP: %04x:[<%08lx>] %s VLI\n" | ||
306 | KERN_EMERG "EFLAGS: %08lx (%s %.*s)\n", | ||
307 | smp_processor_id(), 0xffff & regs->xcs, regs->eip, | ||
308 | print_tainted(), regs->eflags, init_utsname()->release, | ||
309 | (int)strcspn(init_utsname()->version, " "), | ||
310 | init_utsname()->version); | ||
311 | print_symbol(KERN_EMERG "EIP is at %s\n", regs->eip); | ||
312 | printk(KERN_EMERG "eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n", | ||
313 | regs->eax, regs->ebx, regs->ecx, regs->edx); | ||
314 | printk(KERN_EMERG "esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n", | ||
315 | regs->esi, regs->edi, regs->ebp, esp); | ||
316 | printk(KERN_EMERG "ds: %04x es: %04x fs: %04x gs: %04x ss: %04x\n", | ||
317 | regs->xds & 0xffff, regs->xes & 0xffff, regs->xfs & 0xffff, gs, ss); | ||
318 | printk(KERN_EMERG "Process %.*s (pid: %d, ti=%p task=%p task.ti=%p)", | 294 | printk(KERN_EMERG "Process %.*s (pid: %d, ti=%p task=%p task.ti=%p)", |
319 | TASK_COMM_LEN, current->comm, current->pid, | 295 | TASK_COMM_LEN, current->comm, current->pid, |
320 | current_thread_info(), current, task_thread_info(current)); | 296 | current_thread_info(), current, task_thread_info(current)); |
@@ -322,14 +298,14 @@ void show_registers(struct pt_regs *regs) | |||
322 | * When in-kernel, we also print out the stack and code at the | 298 | * When in-kernel, we also print out the stack and code at the |
323 | * time of the fault.. | 299 | * time of the fault.. |
324 | */ | 300 | */ |
325 | if (in_kernel) { | 301 | if (!user_mode_vm(regs)) { |
326 | u8 *eip; | 302 | u8 *eip; |
327 | unsigned int code_prologue = code_bytes * 43 / 64; | 303 | unsigned int code_prologue = code_bytes * 43 / 64; |
328 | unsigned int code_len = code_bytes; | 304 | unsigned int code_len = code_bytes; |
329 | unsigned char c; | 305 | unsigned char c; |
330 | 306 | ||
331 | printk("\n" KERN_EMERG "Stack: "); | 307 | printk("\n" KERN_EMERG "Stack: "); |
332 | show_stack_log_lvl(NULL, regs, (unsigned long *)esp, KERN_EMERG); | 308 | show_stack_log_lvl(NULL, regs, ®s->esp, KERN_EMERG); |
333 | 309 | ||
334 | printk(KERN_EMERG "Code: "); | 310 | printk(KERN_EMERG "Code: "); |
335 | 311 | ||