x86: x86 ptrace merge removals
[deliverable/linux.git] / arch / x86 / kernel / traps_32.c
CommitLineData
1da177e4 1/*
1da177e4
LT
2 * Copyright (C) 1991, 1992 Linus Torvalds
3 *
4 * Pentium III FXSR, SSE support
5 * Gareth Hughes <gareth@valinux.com>, May 2000
6 */
7
8/*
9 * 'Traps.c' handles hardware traps and faults after we have saved some
10 * state in 'asm.s'.
11 */
1da177e4
LT
12#include <linux/sched.h>
13#include <linux/kernel.h>
14#include <linux/string.h>
15#include <linux/errno.h>
16#include <linux/timer.h>
17#include <linux/mm.h>
18#include <linux/init.h>
19#include <linux/delay.h>
20#include <linux/spinlock.h>
21#include <linux/interrupt.h>
22#include <linux/highmem.h>
23#include <linux/kallsyms.h>
24#include <linux/ptrace.h>
25#include <linux/utsname.h>
26#include <linux/kprobes.h>
6e274d14 27#include <linux/kexec.h>
176a2718 28#include <linux/unwind.h>
1e2af92e 29#include <linux/uaccess.h>
a36df98a 30#include <linux/nmi.h>
91768d6c 31#include <linux/bug.h>
1da177e4
LT
32
33#ifdef CONFIG_EISA
34#include <linux/ioport.h>
35#include <linux/eisa.h>
36#endif
37
38#ifdef CONFIG_MCA
39#include <linux/mca.h>
40#endif
41
c0d12172
DJ
42#if defined(CONFIG_EDAC)
43#include <linux/edac.h>
44#endif
45
1da177e4
LT
46#include <asm/processor.h>
47#include <asm/system.h>
1da177e4
LT
48#include <asm/io.h>
49#include <asm/atomic.h>
50#include <asm/debugreg.h>
51#include <asm/desc.h>
52#include <asm/i387.h>
53#include <asm/nmi.h>
176a2718 54#include <asm/unwind.h>
1da177e4
LT
55#include <asm/smp.h>
56#include <asm/arch_hooks.h>
1eeb66a1 57#include <linux/kdebug.h>
2b14a78c 58#include <asm/stacktrace.h>
1da177e4 59
1da177e4
LT
60#include <linux/module.h>
61
62#include "mach_traps.h"
63
29cbc78b
AK
64int panic_on_unrecovered_nmi;
65
dbeb2be2
RR
66DECLARE_BITMAP(used_vectors, NR_VECTORS);
67EXPORT_SYMBOL_GPL(used_vectors);
68
1da177e4
LT
69asmlinkage int system_call(void);
70
1da177e4
LT
71/* Do we ignore FPU interrupts ? */
72char ignore_fpu_irq = 0;
73
74/*
75 * The IDT has to be page-aligned to simplify the Pentium
76 * F0 0F bug workaround.. We have a special link segment
77 * for this.
78 */
79struct desc_struct idt_table[256] __attribute__((__section__(".data.idt"))) = { {0, 0}, };
80
81asmlinkage void divide_error(void);
82asmlinkage void debug(void);
83asmlinkage void nmi(void);
84asmlinkage void int3(void);
85asmlinkage void overflow(void);
86asmlinkage void bounds(void);
87asmlinkage void invalid_op(void);
88asmlinkage void device_not_available(void);
89asmlinkage void coprocessor_segment_overrun(void);
90asmlinkage void invalid_TSS(void);
91asmlinkage void segment_not_present(void);
92asmlinkage void stack_segment(void);
93asmlinkage void general_protection(void);
94asmlinkage void page_fault(void);
95asmlinkage void coprocessor_error(void);
96asmlinkage void simd_coprocessor_error(void);
97asmlinkage void alignment_check(void);
98asmlinkage void spurious_interrupt_bug(void);
99asmlinkage void machine_check(void);
100
0741f4d2 101int kstack_depth_to_print = 24;
86c41837 102static unsigned int code_bytes = 64;
e041c683 103
36ad4885 104static inline int valid_stack_ptr(struct thread_info *tinfo, void *p, unsigned size)
1da177e4
LT
105{
106 return p > (void *)tinfo &&
36ad4885 107 p <= (void *)tinfo + THREAD_SIZE - size;
1da177e4
LT
108}
109
36ad4885
LT
110/* The form of the top of the frame on the stack */
111struct stack_frame {
112 struct stack_frame *next_frame;
113 unsigned long return_address;
114};
115
1da177e4 116static inline unsigned long print_context_stack(struct thread_info *tinfo,
65ea5b03 117 unsigned long *stack, unsigned long bp,
9689ba8a 118 const struct stacktrace_ops *ops, void *data)
1da177e4 119{
1da177e4 120#ifdef CONFIG_FRAME_POINTER
65ea5b03 121 struct stack_frame *frame = (struct stack_frame *)bp;
36ad4885
LT
122 while (valid_stack_ptr(tinfo, frame, sizeof(*frame))) {
123 struct stack_frame *next;
124 unsigned long addr;
125
126 addr = frame->return_address;
2b14a78c 127 ops->address(data, addr);
b88d4f1d
IM
128 /*
129 * break out of recursive entries (such as
808dbbb6
LT
130 * end_of_stack_stop_unwind_function). Also,
131 * we can never allow a frame pointer to
132 * move downwards!
36ad4885
LT
133 */
134 next = frame->next_frame;
135 if (next <= frame)
b88d4f1d 136 break;
36ad4885 137 frame = next;
1da177e4
LT
138 }
139#else
36ad4885
LT
140 while (valid_stack_ptr(tinfo, stack, sizeof(*stack))) {
141 unsigned long addr;
142
1da177e4 143 addr = *stack++;
7aa89746 144 if (__kernel_text_address(addr))
2b14a78c 145 ops->address(data, addr);
1da177e4
LT
146 }
147#endif
65ea5b03 148 return bp;
1da177e4
LT
149}
150
b615ebda
AK
151#define MSG(msg) ops->warning(data, msg)
152
2b14a78c
AK
153void dump_trace(struct task_struct *task, struct pt_regs *regs,
154 unsigned long *stack,
9689ba8a 155 const struct stacktrace_ops *ops, void *data)
1da177e4 156{
65ea5b03 157 unsigned long bp = 0;
1da177e4
LT
158
159 if (!task)
160 task = current;
161
a32cf397 162 if (!stack) {
2b14a78c
AK
163 unsigned long dummy;
164 stack = &dummy;
028a690a 165 if (task != current)
2b14a78c 166 stack = (unsigned long *)task->thread.esp;
176a2718
JB
167 }
168
a32cf397 169#ifdef CONFIG_FRAME_POINTER
65ea5b03 170 if (!bp) {
a32cf397 171 if (task == current) {
65ea5b03
PA
172 /* Grab bp right from our regs */
173 asm ("movl %%ebp, %0" : "=r" (bp) : );
a32cf397 174 } else {
65ea5b03
PA
175 /* bp is the last reg pushed by switch_to */
176 bp = *(unsigned long *) task->thread.esp;
a32cf397 177 }
1da177e4 178 }
a32cf397 179#endif
1da177e4
LT
180
181 while (1) {
182 struct thread_info *context;
183 context = (struct thread_info *)
184 ((unsigned long)stack & (~(THREAD_SIZE - 1)));
65ea5b03 185 bp = print_context_stack(context, stack, bp, ops, data);
2b14a78c
AK
186 /* Should be after the line below, but somewhere
187 in early boot context comes out corrupted and we
188 can't reference it -AK */
189 if (ops->stack(data, "IRQ") < 0)
190 break;
1da177e4
LT
191 stack = (unsigned long*)context->previous_esp;
192 if (!stack)
193 break;
a36df98a 194 touch_nmi_watchdog();
1da177e4
LT
195 }
196}
2b14a78c
AK
197EXPORT_SYMBOL(dump_trace);
198
199static void
200print_trace_warning_symbol(void *data, char *msg, unsigned long symbol)
201{
202 printk(data);
203 print_symbol(msg, symbol);
204 printk("\n");
205}
206
207static void print_trace_warning(void *data, char *msg)
208{
209 printk("%s%s\n", (char *)data, msg);
210}
211
212static int print_trace_stack(void *data, char *name)
213{
214 return 0;
215}
216
217/*
218 * Print one address/symbol entries per line.
219 */
220static void print_trace_address(void *data, unsigned long addr)
221{
222 printk("%s [<%08lx>] ", (char *)data, addr);
223 print_symbol("%s\n", addr);
601e6255 224 touch_nmi_watchdog();
2b14a78c
AK
225}
226
9689ba8a 227static const struct stacktrace_ops print_trace_ops = {
2b14a78c
AK
228 .warning = print_trace_warning,
229 .warning_symbol = print_trace_warning_symbol,
230 .stack = print_trace_stack,
231 .address = print_trace_address,
232};
233
234static void
235show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
236 unsigned long * stack, char *log_lvl)
237{
238 dump_trace(task, regs, stack, &print_trace_ops, log_lvl);
239 printk("%s =======================\n", log_lvl);
240}
1da177e4 241
2b14a78c
AK
242void show_trace(struct task_struct *task, struct pt_regs *regs,
243 unsigned long * stack)
7aa89746 244{
176a2718 245 show_trace_log_lvl(task, regs, stack, "");
7aa89746
CE
246}
247
176a2718 248static void show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
65ea5b03 249 unsigned long *sp, char *log_lvl)
1da177e4
LT
250{
251 unsigned long *stack;
252 int i;
253
65ea5b03 254 if (sp == NULL) {
1da177e4 255 if (task)
65ea5b03 256 sp = (unsigned long*)task->thread.esp;
1da177e4 257 else
65ea5b03 258 sp = (unsigned long *)&sp;
1da177e4
LT
259 }
260
65ea5b03 261 stack = sp;
1da177e4
LT
262 for(i = 0; i < kstack_depth_to_print; i++) {
263 if (kstack_end(stack))
264 break;
75874d5c
CE
265 if (i && ((i % 8) == 0))
266 printk("\n%s ", log_lvl);
1da177e4
LT
267 printk("%08lx ", *stack++);
268 }
75874d5c 269 printk("\n%sCall Trace:\n", log_lvl);
65ea5b03 270 show_trace_log_lvl(task, regs, sp, log_lvl);
7aa89746
CE
271}
272
65ea5b03 273void show_stack(struct task_struct *task, unsigned long *sp)
7aa89746 274{
75874d5c 275 printk(" ");
65ea5b03 276 show_stack_log_lvl(task, NULL, sp, "");
1da177e4
LT
277}
278
279/*
280 * The architecture-independent dump_stack generator
281 */
282void dump_stack(void)
283{
284 unsigned long stack;
285
57c351de
AV
286 printk("Pid: %d, comm: %.20s %s %s %.*s\n",
287 current->pid, current->comm, print_tainted(),
288 init_utsname()->release,
289 (int)strcspn(init_utsname()->version, " "),
290 init_utsname()->version);
176a2718 291 show_trace(current, NULL, &stack);
1da177e4
LT
292}
293
294EXPORT_SYMBOL(dump_stack);
295
296void show_registers(struct pt_regs *regs)
297{
298 int i;
9d975ebd 299
1da177e4 300 print_modules();
9d975ebd 301 __show_registers(regs, 0);
7e04a118 302 printk(KERN_EMERG "Process %.*s (pid: %d, ti=%p task=%p task.ti=%p)",
19c5870c 303 TASK_COMM_LEN, current->comm, task_pid_nr(current),
c9f4f06d 304 current_thread_info(), current, task_thread_info(current));
1da177e4
LT
305 /*
306 * When in-kernel, we also print out the stack and code at the
307 * time of the fault..
308 */
9d975ebd 309 if (!user_mode_vm(regs)) {
65ea5b03 310 u8 *ip;
86c41837
CE
311 unsigned int code_prologue = code_bytes * 43 / 64;
312 unsigned int code_len = code_bytes;
99325326 313 unsigned char c;
1da177e4 314
9c107805 315 printk("\n" KERN_EMERG "Stack: ");
65ea5b03 316 show_stack_log_lvl(NULL, regs, &regs->sp, KERN_EMERG);
1da177e4 317
9c107805 318 printk(KERN_EMERG "Code: ");
1da177e4 319
65ea5b03
PA
320 ip = (u8 *)regs->ip - code_prologue;
321 if (ip < (u8 *)PAGE_OFFSET ||
322 probe_kernel_address(ip, c)) {
99325326 323 /* try starting at EIP */
65ea5b03 324 ip = (u8 *)regs->ip;
86c41837 325 code_len = code_len - code_prologue + 1;
99325326 326 }
65ea5b03
PA
327 for (i = 0; i < code_len; i++, ip++) {
328 if (ip < (u8 *)PAGE_OFFSET ||
329 probe_kernel_address(ip, c)) {
1da177e4
LT
330 printk(" Bad EIP value.");
331 break;
332 }
65ea5b03 333 if (ip == (u8 *)regs->ip)
1da177e4
LT
334 printk("<%02x> ", c);
335 else
336 printk("%02x ", c);
337 }
338 }
339 printk("\n");
340}
341
65ea5b03 342int is_valid_bugaddr(unsigned long ip)
1da177e4
LT
343{
344 unsigned short ud2;
1da177e4 345
65ea5b03 346 if (ip < PAGE_OFFSET)
91768d6c 347 return 0;
65ea5b03 348 if (probe_kernel_address((unsigned short *)ip, ud2))
91768d6c 349 return 0;
1da177e4 350
91768d6c 351 return ud2 == 0x0b0f;
1da177e4
LT
352}
353
91768d6c
JF
354/*
355 * This is gone through when something in the kernel has done something bad and
356 * is about to be terminated.
357 */
1da177e4
LT
358void die(const char * str, struct pt_regs * regs, long err)
359{
360 static struct {
39743c9e 361 raw_spinlock_t lock;
1da177e4
LT
362 u32 lock_owner;
363 int lock_owner_depth;
364 } die = {
39743c9e 365 .lock = __RAW_SPIN_LOCK_UNLOCKED,
1da177e4
LT
366 .lock_owner = -1,
367 .lock_owner_depth = 0
368 };
369 static int die_counter;
e43d674f 370 unsigned long flags;
1da177e4 371
dd287796
AM
372 oops_enter();
373
39c715b7 374 if (die.lock_owner != raw_smp_processor_id()) {
1da177e4 375 console_verbose();
c0a698b7 376 raw_local_irq_save(flags);
39743c9e 377 __raw_spin_lock(&die.lock);
1da177e4
LT
378 die.lock_owner = smp_processor_id();
379 die.lock_owner_depth = 0;
380 bust_spinlocks(1);
c0a698b7
IM
381 } else
382 raw_local_irq_save(flags);
1da177e4
LT
383
384 if (++die.lock_owner_depth < 3) {
65ea5b03 385 unsigned long sp;
7bee5c0f
RD
386 unsigned short ss;
387
65ea5b03 388 report_bug(regs->ip, regs);
91768d6c 389
9aa8d719
PE
390 printk(KERN_EMERG "%s: %04lx [#%d] ", str, err & 0xffff,
391 ++die_counter);
1da177e4 392#ifdef CONFIG_PREEMPT
9aa8d719 393 printk("PREEMPT ");
1da177e4
LT
394#endif
395#ifdef CONFIG_SMP
396 printk("SMP ");
1da177e4
LT
397#endif
398#ifdef CONFIG_DEBUG_PAGEALLOC
399 printk("DEBUG_PAGEALLOC");
1da177e4 400#endif
9aa8d719
PE
401 printk("\n");
402
20c0d2d4
JB
403 if (notify_die(DIE_OOPS, str, regs, err,
404 current->thread.trap_no, SIGSEGV) !=
7bee5c0f 405 NOTIFY_STOP) {
20c0d2d4 406 show_registers(regs);
7bee5c0f 407 /* Executive summary in case the oops scrolled away */
65ea5b03 408 sp = (unsigned long) (&regs->sp);
7bee5c0f
RD
409 savesegment(ss, ss);
410 if (user_mode(regs)) {
65ea5b03
PA
411 sp = regs->sp;
412 ss = regs->ss & 0xffff;
7bee5c0f 413 }
65ea5b03
PA
414 printk(KERN_EMERG "EIP: [<%08lx>] ", regs->ip);
415 print_symbol("%s", regs->ip);
416 printk(" SS:ESP %04x:%08lx\n", ss, sp);
7bee5c0f 417 }
20c0d2d4
JB
418 else
419 regs = NULL;
1da177e4 420 } else
9c107805 421 printk(KERN_EMERG "Recursive die() failure, output suppressed\n");
1da177e4
LT
422
423 bust_spinlocks(0);
424 die.lock_owner = -1;
bcdcd8e7 425 add_taint(TAINT_DIE);
39743c9e
AK
426 __raw_spin_unlock(&die.lock);
427 raw_local_irq_restore(flags);
6e274d14 428
20c0d2d4
JB
429 if (!regs)
430 return;
431
6e274d14
AN
432 if (kexec_should_crash(current))
433 crash_kexec(regs);
434
1da177e4
LT
435 if (in_interrupt())
436 panic("Fatal exception in interrupt");
437
cea6a4ba 438 if (panic_on_oops)
012c437d 439 panic("Fatal exception");
cea6a4ba 440
dd287796 441 oops_exit();
1da177e4
LT
442 do_exit(SIGSEGV);
443}
444
445static inline void die_if_kernel(const char * str, struct pt_regs * regs, long err)
446{
717b594a 447 if (!user_mode_vm(regs))
1da177e4
LT
448 die(str, regs, err);
449}
450
3d97ae5b
PP
451static void __kprobes do_trap(int trapnr, int signr, char *str, int vm86,
452 struct pt_regs * regs, long error_code,
453 siginfo_t *info)
1da177e4 454{
4f339ecb 455 struct task_struct *tsk = current;
4f339ecb 456
65ea5b03 457 if (regs->flags & VM_MASK) {
1da177e4
LT
458 if (vm86)
459 goto vm86_trap;
460 goto trap_signal;
461 }
462
717b594a 463 if (!user_mode(regs))
1da177e4
LT
464 goto kernel_trap;
465
466 trap_signal: {
d1895183
AK
467 /*
468 * We want error_code and trap_no set for userspace faults and
469 * kernelspace faults which result in die(), but not
470 * kernelspace faults which are fixed up. die() gives the
471 * process no chance to handle the signal and notice the
472 * kernel fault information, so that won't result in polluting
473 * the information about previously queued, but not yet
474 * delivered, faults. See also do_general_protection below.
475 */
476 tsk->thread.error_code = error_code;
477 tsk->thread.trap_no = trapnr;
478
1da177e4
LT
479 if (info)
480 force_sig_info(signr, info, tsk);
481 else
482 force_sig(signr, tsk);
483 return;
484 }
485
486 kernel_trap: {
d1895183
AK
487 if (!fixup_exception(regs)) {
488 tsk->thread.error_code = error_code;
489 tsk->thread.trap_no = trapnr;
1da177e4 490 die(str, regs, error_code);
d1895183 491 }
1da177e4
LT
492 return;
493 }
494
495 vm86_trap: {
496 int ret = handle_vm86_trap((struct kernel_vm86_regs *) regs, error_code, trapnr);
497 if (ret) goto trap_signal;
498 return;
499 }
500}
501
502#define DO_ERROR(trapnr, signr, str, name) \
503fastcall void do_##name(struct pt_regs * regs, long error_code) \
504{ \
505 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
506 == NOTIFY_STOP) \
507 return; \
508 do_trap(trapnr, signr, str, 0, regs, error_code, NULL); \
509}
510
a10d9a71 511#define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr, irq) \
1da177e4
LT
512fastcall void do_##name(struct pt_regs * regs, long error_code) \
513{ \
514 siginfo_t info; \
a10d9a71
PZ
515 if (irq) \
516 local_irq_enable(); \
1da177e4
LT
517 info.si_signo = signr; \
518 info.si_errno = 0; \
519 info.si_code = sicode; \
520 info.si_addr = (void __user *)siaddr; \
521 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
522 == NOTIFY_STOP) \
523 return; \
524 do_trap(trapnr, signr, str, 0, regs, error_code, &info); \
525}
526
527#define DO_VM86_ERROR(trapnr, signr, str, name) \
528fastcall void do_##name(struct pt_regs * regs, long error_code) \
529{ \
530 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
531 == NOTIFY_STOP) \
532 return; \
533 do_trap(trapnr, signr, str, 1, regs, error_code, NULL); \
534}
535
536#define DO_VM86_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \
537fastcall void do_##name(struct pt_regs * regs, long error_code) \
538{ \
539 siginfo_t info; \
540 info.si_signo = signr; \
541 info.si_errno = 0; \
542 info.si_code = sicode; \
543 info.si_addr = (void __user *)siaddr; \
fb1dac90 544 trace_hardirqs_fixup(); \
1da177e4
LT
545 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
546 == NOTIFY_STOP) \
547 return; \
548 do_trap(trapnr, signr, str, 1, regs, error_code, &info); \
549}
550
65ea5b03 551DO_VM86_ERROR_INFO( 0, SIGFPE, "divide error", divide_error, FPE_INTDIV, regs->ip)
1da177e4
LT
552#ifndef CONFIG_KPROBES
553DO_VM86_ERROR( 3, SIGTRAP, "int3", int3)
554#endif
555DO_VM86_ERROR( 4, SIGSEGV, "overflow", overflow)
556DO_VM86_ERROR( 5, SIGSEGV, "bounds", bounds)
65ea5b03 557DO_ERROR_INFO( 6, SIGILL, "invalid opcode", invalid_op, ILL_ILLOPN, regs->ip, 0)
1da177e4
LT
558DO_ERROR( 9, SIGFPE, "coprocessor segment overrun", coprocessor_segment_overrun)
559DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS)
560DO_ERROR(11, SIGBUS, "segment not present", segment_not_present)
561DO_ERROR(12, SIGBUS, "stack segment", stack_segment)
a10d9a71
PZ
562DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0, 0)
563DO_ERROR_INFO(32, SIGSEGV, "iret exception", iret_error, ILL_BADSTK, 0, 1)
1da177e4 564
3d97ae5b
PP
565fastcall void __kprobes do_general_protection(struct pt_regs * regs,
566 long error_code)
1da177e4
LT
567{
568 int cpu = get_cpu();
569 struct tss_struct *tss = &per_cpu(init_tss, cpu);
570 struct thread_struct *thread = &current->thread;
571
572 /*
573 * Perform the lazy TSS's I/O bitmap copy. If the TSS has an
574 * invalid offset set (the LAZY one) and the faulting thread has
575 * a valid I/O bitmap pointer, we copy the I/O bitmap in the TSS
576 * and we set the offset field correctly. Then we let the CPU to
577 * restart the faulting instruction.
578 */
a75c54f9 579 if (tss->x86_tss.io_bitmap_base == INVALID_IO_BITMAP_OFFSET_LAZY &&
1da177e4
LT
580 thread->io_bitmap_ptr) {
581 memcpy(tss->io_bitmap, thread->io_bitmap_ptr,
582 thread->io_bitmap_max);
583 /*
584 * If the previously set map was extending to higher ports
585 * than the current one, pad extra space with 0xff (no access).
586 */
587 if (thread->io_bitmap_max < tss->io_bitmap_max)
588 memset((char *) tss->io_bitmap +
589 thread->io_bitmap_max, 0xff,
590 tss->io_bitmap_max - thread->io_bitmap_max);
591 tss->io_bitmap_max = thread->io_bitmap_max;
a75c54f9 592 tss->x86_tss.io_bitmap_base = IO_BITMAP_OFFSET;
d5cd4aad 593 tss->io_bitmap_owner = thread;
1da177e4
LT
594 put_cpu();
595 return;
596 }
597 put_cpu();
598
65ea5b03 599 if (regs->flags & VM_MASK)
1da177e4
LT
600 goto gp_in_vm86;
601
717b594a 602 if (!user_mode(regs))
1da177e4
LT
603 goto gp_in_kernel;
604
605 current->thread.error_code = error_code;
606 current->thread.trap_no = 13;
abd4f750
MAS
607 if (show_unhandled_signals && unhandled_signal(current, SIGSEGV) &&
608 printk_ratelimit())
609 printk(KERN_INFO
65ea5b03 610 "%s[%d] general protection ip:%lx sp:%lx error:%lx\n",
19c5870c 611 current->comm, task_pid_nr(current),
65ea5b03 612 regs->ip, regs->sp, error_code);
abd4f750 613
1da177e4
LT
614 force_sig(SIGSEGV, current);
615 return;
616
617gp_in_vm86:
618 local_irq_enable();
619 handle_vm86_fault((struct kernel_vm86_regs *) regs, error_code);
620 return;
621
622gp_in_kernel:
623 if (!fixup_exception(regs)) {
d1895183
AK
624 current->thread.error_code = error_code;
625 current->thread.trap_no = 13;
1da177e4
LT
626 if (notify_die(DIE_GPF, "general protection fault", regs,
627 error_code, 13, SIGSEGV) == NOTIFY_STOP)
628 return;
629 die("general protection fault", regs, error_code);
630 }
631}
632