Commit 7b4fd4bb authored by Alexander van Heukelum's avatar Alexander van Heukelum Committed by Ingo Molnar

x86: traps_xx: various small changes

 - order of local variable declarations
 - minor code changes
Signed-off-by: default avatarAlexander van Heukelum <heukelum@fastmail.fm>
Acked-by: default avatarCyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent abd34807
...@@ -106,13 +106,13 @@ static int die_counter; ...@@ -106,13 +106,13 @@ static int die_counter;
void printk_address(unsigned long address, int reliable) void printk_address(unsigned long address, int reliable)
{ {
#ifdef CONFIG_KALLSYMS #ifdef CONFIG_KALLSYMS
char namebuf[KSYM_NAME_LEN];
unsigned long offset = 0; unsigned long offset = 0;
unsigned long symsize; unsigned long symsize;
const char *symname; const char *symname;
char reliab[4] = "";
char *delim = ":";
char *modname; char *modname;
char *delim = ":";
char namebuf[KSYM_NAME_LEN];
char reliab[4] = "";
symname = kallsyms_lookup(address, &symsize, &offset, symname = kallsyms_lookup(address, &symsize, &offset,
&modname, namebuf); &modname, namebuf);
...@@ -135,8 +135,8 @@ void printk_address(unsigned long address, int reliable) ...@@ -135,8 +135,8 @@ void printk_address(unsigned long address, int reliable)
static inline int valid_stack_ptr(struct thread_info *tinfo, static inline int valid_stack_ptr(struct thread_info *tinfo,
void *p, unsigned int size) void *p, unsigned int size)
{ {
return p > (void *)tinfo && void *t = tinfo;
p <= (void *)tinfo + THREAD_SIZE - size; return p > t && p <= t + THREAD_SIZE - size;
} }
/* The form of the top of the frame on the stack */ /* The form of the top of the frame on the stack */
...@@ -976,9 +976,8 @@ void __kprobes do_debug(struct pt_regs *regs, long error_code) ...@@ -976,9 +976,8 @@ void __kprobes do_debug(struct pt_regs *regs, long error_code)
void math_error(void __user *ip) void math_error(void __user *ip)
{ {
struct task_struct *task; struct task_struct *task;
unsigned short cwd;
unsigned short swd;
siginfo_t info; siginfo_t info;
unsigned short cwd, swd;
/* /*
* Save the info for the exception handler and clear the error. * Save the info for the exception handler and clear the error.
...@@ -1042,8 +1041,8 @@ void do_coprocessor_error(struct pt_regs *regs, long error_code) ...@@ -1042,8 +1041,8 @@ void do_coprocessor_error(struct pt_regs *regs, long error_code)
static void simd_math_error(void __user *ip) static void simd_math_error(void __user *ip)
{ {
struct task_struct *task; struct task_struct *task;
unsigned short mxcsr;
siginfo_t info; siginfo_t info;
unsigned short mxcsr;
/* /*
* Save the info for the exception handler and clear the error. * Save the info for the exception handler and clear the error.
......
...@@ -268,7 +268,6 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs, ...@@ -268,7 +268,6 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
if (!task) if (!task)
task = current; task = current;
tinfo = task_thread_info(task);
if (!stack) { if (!stack) {
unsigned long dummy; unsigned long dummy;
...@@ -294,6 +293,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs, ...@@ -294,6 +293,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
* current stack address. If the stacks consist of nested * current stack address. If the stacks consist of nested
* exceptions * exceptions
*/ */
tinfo = task_thread_info(task);
for (;;) { for (;;) {
char *id; char *id;
unsigned long *estack_end; unsigned long *estack_end;
...@@ -435,8 +435,8 @@ void show_stack(struct task_struct *task, unsigned long *sp) ...@@ -435,8 +435,8 @@ void show_stack(struct task_struct *task, unsigned long *sp)
*/ */
void dump_stack(void) void dump_stack(void)
{ {
unsigned long stack;
unsigned long bp = 0; unsigned long bp = 0;
unsigned long stack;
#ifdef CONFIG_FRAME_POINTER #ifdef CONFIG_FRAME_POINTER
if (!bp) if (!bp)
...@@ -459,12 +459,8 @@ void show_registers(struct pt_regs *regs) ...@@ -459,12 +459,8 @@ void show_registers(struct pt_regs *regs)
unsigned long sp; unsigned long sp;
const int cpu = smp_processor_id(); const int cpu = smp_processor_id();
struct task_struct *cur = cpu_pda(cpu)->pcurrent; 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; sp = regs->sp;
ip = (u8 *) regs->ip - code_prologue;
printk("CPU %d ", cpu); printk("CPU %d ", cpu);
__show_regs(regs); __show_regs(regs);
printk("Process %s (pid: %d, threadinfo %p, task %p)\n", printk("Process %s (pid: %d, threadinfo %p, task %p)\n",
...@@ -475,12 +471,18 @@ void show_registers(struct pt_regs *regs) ...@@ -475,12 +471,18 @@ void show_registers(struct pt_regs *regs)
* time of the fault.. * time of the fault..
*/ */
if (!user_mode(regs)) { if (!user_mode(regs)) {
unsigned int code_prologue = code_bytes * 43 / 64;
unsigned int code_len = code_bytes;
unsigned char c; unsigned char c;
u8 *ip;
printk("Stack: "); printk("Stack: ");
_show_stack(NULL, regs, (unsigned long *)sp, regs->bp); _show_stack(NULL, regs, (unsigned long *)sp, regs->bp);
printk("\n"); printk("\n");
printk(KERN_EMERG "Code: "); printk(KERN_EMERG "Code: ");
ip = (u8 *)regs->ip - code_prologue;
if (ip < (u8 *)PAGE_OFFSET || probe_kernel_address(ip, c)) { if (ip < (u8 *)PAGE_OFFSET || probe_kernel_address(ip, c)) {
/* try starting at RIP */ /* try starting at RIP */
ip = (u8 *)regs->ip; ip = (u8 *)regs->ip;
...@@ -585,7 +587,7 @@ int __kprobes __die(const char *str, struct pt_regs *regs, long err) ...@@ -585,7 +587,7 @@ int __kprobes __die(const char *str, struct pt_regs *regs, long err)
return 0; return 0;
} }
void die(const char * str, struct pt_regs *regs, long err) void die(const char *str, struct pt_regs *regs, long err)
{ {
unsigned long flags = oops_begin(); unsigned long flags = oops_begin();
...@@ -927,8 +929,8 @@ asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs) ...@@ -927,8 +929,8 @@ asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs)
asmlinkage void __kprobes do_debug(struct pt_regs * regs, asmlinkage void __kprobes do_debug(struct pt_regs * regs,
unsigned long error_code) unsigned long error_code)
{ {
unsigned long condition;
struct task_struct *tsk = current; struct task_struct *tsk = current;
unsigned long condition;
siginfo_t info; siginfo_t info;
trace_hardirqs_fixup(); trace_hardirqs_fixup();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment