aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/traps_64.c
diff options
context:
space:
mode:
authorGustavo F. Padovan <gustavo@las.ic.unicamp.br>2008-07-29 01:48:55 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-31 12:21:32 -0400
commit4df9e510a9fda29aca71d8acac853b98aa6884d1 (patch)
tree08a0d456c8da65b5bb9a5b75a13a5586fbddfd63 /arch/x86/kernel/traps_64.c
parentcaa007dd3687d38a0252484d9d0a8f9d929ba932 (diff)
x86: coding style fixes to arch/x86/kernel/traps_64.c
Fix all errors and many warnings reported by checkpath.pl. Except the change of include <asm/io.h> to <linux/io.h> the traps.o before and after changes are the same. Signed-off-by: Gustavo F. Padovan <gustavo@las.ic.unicamp.br> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/traps_64.c')
-rw-r--r--arch/x86/kernel/traps_64.c59
1 files changed, 32 insertions, 27 deletions
diff --git a/arch/x86/kernel/traps_64.c b/arch/x86/kernel/traps_64.c
index 3f18d73f420c..fe36d96ba70b 100644
--- a/arch/x86/kernel/traps_64.c
+++ b/arch/x86/kernel/traps_64.c
@@ -32,6 +32,8 @@
32#include <linux/bug.h> 32#include <linux/bug.h>
33#include <linux/nmi.h> 33#include <linux/nmi.h>
34#include <linux/mm.h> 34#include <linux/mm.h>
35#include <linux/smp.h>
36#include <linux/io.h>
35 37
36#if defined(CONFIG_EDAC) 38#if defined(CONFIG_EDAC)
37#include <linux/edac.h> 39#include <linux/edac.h>
@@ -45,9 +47,6 @@
45#include <asm/unwind.h> 47#include <asm/unwind.h>
46#include <asm/desc.h> 48#include <asm/desc.h>
47#include <asm/i387.h> 49#include <asm/i387.h>
48#include <asm/nmi.h>
49#include <asm/smp.h>
50#include <asm/io.h>
51#include <asm/pgalloc.h> 50#include <asm/pgalloc.h>
52#include <asm/proto.h> 51#include <asm/proto.h>
53#include <asm/pda.h> 52#include <asm/pda.h>
@@ -85,7 +84,8 @@ static inline void preempt_conditional_cli(struct pt_regs *regs)
85 84
86void printk_address(unsigned long address, int reliable) 85void printk_address(unsigned long address, int reliable)
87{ 86{
88 printk(" [<%016lx>] %s%pS\n", address, reliable ? "": "? ", (void *) address); 87 printk(" [<%016lx>] %s%pS\n", address, reliable ?
88 "" : "? ", (void *) address);
89} 89}
90 90
91static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack, 91static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
@@ -98,7 +98,8 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
98 [STACKFAULT_STACK - 1] = "#SS", 98 [STACKFAULT_STACK - 1] = "#SS",
99 [MCE_STACK - 1] = "#MC", 99 [MCE_STACK - 1] = "#MC",
100#if DEBUG_STKSZ > EXCEPTION_STKSZ 100#if DEBUG_STKSZ > EXCEPTION_STKSZ
101 [N_EXCEPTION_STACKS ... N_EXCEPTION_STACKS + DEBUG_STKSZ / EXCEPTION_STKSZ - 2] = "#DB[?]" 101 [N_EXCEPTION_STACKS ... N_EXCEPTION_STACKS + DEBUG_STKSZ /
102 EXCEPTION_STKSZ - 2] = "#DB[?]"
102#endif 103#endif
103 }; 104 };
104 unsigned k; 105 unsigned k;
@@ -163,7 +164,7 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
163} 164}
164 165
165/* 166/*
166 * x86-64 can have up to three kernel stacks: 167 * x86-64 can have up to three kernel stacks:
167 * process stack 168 * process stack
168 * interrupt stack 169 * interrupt stack
169 * severe exception (double fault, nmi, stack fault, debug, mce) hardware stack 170 * severe exception (double fault, nmi, stack fault, debug, mce) hardware stack
@@ -219,7 +220,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
219 const struct stacktrace_ops *ops, void *data) 220 const struct stacktrace_ops *ops, void *data)
220{ 221{
221 const unsigned cpu = get_cpu(); 222 const unsigned cpu = get_cpu();
222 unsigned long *irqstack_end = (unsigned long*)cpu_pda(cpu)->irqstackptr; 223 unsigned long *irqstack_end = (unsigned long *)cpu_pda(cpu)->irqstackptr;
223 unsigned used = 0; 224 unsigned used = 0;
224 struct thread_info *tinfo; 225 struct thread_info *tinfo;
225 226
@@ -237,7 +238,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
237 if (!bp) { 238 if (!bp) {
238 if (task == current) { 239 if (task == current) {
239 /* Grab bp right from our regs */ 240 /* Grab bp right from our regs */
240 asm("movq %%rbp, %0" : "=r" (bp) :); 241 asm("movq %%rbp, %0" : "=r" (bp) : );
241 } else { 242 } else {
242 /* bp is the last reg pushed by switch_to */ 243 /* bp is the last reg pushed by switch_to */
243 bp = *(unsigned long *) task->thread.sp; 244 bp = *(unsigned long *) task->thread.sp;
@@ -357,11 +358,13 @@ show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
357 unsigned long *stack; 358 unsigned long *stack;
358 int i; 359 int i;
359 const int cpu = smp_processor_id(); 360 const int cpu = smp_processor_id();
360 unsigned long *irqstack_end = (unsigned long *) (cpu_pda(cpu)->irqstackptr); 361 unsigned long *irqstack_end =
361 unsigned long *irqstack = (unsigned long *) (cpu_pda(cpu)->irqstackptr - IRQSTACKSIZE); 362 (unsigned long *) (cpu_pda(cpu)->irqstackptr);
363 unsigned long *irqstack =
364 (unsigned long *) (cpu_pda(cpu)->irqstackptr - IRQSTACKSIZE);
362 365
363 // debugging aid: "show_stack(NULL, NULL);" prints the 366 /* debugging aid: "show_stack(NULL, NULL);" prints the
364 // back trace for this cpu. 367 back trace for this cpu. */
365 368
366 if (sp == NULL) { 369 if (sp == NULL) {
367 if (task) 370 if (task)
@@ -404,7 +407,7 @@ void dump_stack(void)
404 407
405#ifdef CONFIG_FRAME_POINTER 408#ifdef CONFIG_FRAME_POINTER
406 if (!bp) 409 if (!bp)
407 asm("movq %%rbp, %0" : "=r" (bp):); 410 asm("movq %%rbp, %0" : "=r" (bp) : );
408#endif 411#endif
409 412
410 printk("Pid: %d, comm: %.20s %s %s %.*s\n", 413 printk("Pid: %d, comm: %.20s %s %s %.*s\n",
@@ -414,7 +417,6 @@ void dump_stack(void)
414 init_utsname()->version); 417 init_utsname()->version);
415 show_trace(NULL, NULL, &stack, bp); 418 show_trace(NULL, NULL, &stack, bp);
416} 419}
417
418EXPORT_SYMBOL(dump_stack); 420EXPORT_SYMBOL(dump_stack);
419 421
420void show_registers(struct pt_regs *regs) 422void show_registers(struct pt_regs *regs)
@@ -493,7 +495,7 @@ unsigned __kprobes long oops_begin(void)
493 raw_local_irq_save(flags); 495 raw_local_irq_save(flags);
494 cpu = smp_processor_id(); 496 cpu = smp_processor_id();
495 if (!__raw_spin_trylock(&die_lock)) { 497 if (!__raw_spin_trylock(&die_lock)) {
496 if (cpu == die_owner) 498 if (cpu == die_owner)
497 /* nested oops. should stop eventually */; 499 /* nested oops. should stop eventually */;
498 else 500 else
499 __raw_spin_lock(&die_lock); 501 __raw_spin_lock(&die_lock);
@@ -638,7 +640,7 @@ kernel_trap:
638} 640}
639 641
640#define DO_ERROR(trapnr, signr, str, name) \ 642#define DO_ERROR(trapnr, signr, str, name) \
641asmlinkage void do_##name(struct pt_regs * regs, long error_code) \ 643asmlinkage void do_##name(struct pt_regs *regs, long error_code) \
642{ \ 644{ \
643 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \ 645 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
644 == NOTIFY_STOP) \ 646 == NOTIFY_STOP) \
@@ -648,7 +650,7 @@ asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
648} 650}
649 651
650#define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \ 652#define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \
651asmlinkage void do_##name(struct pt_regs * regs, long error_code) \ 653asmlinkage void do_##name(struct pt_regs *regs, long error_code) \
652{ \ 654{ \
653 siginfo_t info; \ 655 siginfo_t info; \
654 info.si_signo = signr; \ 656 info.si_signo = signr; \
@@ -683,7 +685,7 @@ asmlinkage void do_stack_segment(struct pt_regs *regs, long error_code)
683 preempt_conditional_cli(regs); 685 preempt_conditional_cli(regs);
684} 686}
685 687
686asmlinkage void do_double_fault(struct pt_regs * regs, long error_code) 688asmlinkage void do_double_fault(struct pt_regs *regs, long error_code)
687{ 689{
688 static const char str[] = "double fault"; 690 static const char str[] = "double fault";
689 struct task_struct *tsk = current; 691 struct task_struct *tsk = current;
@@ -778,9 +780,10 @@ io_check_error(unsigned char reason, struct pt_regs *regs)
778} 780}
779 781
780static notrace __kprobes void 782static notrace __kprobes void
781unknown_nmi_error(unsigned char reason, struct pt_regs * regs) 783unknown_nmi_error(unsigned char reason, struct pt_regs *regs)
782{ 784{
783 if (notify_die(DIE_NMIUNKNOWN, "nmi", regs, reason, 2, SIGINT) == NOTIFY_STOP) 785 if (notify_die(DIE_NMIUNKNOWN, "nmi", regs, reason, 2, SIGINT) ==
786 NOTIFY_STOP)
784 return; 787 return;
785 printk(KERN_EMERG "Uhhuh. NMI received for unknown reason %02x.\n", 788 printk(KERN_EMERG "Uhhuh. NMI received for unknown reason %02x.\n",
786 reason); 789 reason);
@@ -882,7 +885,7 @@ asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs)
882 else if (user_mode(eregs)) 885 else if (user_mode(eregs))
883 regs = task_pt_regs(current); 886 regs = task_pt_regs(current);
884 /* Exception from kernel and interrupts are enabled. Move to 887 /* Exception from kernel and interrupts are enabled. Move to
885 kernel process stack. */ 888 kernel process stack. */
886 else if (eregs->flags & X86_EFLAGS_IF) 889 else if (eregs->flags & X86_EFLAGS_IF)
887 regs = (struct pt_regs *)(eregs->sp -= sizeof(struct pt_regs)); 890 regs = (struct pt_regs *)(eregs->sp -= sizeof(struct pt_regs));
888 if (eregs != regs) 891 if (eregs != regs)
@@ -891,7 +894,7 @@ asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs)
891} 894}
892 895
893/* runs on IST stack. */ 896/* runs on IST stack. */
894asmlinkage void __kprobes do_debug(struct pt_regs * regs, 897asmlinkage void __kprobes do_debug(struct pt_regs *regs,
895 unsigned long error_code) 898 unsigned long error_code)
896{ 899{
897 struct task_struct *tsk = current; 900 struct task_struct *tsk = current;
@@ -1035,7 +1038,7 @@ asmlinkage void do_coprocessor_error(struct pt_regs *regs)
1035 1038
1036asmlinkage void bad_intr(void) 1039asmlinkage void bad_intr(void)
1037{ 1040{
1038 printk("bad interrupt"); 1041 printk("bad interrupt");
1039} 1042}
1040 1043
1041asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs) 1044asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs)
@@ -1047,7 +1050,7 @@ asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs)
1047 1050
1048 conditional_sti(regs); 1051 conditional_sti(regs);
1049 if (!user_mode(regs) && 1052 if (!user_mode(regs) &&
1050 kernel_math_error(regs, "kernel simd math error", 19)) 1053 kernel_math_error(regs, "kernel simd math error", 19))
1051 return; 1054 return;
1052 1055
1053 /* 1056 /*
@@ -1092,7 +1095,7 @@ asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs)
1092 force_sig_info(SIGFPE, &info, task); 1095 force_sig_info(SIGFPE, &info, task);
1093} 1096}
1094 1097
1095asmlinkage void do_spurious_interrupt_bug(struct pt_regs * regs) 1098asmlinkage void do_spurious_interrupt_bug(struct pt_regs *regs)
1096{ 1099{
1097} 1100}
1098 1101
@@ -1142,8 +1145,10 @@ void __init trap_init(void)
1142 set_intr_gate(0, &divide_error); 1145 set_intr_gate(0, &divide_error);
1143 set_intr_gate_ist(1, &debug, DEBUG_STACK); 1146 set_intr_gate_ist(1, &debug, DEBUG_STACK);
1144 set_intr_gate_ist(2, &nmi, NMI_STACK); 1147 set_intr_gate_ist(2, &nmi, NMI_STACK);
1145 set_system_gate_ist(3, &int3, DEBUG_STACK); /* int3 can be called from all */ 1148 /* int3 can be called from all */
1146 set_system_gate(4, &overflow); /* int4 can be called from all */ 1149 set_system_gate_ist(3, &int3, DEBUG_STACK);
1150 /* int4 can be called from all */
1151 set_system_gate(4, &overflow);
1147 set_intr_gate(5, &bounds); 1152 set_intr_gate(5, &bounds);
1148 set_intr_gate(6, &invalid_op); 1153 set_intr_gate(6, &invalid_op);
1149 set_intr_gate(7, &device_not_available); 1154 set_intr_gate(7, &device_not_available);