diff options
author | Alexander van Heukelum <heukelum@mailshack.com> | 2008-07-01 19:33:14 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-09 02:18:31 -0400 |
commit | 7b4fd4bb2e7fad2c41afab4683a44ab77f6f35d0 (patch) | |
tree | 09eda64368c825c550cf7eb032a34f98976b547f /arch/x86 | |
parent | abd348072798aa88d48fe9f182ac3440fcb7ae47 (diff) |
x86: traps_xx: various small changes
- order of local variable declarations
- minor code changes
Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kernel/traps_32.c | 15 | ||||
-rw-r--r-- | arch/x86/kernel/traps_64.c | 20 |
2 files changed, 18 insertions, 17 deletions
diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c index fb8e3cce7bfb..8a768973c4f0 100644 --- a/arch/x86/kernel/traps_32.c +++ b/arch/x86/kernel/traps_32.c | |||
@@ -106,13 +106,13 @@ static int die_counter; | |||
106 | void printk_address(unsigned long address, int reliable) | 106 | void printk_address(unsigned long address, int reliable) |
107 | { | 107 | { |
108 | #ifdef CONFIG_KALLSYMS | 108 | #ifdef CONFIG_KALLSYMS |
109 | char namebuf[KSYM_NAME_LEN]; | ||
110 | unsigned long offset = 0; | 109 | unsigned long offset = 0; |
111 | unsigned long symsize; | 110 | unsigned long symsize; |
112 | const char *symname; | 111 | const char *symname; |
113 | char reliab[4] = ""; | ||
114 | char *delim = ":"; | ||
115 | char *modname; | 112 | char *modname; |
113 | char *delim = ":"; | ||
114 | char namebuf[KSYM_NAME_LEN]; | ||
115 | char reliab[4] = ""; | ||
116 | 116 | ||
117 | symname = kallsyms_lookup(address, &symsize, &offset, | 117 | symname = kallsyms_lookup(address, &symsize, &offset, |
118 | &modname, namebuf); | 118 | &modname, namebuf); |
@@ -135,8 +135,8 @@ void printk_address(unsigned long address, int reliable) | |||
135 | static inline int valid_stack_ptr(struct thread_info *tinfo, | 135 | static inline int valid_stack_ptr(struct thread_info *tinfo, |
136 | void *p, unsigned int size) | 136 | void *p, unsigned int size) |
137 | { | 137 | { |
138 | return p > (void *)tinfo && | 138 | void *t = tinfo; |
139 | p <= (void *)tinfo + THREAD_SIZE - size; | 139 | return p > t && p <= t + THREAD_SIZE - size; |
140 | } | 140 | } |
141 | 141 | ||
142 | /* The form of the top of the frame on the stack */ | 142 | /* The form of the top of the frame on the stack */ |
@@ -976,9 +976,8 @@ clear_TF_reenable: | |||
976 | void math_error(void __user *ip) | 976 | void math_error(void __user *ip) |
977 | { | 977 | { |
978 | struct task_struct *task; | 978 | struct task_struct *task; |
979 | unsigned short cwd; | ||
980 | unsigned short swd; | ||
981 | siginfo_t info; | 979 | siginfo_t info; |
980 | unsigned short cwd, swd; | ||
982 | 981 | ||
983 | /* | 982 | /* |
984 | * Save the info for the exception handler and clear the error. | 983 | * 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 | static void simd_math_error(void __user *ip) | 1041 | static void simd_math_error(void __user *ip) |
1043 | { | 1042 | { |
1044 | struct task_struct *task; | 1043 | struct task_struct *task; |
1045 | unsigned short mxcsr; | ||
1046 | siginfo_t info; | 1044 | siginfo_t info; |
1045 | unsigned short mxcsr; | ||
1047 | 1046 | ||
1048 | /* | 1047 | /* |
1049 | * Save the info for the exception handler and clear the error. | 1048 | * Save the info for the exception handler and clear the error. |
diff --git a/arch/x86/kernel/traps_64.c b/arch/x86/kernel/traps_64.c index 9b9245f81b9f..74e992957ff6 100644 --- a/arch/x86/kernel/traps_64.c +++ b/arch/x86/kernel/traps_64.c | |||
@@ -268,7 +268,6 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs, | |||
268 | 268 | ||
269 | if (!task) | 269 | if (!task) |
270 | task = current; | 270 | task = current; |
271 | tinfo = task_thread_info(task); | ||
272 | 271 | ||
273 | if (!stack) { | 272 | if (!stack) { |
274 | unsigned long dummy; | 273 | unsigned long dummy; |
@@ -294,6 +293,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs, | |||
294 | * current stack address. If the stacks consist of nested | 293 | * current stack address. If the stacks consist of nested |
295 | * exceptions | 294 | * exceptions |
296 | */ | 295 | */ |
296 | tinfo = task_thread_info(task); | ||
297 | for (;;) { | 297 | for (;;) { |
298 | char *id; | 298 | char *id; |
299 | unsigned long *estack_end; | 299 | unsigned long *estack_end; |
@@ -435,8 +435,8 @@ void show_stack(struct task_struct *task, unsigned long *sp) | |||
435 | */ | 435 | */ |
436 | void dump_stack(void) | 436 | void dump_stack(void) |
437 | { | 437 | { |
438 | unsigned long stack; | ||
439 | unsigned long bp = 0; | 438 | unsigned long bp = 0; |
439 | unsigned long stack; | ||
440 | 440 | ||
441 | #ifdef CONFIG_FRAME_POINTER | 441 | #ifdef CONFIG_FRAME_POINTER |
442 | if (!bp) | 442 | if (!bp) |
@@ -459,12 +459,8 @@ void show_registers(struct pt_regs *regs) | |||
459 | unsigned long sp; | 459 | unsigned long sp; |
460 | const int cpu = smp_processor_id(); | 460 | const int cpu = smp_processor_id(); |
461 | struct task_struct *cur = cpu_pda(cpu)->pcurrent; | 461 | struct task_struct *cur = cpu_pda(cpu)->pcurrent; |
462 | u8 *ip; | ||
463 | unsigned int code_prologue = code_bytes * 43 / 64; | ||
464 | unsigned int code_len = code_bytes; | ||
465 | 462 | ||
466 | sp = regs->sp; | 463 | sp = regs->sp; |
467 | ip = (u8 *) regs->ip - code_prologue; | ||
468 | printk("CPU %d ", cpu); | 464 | printk("CPU %d ", cpu); |
469 | __show_regs(regs); | 465 | __show_regs(regs); |
470 | printk("Process %s (pid: %d, threadinfo %p, task %p)\n", | 466 | printk("Process %s (pid: %d, threadinfo %p, task %p)\n", |
@@ -475,12 +471,18 @@ void show_registers(struct pt_regs *regs) | |||
475 | * time of the fault.. | 471 | * time of the fault.. |
476 | */ | 472 | */ |
477 | if (!user_mode(regs)) { | 473 | if (!user_mode(regs)) { |
474 | unsigned int code_prologue = code_bytes * 43 / 64; | ||
475 | unsigned int code_len = code_bytes; | ||
478 | unsigned char c; | 476 | unsigned char c; |
477 | u8 *ip; | ||
478 | |||
479 | printk("Stack: "); | 479 | printk("Stack: "); |
480 | _show_stack(NULL, regs, (unsigned long *)sp, regs->bp); | 480 | _show_stack(NULL, regs, (unsigned long *)sp, regs->bp); |
481 | printk("\n"); | 481 | printk("\n"); |
482 | 482 | ||
483 | printk(KERN_EMERG "Code: "); | 483 | printk(KERN_EMERG "Code: "); |
484 | |||
485 | ip = (u8 *)regs->ip - code_prologue; | ||
484 | if (ip < (u8 *)PAGE_OFFSET || probe_kernel_address(ip, c)) { | 486 | if (ip < (u8 *)PAGE_OFFSET || probe_kernel_address(ip, c)) { |
485 | /* try starting at RIP */ | 487 | /* try starting at RIP */ |
486 | ip = (u8 *)regs->ip; | 488 | ip = (u8 *)regs->ip; |
@@ -585,7 +587,7 @@ int __kprobes __die(const char *str, struct pt_regs *regs, long err) | |||
585 | return 0; | 587 | return 0; |
586 | } | 588 | } |
587 | 589 | ||
588 | void die(const char * str, struct pt_regs *regs, long err) | 590 | void die(const char *str, struct pt_regs *regs, long err) |
589 | { | 591 | { |
590 | unsigned long flags = oops_begin(); | 592 | unsigned long flags = oops_begin(); |
591 | 593 | ||
@@ -927,8 +929,8 @@ asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs) | |||
927 | asmlinkage void __kprobes do_debug(struct pt_regs * regs, | 929 | asmlinkage void __kprobes do_debug(struct pt_regs * regs, |
928 | unsigned long error_code) | 930 | unsigned long error_code) |
929 | { | 931 | { |
930 | unsigned long condition; | ||
931 | struct task_struct *tsk = current; | 932 | struct task_struct *tsk = current; |
933 | unsigned long condition; | ||
932 | siginfo_t info; | 934 | siginfo_t info; |
933 | 935 | ||
934 | trace_hardirqs_fixup(); | 936 | trace_hardirqs_fixup(); |
@@ -1201,7 +1203,7 @@ void __init trap_init(void) | |||
1201 | /* | 1203 | /* |
1202 | * initialize the per thread extended state: | 1204 | * initialize the per thread extended state: |
1203 | */ | 1205 | */ |
1204 | init_thread_xstate(); | 1206 | init_thread_xstate(); |
1205 | /* | 1207 | /* |
1206 | * Should be a barrier for any external CPU state: | 1208 | * Should be a barrier for any external CPU state: |
1207 | */ | 1209 | */ |