Commit 4df9e510 authored by Gustavo F. Padovan's avatar Gustavo F. Padovan Committed by Ingo Molnar

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: default avatarGustavo F. Padovan <gustavo@las.ic.unicamp.br>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent caa007dd
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
#include <linux/bug.h> #include <linux/bug.h>
#include <linux/nmi.h> #include <linux/nmi.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/smp.h>
#include <linux/io.h>
#if defined(CONFIG_EDAC) #if defined(CONFIG_EDAC)
#include <linux/edac.h> #include <linux/edac.h>
...@@ -45,9 +47,6 @@ ...@@ -45,9 +47,6 @@
#include <asm/unwind.h> #include <asm/unwind.h>
#include <asm/desc.h> #include <asm/desc.h>
#include <asm/i387.h> #include <asm/i387.h>
#include <asm/nmi.h>
#include <asm/smp.h>
#include <asm/io.h>
#include <asm/pgalloc.h> #include <asm/pgalloc.h>
#include <asm/proto.h> #include <asm/proto.h>
#include <asm/pda.h> #include <asm/pda.h>
...@@ -85,7 +84,8 @@ static inline void preempt_conditional_cli(struct pt_regs *regs) ...@@ -85,7 +84,8 @@ static inline void preempt_conditional_cli(struct pt_regs *regs)
void printk_address(unsigned long address, int reliable) void printk_address(unsigned long address, int reliable)
{ {
printk(" [<%016lx>] %s%pS\n", address, reliable ? "": "? ", (void *) address); printk(" [<%016lx>] %s%pS\n", address, reliable ?
"" : "? ", (void *) address);
} }
static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack, static 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,7 +98,8 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
[STACKFAULT_STACK - 1] = "#SS", [STACKFAULT_STACK - 1] = "#SS",
[MCE_STACK - 1] = "#MC", [MCE_STACK - 1] = "#MC",
#if DEBUG_STKSZ > EXCEPTION_STKSZ #if DEBUG_STKSZ > EXCEPTION_STKSZ
[N_EXCEPTION_STACKS ... N_EXCEPTION_STACKS + DEBUG_STKSZ / EXCEPTION_STKSZ - 2] = "#DB[?]" [N_EXCEPTION_STACKS ... N_EXCEPTION_STACKS + DEBUG_STKSZ /
EXCEPTION_STKSZ - 2] = "#DB[?]"
#endif #endif
}; };
unsigned k; unsigned k;
...@@ -163,7 +164,7 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack, ...@@ -163,7 +164,7 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
} }
/* /*
* x86-64 can have up to three kernel stacks: * x86-64 can have up to three kernel stacks:
* process stack * process stack
* interrupt stack * interrupt stack
* severe exception (double fault, nmi, stack fault, debug, mce) hardware stack * 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,7 +220,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
const struct stacktrace_ops *ops, void *data) const struct stacktrace_ops *ops, void *data)
{ {
const unsigned cpu = get_cpu(); const unsigned cpu = get_cpu();
unsigned long *irqstack_end = (unsigned long*)cpu_pda(cpu)->irqstackptr; unsigned long *irqstack_end = (unsigned long *)cpu_pda(cpu)->irqstackptr;
unsigned used = 0; unsigned used = 0;
struct thread_info *tinfo; struct thread_info *tinfo;
...@@ -237,7 +238,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs, ...@@ -237,7 +238,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
if (!bp) { if (!bp) {
if (task == current) { if (task == current) {
/* Grab bp right from our regs */ /* Grab bp right from our regs */
asm("movq %%rbp, %0" : "=r" (bp) :); asm("movq %%rbp, %0" : "=r" (bp) : );
} else { } else {
/* bp is the last reg pushed by switch_to */ /* bp is the last reg pushed by switch_to */
bp = *(unsigned long *) task->thread.sp; bp = *(unsigned long *) task->thread.sp;
...@@ -357,11 +358,13 @@ show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs, ...@@ -357,11 +358,13 @@ show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
unsigned long *stack; unsigned long *stack;
int i; int i;
const int cpu = smp_processor_id(); const int cpu = smp_processor_id();
unsigned long *irqstack_end = (unsigned long *) (cpu_pda(cpu)->irqstackptr); unsigned long *irqstack_end =
unsigned long *irqstack = (unsigned long *) (cpu_pda(cpu)->irqstackptr - IRQSTACKSIZE); (unsigned long *) (cpu_pda(cpu)->irqstackptr);
unsigned long *irqstack =
(unsigned long *) (cpu_pda(cpu)->irqstackptr - IRQSTACKSIZE);
// debugging aid: "show_stack(NULL, NULL);" prints the /* debugging aid: "show_stack(NULL, NULL);" prints the
// back trace for this cpu. back trace for this cpu. */
if (sp == NULL) { if (sp == NULL) {
if (task) if (task)
...@@ -404,7 +407,7 @@ void dump_stack(void) ...@@ -404,7 +407,7 @@ void dump_stack(void)
#ifdef CONFIG_FRAME_POINTER #ifdef CONFIG_FRAME_POINTER
if (!bp) if (!bp)
asm("movq %%rbp, %0" : "=r" (bp):); asm("movq %%rbp, %0" : "=r" (bp) : );
#endif #endif
printk("Pid: %d, comm: %.20s %s %s %.*s\n", printk("Pid: %d, comm: %.20s %s %s %.*s\n",
...@@ -414,7 +417,6 @@ void dump_stack(void) ...@@ -414,7 +417,6 @@ void dump_stack(void)
init_utsname()->version); init_utsname()->version);
show_trace(NULL, NULL, &stack, bp); show_trace(NULL, NULL, &stack, bp);
} }
EXPORT_SYMBOL(dump_stack); EXPORT_SYMBOL(dump_stack);
void show_registers(struct pt_regs *regs) void show_registers(struct pt_regs *regs)
...@@ -493,7 +495,7 @@ unsigned __kprobes long oops_begin(void) ...@@ -493,7 +495,7 @@ unsigned __kprobes long oops_begin(void)
raw_local_irq_save(flags); raw_local_irq_save(flags);
cpu = smp_processor_id(); cpu = smp_processor_id();
if (!__raw_spin_trylock(&die_lock)) { if (!__raw_spin_trylock(&die_lock)) {
if (cpu == die_owner) if (cpu == die_owner)
/* nested oops. should stop eventually */; /* nested oops. should stop eventually */;
else else
__raw_spin_lock(&die_lock); __raw_spin_lock(&die_lock);
...@@ -638,7 +640,7 @@ do_trap(int trapnr, int signr, char *str, struct pt_regs *regs, ...@@ -638,7 +640,7 @@ do_trap(int trapnr, int signr, char *str, struct pt_regs *regs,
} }
#define DO_ERROR(trapnr, signr, str, name) \ #define DO_ERROR(trapnr, signr, str, name) \
asmlinkage void do_##name(struct pt_regs * regs, long error_code) \ asmlinkage void do_##name(struct pt_regs *regs, long error_code) \
{ \ { \
if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \ if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
== NOTIFY_STOP) \ == NOTIFY_STOP) \
...@@ -648,7 +650,7 @@ asmlinkage void do_##name(struct pt_regs * regs, long error_code) \ ...@@ -648,7 +650,7 @@ asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
} }
#define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \ #define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \
asmlinkage void do_##name(struct pt_regs * regs, long error_code) \ asmlinkage void do_##name(struct pt_regs *regs, long error_code) \
{ \ { \
siginfo_t info; \ siginfo_t info; \
info.si_signo = signr; \ info.si_signo = signr; \
...@@ -683,7 +685,7 @@ asmlinkage void do_stack_segment(struct pt_regs *regs, long error_code) ...@@ -683,7 +685,7 @@ asmlinkage void do_stack_segment(struct pt_regs *regs, long error_code)
preempt_conditional_cli(regs); preempt_conditional_cli(regs);
} }
asmlinkage void do_double_fault(struct pt_regs * regs, long error_code) asmlinkage void do_double_fault(struct pt_regs *regs, long error_code)
{ {
static const char str[] = "double fault"; static const char str[] = "double fault";
struct task_struct *tsk = current; struct task_struct *tsk = current;
...@@ -778,9 +780,10 @@ io_check_error(unsigned char reason, struct pt_regs *regs) ...@@ -778,9 +780,10 @@ io_check_error(unsigned char reason, struct pt_regs *regs)
} }
static notrace __kprobes void static notrace __kprobes void
unknown_nmi_error(unsigned char reason, struct pt_regs * regs) unknown_nmi_error(unsigned char reason, struct pt_regs *regs)
{ {
if (notify_die(DIE_NMIUNKNOWN, "nmi", regs, reason, 2, SIGINT) == NOTIFY_STOP) if (notify_die(DIE_NMIUNKNOWN, "nmi", regs, reason, 2, SIGINT) ==
NOTIFY_STOP)
return; return;
printk(KERN_EMERG "Uhhuh. NMI received for unknown reason %02x.\n", printk(KERN_EMERG "Uhhuh. NMI received for unknown reason %02x.\n",
reason); reason);
...@@ -882,7 +885,7 @@ asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs) ...@@ -882,7 +885,7 @@ asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs)
else if (user_mode(eregs)) else if (user_mode(eregs))
regs = task_pt_regs(current); regs = task_pt_regs(current);
/* Exception from kernel and interrupts are enabled. Move to /* Exception from kernel and interrupts are enabled. Move to
kernel process stack. */ kernel process stack. */
else if (eregs->flags & X86_EFLAGS_IF) else if (eregs->flags & X86_EFLAGS_IF)
regs = (struct pt_regs *)(eregs->sp -= sizeof(struct pt_regs)); regs = (struct pt_regs *)(eregs->sp -= sizeof(struct pt_regs));
if (eregs != regs) if (eregs != regs)
...@@ -891,7 +894,7 @@ asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs) ...@@ -891,7 +894,7 @@ asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs)
} }
/* runs on IST stack. */ /* runs on IST stack. */
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)
{ {
struct task_struct *tsk = current; struct task_struct *tsk = current;
...@@ -1035,7 +1038,7 @@ asmlinkage void do_coprocessor_error(struct pt_regs *regs) ...@@ -1035,7 +1038,7 @@ asmlinkage void do_coprocessor_error(struct pt_regs *regs)
asmlinkage void bad_intr(void) asmlinkage void bad_intr(void)
{ {
printk("bad interrupt"); printk("bad interrupt");
} }
asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs) asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs)
...@@ -1047,7 +1050,7 @@ asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs) ...@@ -1047,7 +1050,7 @@ asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs)
conditional_sti(regs); conditional_sti(regs);
if (!user_mode(regs) && if (!user_mode(regs) &&
kernel_math_error(regs, "kernel simd math error", 19)) kernel_math_error(regs, "kernel simd math error", 19))
return; return;
/* /*
...@@ -1092,7 +1095,7 @@ asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs) ...@@ -1092,7 +1095,7 @@ asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs)
force_sig_info(SIGFPE, &info, task); force_sig_info(SIGFPE, &info, task);
} }
asmlinkage void do_spurious_interrupt_bug(struct pt_regs * regs) asmlinkage void do_spurious_interrupt_bug(struct pt_regs *regs)
{ {
} }
...@@ -1142,8 +1145,10 @@ void __init trap_init(void) ...@@ -1142,8 +1145,10 @@ void __init trap_init(void)
set_intr_gate(0, &divide_error); set_intr_gate(0, &divide_error);
set_intr_gate_ist(1, &debug, DEBUG_STACK); set_intr_gate_ist(1, &debug, DEBUG_STACK);
set_intr_gate_ist(2, &nmi, NMI_STACK); set_intr_gate_ist(2, &nmi, NMI_STACK);
set_system_gate_ist(3, &int3, DEBUG_STACK); /* int3 can be called from all */ /* int3 can be called from all */
set_system_gate(4, &overflow); /* int4 can be called from all */ set_system_gate_ist(3, &int3, DEBUG_STACK);
/* int4 can be called from all */
set_system_gate(4, &overflow);
set_intr_gate(5, &bounds); set_intr_gate(5, &bounds);
set_intr_gate(6, &invalid_op); set_intr_gate(6, &invalid_op);
set_intr_gate(7, &device_not_available); set_intr_gate(7, &device_not_available);
......
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