Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 80265
b: refs/heads/master
c: a25bd94
h: refs/heads/master
i:
  80263: 047a5ad
v: v3
  • Loading branch information
Arjan van de Ven authored and Ingo Molnar committed Jan 30, 2008
1 parent 8ae6ade commit b490cdc
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6dab27784b2a97823b522e1cb88e40be40a93d45
refs/heads/master: a25bd94964e87b1b93903a822fba5025d995d4da
4 changes: 2 additions & 2 deletions trunk/Documentation/kernel-parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@ and is between 256 and 4096 characters. It is defined in the file
[SPARC64] tick
[X86-64] hpet,tsc

code_bytes [IA32] How many bytes of object code to print in an
oops report.
code_bytes [IA32/X86_64] How many bytes of object code to print
in an oops report.
Range: 0 - 8192
Default: 64

Expand Down
44 changes: 33 additions & 11 deletions trunk/arch/x86/kernel/traps_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ asmlinkage void alignment_check(void);
asmlinkage void machine_check(void);
asmlinkage void spurious_interrupt_bug(void);

static unsigned int code_bytes = 64;

static inline void conditional_sti(struct pt_regs *regs)
{
if (regs->flags & X86_EFLAGS_IF)
Expand Down Expand Up @@ -459,12 +461,15 @@ EXPORT_SYMBOL(dump_stack);
void show_registers(struct pt_regs *regs)
{
int i;
int in_kernel = !user_mode(regs);
unsigned long sp;
const int cpu = smp_processor_id();
struct task_struct *cur = cpu_pda(cpu)->pcurrent;
u8 *ip;
unsigned int code_prologue = code_bytes * 43 / 64;
unsigned int code_len = code_bytes;

sp = regs->sp;
ip = (u8 *) regs->ip - code_prologue;
printk("CPU %d ", cpu);
__show_regs(regs);
printk("Process %s (pid: %d, threadinfo %p, task %p)\n",
Expand All @@ -474,22 +479,28 @@ void show_registers(struct pt_regs *regs)
* When in-kernel, we also print out the stack and code at the
* time of the fault..
*/
if (in_kernel) {
if (!user_mode(regs)) {
unsigned char c;
printk("Stack: ");
_show_stack(NULL, regs, (unsigned long *)sp, regs->bp);
printk("\n");

printk("\nCode: ");
if (regs->ip < PAGE_OFFSET)
goto bad;

for (i=0; i<20; i++) {
unsigned char c;
if (__get_user(c, &((unsigned char*)regs->ip)[i])) {
bad:
printk(KERN_EMERG "Code: ");
if (ip < (u8 *)PAGE_OFFSET || probe_kernel_address(ip, c)) {
/* try starting at RIP */
ip = (u8 *) regs->ip;
code_len = code_len - code_prologue + 1;
}
for (i = 0; i < code_len; i++, ip++) {
if (ip < (u8 *)PAGE_OFFSET ||
probe_kernel_address(ip, c)) {
printk(" Bad RIP value.");
break;
}
printk("%02x ", c);
if (ip == (u8 *)regs->ip)
printk("<%02x> ", c);
else
printk("%02x ", c);
}
}
printk("\n");
Expand Down Expand Up @@ -1164,3 +1175,14 @@ static int __init kstack_setup(char *s)
return 0;
}
early_param("kstack", kstack_setup);


static int __init code_bytes_setup(char *s)
{
code_bytes = simple_strtoul(s, NULL, 0);
if (code_bytes > 8192)
code_bytes = 8192;

return 1;
}
__setup("code_bytes=", code_bytes_setup);

0 comments on commit b490cdc

Please sign in to comment.