diff options
author | Andy Isaacson <adi@hexapodia.org> | 2009-12-08 03:29:42 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-12-09 04:17:58 -0500 |
commit | 814e2c84a722c45650a9b8f52285d7ba6874f63b (patch) | |
tree | ed7ef55b98c0b87e5fa714ca2d138f4469cc9ea3 /arch | |
parent | f58e1f53de52a70391b6478617311207c7203363 (diff) |
x86: Factor duplicated code out of __show_regs() into show_regs_common()
Unify x86_32 and x86_64 implementations of __show_regs() header,
standardizing on the x86_64 format string in the process. Also,
32-bit will now call print_modules.
Signed-off-by: Andy Isaacson <adi@hexapodia.org>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Robert Hancock <hancockrwd@gmail.com>
Cc: Richard Zidlicky <rz@linux-m68k.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
LKML-Reference: <20091208082942.GA27174@hexapodia.org>
[ v2: resolved conflict ]
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/include/asm/system.h | 1 | ||||
-rw-r--r-- | arch/x86/kernel/process.c | 18 | ||||
-rw-r--r-- | arch/x86/kernel/process_32.c | 14 | ||||
-rw-r--r-- | arch/x86/kernel/process_64.c | 16 |
4 files changed, 22 insertions, 27 deletions
diff --git a/arch/x86/include/asm/system.h b/arch/x86/include/asm/system.h index 022a84386de8..ecb544e65382 100644 --- a/arch/x86/include/asm/system.h +++ b/arch/x86/include/asm/system.h | |||
@@ -23,6 +23,7 @@ struct task_struct *__switch_to(struct task_struct *prev, | |||
23 | struct tss_struct; | 23 | struct tss_struct; |
24 | void __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p, | 24 | void __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p, |
25 | struct tss_struct *tss); | 25 | struct tss_struct *tss); |
26 | extern void show_regs_common(void); | ||
26 | 27 | ||
27 | #ifdef CONFIG_X86_32 | 28 | #ifdef CONFIG_X86_32 |
28 | 29 | ||
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index 5e2ba634ea15..90cf1250a005 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
@@ -10,6 +10,8 @@ | |||
10 | #include <linux/clockchips.h> | 10 | #include <linux/clockchips.h> |
11 | #include <linux/random.h> | 11 | #include <linux/random.h> |
12 | #include <linux/user-return-notifier.h> | 12 | #include <linux/user-return-notifier.h> |
13 | #include <linux/dmi.h> | ||
14 | #include <linux/utsname.h> | ||
13 | #include <trace/events/power.h> | 15 | #include <trace/events/power.h> |
14 | #include <linux/hw_breakpoint.h> | 16 | #include <linux/hw_breakpoint.h> |
15 | #include <asm/system.h> | 17 | #include <asm/system.h> |
@@ -90,6 +92,22 @@ void exit_thread(void) | |||
90 | } | 92 | } |
91 | } | 93 | } |
92 | 94 | ||
95 | void show_regs_common(void) | ||
96 | { | ||
97 | const char *board; | ||
98 | |||
99 | board = dmi_get_system_info(DMI_PRODUCT_NAME); | ||
100 | if (!board) | ||
101 | board = ""; | ||
102 | |||
103 | printk("\n"); | ||
104 | printk(KERN_INFO "Pid: %d, comm: %.20s %s %s %.*s %s\n", | ||
105 | current->pid, current->comm, print_tainted(), | ||
106 | init_utsname()->release, | ||
107 | (int)strcspn(init_utsname()->version, " "), | ||
108 | init_utsname()->version, board); | ||
109 | } | ||
110 | |||
93 | void flush_thread(void) | 111 | void flush_thread(void) |
94 | { | 112 | { |
95 | struct task_struct *tsk = current; | 113 | struct task_struct *tsk = current; |
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index 075580b35682..120b88797a75 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/vmalloc.h> | 23 | #include <linux/vmalloc.h> |
24 | #include <linux/user.h> | 24 | #include <linux/user.h> |
25 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
26 | #include <linux/utsname.h> | ||
27 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
28 | #include <linux/reboot.h> | 27 | #include <linux/reboot.h> |
29 | #include <linux/init.h> | 28 | #include <linux/init.h> |
@@ -35,7 +34,6 @@ | |||
35 | #include <linux/tick.h> | 34 | #include <linux/tick.h> |
36 | #include <linux/percpu.h> | 35 | #include <linux/percpu.h> |
37 | #include <linux/prctl.h> | 36 | #include <linux/prctl.h> |
38 | #include <linux/dmi.h> | ||
39 | #include <linux/ftrace.h> | 37 | #include <linux/ftrace.h> |
40 | #include <linux/uaccess.h> | 38 | #include <linux/uaccess.h> |
41 | #include <linux/io.h> | 39 | #include <linux/io.h> |
@@ -128,7 +126,6 @@ void __show_regs(struct pt_regs *regs, int all) | |||
128 | unsigned long d0, d1, d2, d3, d6, d7; | 126 | unsigned long d0, d1, d2, d3, d6, d7; |
129 | unsigned long sp; | 127 | unsigned long sp; |
130 | unsigned short ss, gs; | 128 | unsigned short ss, gs; |
131 | const char *board; | ||
132 | 129 | ||
133 | if (user_mode_vm(regs)) { | 130 | if (user_mode_vm(regs)) { |
134 | sp = regs->sp; | 131 | sp = regs->sp; |
@@ -140,16 +137,7 @@ void __show_regs(struct pt_regs *regs, int all) | |||
140 | savesegment(gs, gs); | 137 | savesegment(gs, gs); |
141 | } | 138 | } |
142 | 139 | ||
143 | printk("\n"); | 140 | show_regs_common(); |
144 | |||
145 | board = dmi_get_system_info(DMI_PRODUCT_NAME); | ||
146 | if (!board) | ||
147 | board = ""; | ||
148 | printk("Pid: %d, comm: %s %s (%s %.*s) %s\n", | ||
149 | task_pid_nr(current), current->comm, | ||
150 | print_tainted(), init_utsname()->release, | ||
151 | (int)strcspn(init_utsname()->version, " "), | ||
152 | init_utsname()->version, board); | ||
153 | 141 | ||
154 | printk("EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n", | 142 | printk("EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n", |
155 | (u16)regs->cs, regs->ip, regs->flags, | 143 | (u16)regs->cs, regs->ip, regs->flags, |
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index c95c8f4e790a..e5ab0cd0ef36 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/user.h> | 27 | #include <linux/user.h> |
28 | #include <linux/interrupt.h> | 28 | #include <linux/interrupt.h> |
29 | #include <linux/utsname.h> | ||
30 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
31 | #include <linux/module.h> | 30 | #include <linux/module.h> |
32 | #include <linux/ptrace.h> | 31 | #include <linux/ptrace.h> |
@@ -38,7 +37,6 @@ | |||
38 | #include <linux/uaccess.h> | 37 | #include <linux/uaccess.h> |
39 | #include <linux/io.h> | 38 | #include <linux/io.h> |
40 | #include <linux/ftrace.h> | 39 | #include <linux/ftrace.h> |
41 | #include <linux/dmi.h> | ||
42 | 40 | ||
43 | #include <asm/pgtable.h> | 41 | #include <asm/pgtable.h> |
44 | #include <asm/system.h> | 42 | #include <asm/system.h> |
@@ -163,18 +161,8 @@ void __show_regs(struct pt_regs *regs, int all) | |||
163 | unsigned long d0, d1, d2, d3, d6, d7; | 161 | unsigned long d0, d1, d2, d3, d6, d7; |
164 | unsigned int fsindex, gsindex; | 162 | unsigned int fsindex, gsindex; |
165 | unsigned int ds, cs, es; | 163 | unsigned int ds, cs, es; |
166 | const char *board; | 164 | |
167 | 165 | show_regs_common(); | |
168 | printk("\n"); | ||
169 | print_modules(); | ||
170 | board = dmi_get_system_info(DMI_PRODUCT_NAME); | ||
171 | if (!board) | ||
172 | board = ""; | ||
173 | printk(KERN_INFO "Pid: %d, comm: %.20s %s %s %.*s %s\n", | ||
174 | current->pid, current->comm, print_tainted(), | ||
175 | init_utsname()->release, | ||
176 | (int)strcspn(init_utsname()->version, " "), | ||
177 | init_utsname()->version, board); | ||
178 | printk(KERN_INFO "RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->ip); | 166 | printk(KERN_INFO "RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->ip); |
179 | printk_address(regs->ip, 1); | 167 | printk_address(regs->ip, 1); |
180 | printk(KERN_INFO "RSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss, | 168 | printk(KERN_INFO "RSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss, |