aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSrikar Dronamraju <srikar@linux.vnet.ibm.com>2012-03-12 05:25:55 -0400
committerIngo Molnar <mingo@elte.hu>2012-03-13 01:24:09 -0400
commit51e7dc7011c99e1e5294658c7b551b92ca069985 (patch)
treecef8f1aa1f9ef67e5e00e2a5346d5754791a81ac /arch
parente898c6706869fdcbd68b1e7fb0ac7461d98710fe (diff)
x86: Rename trap_no to trap_nr in thread_struct
There are precedences of trap number being referred to as trap_nr. However thread struct refers trap number as trap_no. Change it to trap_nr. Also use enum instead of left-over literals for trap values. This is pure cleanup, no functional change intended. Suggested-by: Ingo Molnar <mingo@eltu.hu> Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Cc: Jim Keniston <jkenisto@linux.vnet.ibm.com> Cc: Linux-mm <linux-mm@kvack.org> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Christoph Hellwig <hch@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Arnaldo Carvalho de Melo <acme@infradead.org> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20120312092555.5379.942.sendpatchset@srdronam.in.ibm.com [ Fixed the math-emu build ] Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/ia32/ia32_signal.c2
-rw-r--r--arch/x86/include/asm/processor.h2
-rw-r--r--arch/x86/kernel/dumpstack.c2
-rw-r--r--arch/x86/kernel/ptrace.c3
-rw-r--r--arch/x86/kernel/signal.c2
-rw-r--r--arch/x86/kernel/traps.c16
-rw-r--r--arch/x86/kernel/vm86_32.c2
-rw-r--r--arch/x86/kernel/vsyscall_64.c2
-rw-r--r--arch/x86/math-emu/fpu_entry.c5
-rw-r--r--arch/x86/mm/fault.c10
10 files changed, 24 insertions, 22 deletions
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index bc09ed2a8b97..45b4fdd4e1da 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -345,7 +345,7 @@ static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc,
345 put_user_ex(regs->dx, &sc->dx); 345 put_user_ex(regs->dx, &sc->dx);
346 put_user_ex(regs->cx, &sc->cx); 346 put_user_ex(regs->cx, &sc->cx);
347 put_user_ex(regs->ax, &sc->ax); 347 put_user_ex(regs->ax, &sc->ax);
348 put_user_ex(current->thread.trap_no, &sc->trapno); 348 put_user_ex(current->thread.trap_nr, &sc->trapno);
349 put_user_ex(current->thread.error_code, &sc->err); 349 put_user_ex(current->thread.error_code, &sc->err);
350 put_user_ex(regs->ip, &sc->ip); 350 put_user_ex(regs->ip, &sc->ip);
351 put_user_ex(regs->cs, (unsigned int __user *)&sc->cs); 351 put_user_ex(regs->cs, (unsigned int __user *)&sc->cs);
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 02ce0b379647..f6d0d2eb0832 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -453,7 +453,7 @@ struct thread_struct {
453 unsigned long ptrace_dr7; 453 unsigned long ptrace_dr7;
454 /* Fault info: */ 454 /* Fault info: */
455 unsigned long cr2; 455 unsigned long cr2;
456 unsigned long trap_no; 456 unsigned long trap_nr;
457 unsigned long error_code; 457 unsigned long error_code;
458 /* floating point and extended processor state */ 458 /* floating point and extended processor state */
459 struct fpu fpu; 459 struct fpu fpu;
diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
index 4025fe4f928f..28f98706b08b 100644
--- a/arch/x86/kernel/dumpstack.c
+++ b/arch/x86/kernel/dumpstack.c
@@ -265,7 +265,7 @@ int __kprobes __die(const char *str, struct pt_regs *regs, long err)
265#endif 265#endif
266 printk("\n"); 266 printk("\n");
267 if (notify_die(DIE_OOPS, str, regs, err, 267 if (notify_die(DIE_OOPS, str, regs, err,
268 current->thread.trap_no, SIGSEGV) == NOTIFY_STOP) 268 current->thread.trap_nr, SIGSEGV) == NOTIFY_STOP)
269 return 1; 269 return 1;
270 270
271 show_registers(regs); 271 show_registers(regs);
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 93e7877a19c4..6fb330adc7c7 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -33,6 +33,7 @@
33#include <asm/prctl.h> 33#include <asm/prctl.h>
34#include <asm/proto.h> 34#include <asm/proto.h>
35#include <asm/hw_breakpoint.h> 35#include <asm/hw_breakpoint.h>
36#include <asm/traps.h>
36 37
37#include "tls.h" 38#include "tls.h"
38 39
@@ -1425,7 +1426,7 @@ static void fill_sigtrap_info(struct task_struct *tsk,
1425 int error_code, int si_code, 1426 int error_code, int si_code,
1426 struct siginfo *info) 1427 struct siginfo *info)
1427{ 1428{
1428 tsk->thread.trap_no = 1; 1429 tsk->thread.trap_nr = X86_TRAP_DB;
1429 tsk->thread.error_code = error_code; 1430 tsk->thread.error_code = error_code;
1430 1431
1431 memset(info, 0, sizeof(*info)); 1432 memset(info, 0, sizeof(*info));
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index c3846b6fb726..9c73acc1c860 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -150,7 +150,7 @@ int setup_sigcontext(struct sigcontext __user *sc, void __user *fpstate,
150 put_user_ex(regs->r15, &sc->r15); 150 put_user_ex(regs->r15, &sc->r15);
151#endif /* CONFIG_X86_64 */ 151#endif /* CONFIG_X86_64 */
152 152
153 put_user_ex(current->thread.trap_no, &sc->trapno); 153 put_user_ex(current->thread.trap_nr, &sc->trapno);
154 put_user_ex(current->thread.error_code, &sc->err); 154 put_user_ex(current->thread.error_code, &sc->err);
155 put_user_ex(regs->ip, &sc->ip); 155 put_user_ex(regs->ip, &sc->ip);
156#ifdef CONFIG_X86_32 156#ifdef CONFIG_X86_32
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 037fc2bc5316..c6d17ad59b8a 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -132,7 +132,7 @@ do_trap(int trapnr, int signr, char *str, struct pt_regs *regs,
132trap_signal: 132trap_signal:
133#endif 133#endif
134 /* 134 /*
135 * We want error_code and trap_no set for userspace faults and 135 * We want error_code and trap_nr set for userspace faults and
136 * kernelspace faults which result in die(), but not 136 * kernelspace faults which result in die(), but not
137 * kernelspace faults which are fixed up. die() gives the 137 * kernelspace faults which are fixed up. die() gives the
138 * process no chance to handle the signal and notice the 138 * process no chance to handle the signal and notice the
@@ -141,7 +141,7 @@ trap_signal:
141 * delivered, faults. See also do_general_protection below. 141 * delivered, faults. See also do_general_protection below.
142 */ 142 */
143 tsk->thread.error_code = error_code; 143 tsk->thread.error_code = error_code;
144 tsk->thread.trap_no = trapnr; 144 tsk->thread.trap_nr = trapnr;
145 145
146#ifdef CONFIG_X86_64 146#ifdef CONFIG_X86_64
147 if (show_unhandled_signals && unhandled_signal(tsk, signr) && 147 if (show_unhandled_signals && unhandled_signal(tsk, signr) &&
@@ -164,7 +164,7 @@ trap_signal:
164kernel_trap: 164kernel_trap:
165 if (!fixup_exception(regs)) { 165 if (!fixup_exception(regs)) {
166 tsk->thread.error_code = error_code; 166 tsk->thread.error_code = error_code;
167 tsk->thread.trap_no = trapnr; 167 tsk->thread.trap_nr = trapnr;
168 die(str, regs, error_code); 168 die(str, regs, error_code);
169 } 169 }
170 return; 170 return;
@@ -240,7 +240,7 @@ dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code)
240 notify_die(DIE_TRAP, str, regs, error_code, X86_TRAP_DF, SIGSEGV); 240 notify_die(DIE_TRAP, str, regs, error_code, X86_TRAP_DF, SIGSEGV);
241 241
242 tsk->thread.error_code = error_code; 242 tsk->thread.error_code = error_code;
243 tsk->thread.trap_no = X86_TRAP_DF; 243 tsk->thread.trap_nr = X86_TRAP_DF;
244 244
245 /* 245 /*
246 * This is always a kernel trap and never fixable (and thus must 246 * This is always a kernel trap and never fixable (and thus must
@@ -268,7 +268,7 @@ do_general_protection(struct pt_regs *regs, long error_code)
268 goto gp_in_kernel; 268 goto gp_in_kernel;
269 269
270 tsk->thread.error_code = error_code; 270 tsk->thread.error_code = error_code;
271 tsk->thread.trap_no = X86_TRAP_GP; 271 tsk->thread.trap_nr = X86_TRAP_GP;
272 272
273 if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) && 273 if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) &&
274 printk_ratelimit()) { 274 printk_ratelimit()) {
@@ -295,7 +295,7 @@ gp_in_kernel:
295 return; 295 return;
296 296
297 tsk->thread.error_code = error_code; 297 tsk->thread.error_code = error_code;
298 tsk->thread.trap_no = X86_TRAP_GP; 298 tsk->thread.trap_nr = X86_TRAP_GP;
299 if (notify_die(DIE_GPF, "general protection fault", regs, error_code, 299 if (notify_die(DIE_GPF, "general protection fault", regs, error_code,
300 X86_TRAP_GP, SIGSEGV) == NOTIFY_STOP) 300 X86_TRAP_GP, SIGSEGV) == NOTIFY_STOP)
301 return; 301 return;
@@ -475,7 +475,7 @@ void math_error(struct pt_regs *regs, int error_code, int trapnr)
475 { 475 {
476 if (!fixup_exception(regs)) { 476 if (!fixup_exception(regs)) {
477 task->thread.error_code = error_code; 477 task->thread.error_code = error_code;
478 task->thread.trap_no = trapnr; 478 task->thread.trap_nr = trapnr;
479 die(str, regs, error_code); 479 die(str, regs, error_code);
480 } 480 }
481 return; 481 return;
@@ -485,7 +485,7 @@ void math_error(struct pt_regs *regs, int error_code, int trapnr)
485 * Save the info for the exception handler and clear the error. 485 * Save the info for the exception handler and clear the error.
486 */ 486 */
487 save_init_fpu(task); 487 save_init_fpu(task);
488 task->thread.trap_no = trapnr; 488 task->thread.trap_nr = trapnr;
489 task->thread.error_code = error_code; 489 task->thread.error_code = error_code;
490 info.si_signo = SIGFPE; 490 info.si_signo = SIGFPE;
491 info.si_errno = 0; 491 info.si_errno = 0;
diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c
index b466cab5ba15..a1315ab2d6b9 100644
--- a/arch/x86/kernel/vm86_32.c
+++ b/arch/x86/kernel/vm86_32.c
@@ -567,7 +567,7 @@ int handle_vm86_trap(struct kernel_vm86_regs *regs, long error_code, int trapno)
567 } 567 }
568 if (trapno != 1) 568 if (trapno != 1)
569 return 1; /* we let this handle by the calling routine */ 569 return 1; /* we let this handle by the calling routine */
570 current->thread.trap_no = trapno; 570 current->thread.trap_nr = trapno;
571 current->thread.error_code = error_code; 571 current->thread.error_code = error_code;
572 force_sig(SIGTRAP, current); 572 force_sig(SIGTRAP, current);
573 return 0; 573 return 0;
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
index b07ba9393564..327509b95e0e 100644
--- a/arch/x86/kernel/vsyscall_64.c
+++ b/arch/x86/kernel/vsyscall_64.c
@@ -153,7 +153,7 @@ static bool write_ok_or_segv(unsigned long ptr, size_t size)
153 153
154 thread->error_code = 6; /* user fault, no page, write */ 154 thread->error_code = 6; /* user fault, no page, write */
155 thread->cr2 = ptr; 155 thread->cr2 = ptr;
156 thread->trap_no = 14; 156 thread->trap_nr = X86_TRAP_PF;
157 157
158 memset(&info, 0, sizeof(info)); 158 memset(&info, 0, sizeof(info));
159 info.si_signo = SIGSEGV; 159 info.si_signo = SIGSEGV;
diff --git a/arch/x86/math-emu/fpu_entry.c b/arch/x86/math-emu/fpu_entry.c
index 7718541541d4..9b868124128d 100644
--- a/arch/x86/math-emu/fpu_entry.c
+++ b/arch/x86/math-emu/fpu_entry.c
@@ -28,6 +28,7 @@
28#include <linux/regset.h> 28#include <linux/regset.h>
29 29
30#include <asm/uaccess.h> 30#include <asm/uaccess.h>
31#include <asm/traps.h>
31#include <asm/desc.h> 32#include <asm/desc.h>
32#include <asm/user.h> 33#include <asm/user.h>
33#include <asm/i387.h> 34#include <asm/i387.h>
@@ -269,7 +270,7 @@ void math_emulate(struct math_emu_info *info)
269 FPU_EIP = FPU_ORIG_EIP; /* Point to current FPU instruction. */ 270 FPU_EIP = FPU_ORIG_EIP; /* Point to current FPU instruction. */
270 271
271 RE_ENTRANT_CHECK_OFF; 272 RE_ENTRANT_CHECK_OFF;
272 current->thread.trap_no = 16; 273 current->thread.trap_nr = X86_TRAP_MF;
273 current->thread.error_code = 0; 274 current->thread.error_code = 0;
274 send_sig(SIGFPE, current, 1); 275 send_sig(SIGFPE, current, 1);
275 return; 276 return;
@@ -662,7 +663,7 @@ static int valid_prefix(u_char *Byte, u_char __user **fpu_eip,
662void math_abort(struct math_emu_info *info, unsigned int signal) 663void math_abort(struct math_emu_info *info, unsigned int signal)
663{ 664{
664 FPU_EIP = FPU_ORIG_EIP; 665 FPU_EIP = FPU_ORIG_EIP;
665 current->thread.trap_no = 16; 666 current->thread.trap_nr = X86_TRAP_MF;
666 current->thread.error_code = 0; 667 current->thread.error_code = 0;
667 send_sig(signal, current, 1); 668 send_sig(signal, current, 1);
668 RE_ENTRANT_CHECK_OFF; 669 RE_ENTRANT_CHECK_OFF;
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index f0b4caf85c1a..3ecfd1aaf214 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -615,7 +615,7 @@ pgtable_bad(struct pt_regs *regs, unsigned long error_code,
615 dump_pagetable(address); 615 dump_pagetable(address);
616 616
617 tsk->thread.cr2 = address; 617 tsk->thread.cr2 = address;
618 tsk->thread.trap_no = 14; 618 tsk->thread.trap_nr = X86_TRAP_PF;
619 tsk->thread.error_code = error_code; 619 tsk->thread.error_code = error_code;
620 620
621 if (__die("Bad pagetable", regs, error_code)) 621 if (__die("Bad pagetable", regs, error_code))
@@ -636,7 +636,7 @@ no_context(struct pt_regs *regs, unsigned long error_code,
636 /* Are we prepared to handle this kernel fault? */ 636 /* Are we prepared to handle this kernel fault? */
637 if (fixup_exception(regs)) { 637 if (fixup_exception(regs)) {
638 if (current_thread_info()->sig_on_uaccess_error && signal) { 638 if (current_thread_info()->sig_on_uaccess_error && signal) {
639 tsk->thread.trap_no = 14; 639 tsk->thread.trap_nr = X86_TRAP_PF;
640 tsk->thread.error_code = error_code | PF_USER; 640 tsk->thread.error_code = error_code | PF_USER;
641 tsk->thread.cr2 = address; 641 tsk->thread.cr2 = address;
642 642
@@ -676,7 +676,7 @@ no_context(struct pt_regs *regs, unsigned long error_code,
676 printk(KERN_EMERG "Thread overran stack, or stack corrupted\n"); 676 printk(KERN_EMERG "Thread overran stack, or stack corrupted\n");
677 677
678 tsk->thread.cr2 = address; 678 tsk->thread.cr2 = address;
679 tsk->thread.trap_no = 14; 679 tsk->thread.trap_nr = X86_TRAP_PF;
680 tsk->thread.error_code = error_code; 680 tsk->thread.error_code = error_code;
681 681
682 sig = SIGKILL; 682 sig = SIGKILL;
@@ -754,7 +754,7 @@ __bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code,
754 /* Kernel addresses are always protection faults: */ 754 /* Kernel addresses are always protection faults: */
755 tsk->thread.cr2 = address; 755 tsk->thread.cr2 = address;
756 tsk->thread.error_code = error_code | (address >= TASK_SIZE); 756 tsk->thread.error_code = error_code | (address >= TASK_SIZE);
757 tsk->thread.trap_no = 14; 757 tsk->thread.trap_nr = X86_TRAP_PF;
758 758
759 force_sig_info_fault(SIGSEGV, si_code, address, tsk, 0); 759 force_sig_info_fault(SIGSEGV, si_code, address, tsk, 0);
760 760
@@ -838,7 +838,7 @@ do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address,
838 838
839 tsk->thread.cr2 = address; 839 tsk->thread.cr2 = address;
840 tsk->thread.error_code = error_code; 840 tsk->thread.error_code = error_code;
841 tsk->thread.trap_no = 14; 841 tsk->thread.trap_nr = X86_TRAP_PF;
842 842
843#ifdef CONFIG_MEMORY_FAILURE 843#ifdef CONFIG_MEMORY_FAILURE
844 if (fault & (VM_FAULT_HWPOISON|VM_FAULT_HWPOISON_LARGE)) { 844 if (fault & (VM_FAULT_HWPOISON|VM_FAULT_HWPOISON_LARGE)) {