aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorChuck Ebbert <cebbert@redhat.com>2007-02-13 07:26:25 -0500
committerAndi Kleen <andi@basil.nowhere.org>2007-02-13 07:26:25 -0500
commit86c418374223be3f328b5522545196db02c8ceda (patch)
treead37553ac8f06c112943c3938cc66247c8cc7432 /arch
parent8469adde5932f2879688fd5f183a6e9dadbf7b9f (diff)
[PATCH] i386: add option to show more code in oops reports
Sometimes developers need to see more object code in an oops report, e.g. when kernel may be corrupted at runtime. Add the "code_bytes" option for this. Signed-off-by: Chuck Ebbert <cebbert@redhat.com> Signed-off-by: Andi Kleen <ak@suse.de> Cc: Andi Kleen <ak@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/i386/kernel/traps.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c
index 4ec21037a361..af0d3f70a817 100644
--- a/arch/i386/kernel/traps.c
+++ b/arch/i386/kernel/traps.c
@@ -94,6 +94,7 @@ asmlinkage void spurious_interrupt_bug(void);
94asmlinkage void machine_check(void); 94asmlinkage void machine_check(void);
95 95
96int kstack_depth_to_print = 24; 96int kstack_depth_to_print = 24;
97static unsigned int code_bytes = 64;
97ATOMIC_NOTIFIER_HEAD(i386die_chain); 98ATOMIC_NOTIFIER_HEAD(i386die_chain);
98 99
99int register_die_notifier(struct notifier_block *nb) 100int register_die_notifier(struct notifier_block *nb)
@@ -325,7 +326,8 @@ void show_registers(struct pt_regs *regs)
325 */ 326 */
326 if (in_kernel) { 327 if (in_kernel) {
327 u8 *eip; 328 u8 *eip;
328 int code_bytes = 64; 329 unsigned int code_prologue = code_bytes * 43 / 64;
330 unsigned int code_len = code_bytes;
329 unsigned char c; 331 unsigned char c;
330 332
331 printk("\n" KERN_EMERG "Stack: "); 333 printk("\n" KERN_EMERG "Stack: ");
@@ -333,14 +335,14 @@ void show_registers(struct pt_regs *regs)
333 335
334 printk(KERN_EMERG "Code: "); 336 printk(KERN_EMERG "Code: ");
335 337
336 eip = (u8 *)regs->eip - 43; 338 eip = (u8 *)regs->eip - code_prologue;
337 if (eip < (u8 *)PAGE_OFFSET || 339 if (eip < (u8 *)PAGE_OFFSET ||
338 probe_kernel_address(eip, c)) { 340 probe_kernel_address(eip, c)) {
339 /* try starting at EIP */ 341 /* try starting at EIP */
340 eip = (u8 *)regs->eip; 342 eip = (u8 *)regs->eip;
341 code_bytes = 32; 343 code_len = code_len - code_prologue + 1;
342 } 344 }
343 for (i = 0; i < code_bytes; i++, eip++) { 345 for (i = 0; i < code_len; i++, eip++) {
344 if (eip < (u8 *)PAGE_OFFSET || 346 if (eip < (u8 *)PAGE_OFFSET ||
345 probe_kernel_address(eip, c)) { 347 probe_kernel_address(eip, c)) {
346 printk(" Bad EIP value."); 348 printk(" Bad EIP value.");
@@ -1192,3 +1194,13 @@ static int __init kstack_setup(char *s)
1192 return 1; 1194 return 1;
1193} 1195}
1194__setup("kstack=", kstack_setup); 1196__setup("kstack=", kstack_setup);
1197
1198static int __init code_bytes_setup(char *s)
1199{
1200 code_bytes = simple_strtoul(s, NULL, 0);
1201 if (code_bytes > 8192)
1202 code_bytes = 8192;
1203
1204 return 1;
1205}
1206__setup("code_bytes=", code_bytes_setup);