f9b9f6f90eb1895f3324d256b0bd7f06406d48b5
[linux-2.6.git] / arch / i386 / kernel / stackoverflow.c
1 /*
2  *  linux/arch/i386/kernel/stackoverflow.c
3  *
4  *  Copyright (C) 2005  Marc E. Fiuczynski
5  *
6  */
7
8 /*
9  * This file handles the architecture-dependent parts of stack overflow handling...
10  */
11
12 #include <linux/kernel.h>
13 #include <linux/thread_info.h>
14 #include <linux/sched.h>
15 #include <asm/processor.h>
16
17 void stack_overflow(void)
18 {
19         unsigned long esp = current_stack_pointer();
20         int panicing = ((esp&(THREAD_SIZE-1)) <= STACK_PANIC);
21
22         oops_in_progress = 1;
23         printk( "esp: 0x%lx masked: 0x%lx STACK_PANIC:0x%lx %d %d\n",
24                 esp, (esp&(THREAD_SIZE-1)), STACK_PANIC, 
25                 (((esp&(THREAD_SIZE-1)) <= STACK_PANIC)), panicing);
26         show_trace(current,(void*)esp);
27
28         if (panicing)
29           panic("stack overflow\n");
30
31         oops_in_progress = 0;
32
33         /* Just let it happen once per task, as otherwise it goes nuts
34          * in printing stack traces.  This means that I need to dump
35          * the stack_overflowed boolean into the task or thread_info
36          * structure.  For now just turn it off all together.
37          */
38
39         /* stack_overflowed = 0; */
40 }