9aad728e7ea736d66862555df680c5c4c0137f09
[linux-2.6.git] / arch / i386 / kernel / dstackdump.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/sched.h>
13 #include <linux/kernel.h>
14 #include <linux/thread_info.h>
15 #include <asm/processor.h>
16
17 void dstackdump(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
27         show_trace(current,(void*)esp);
28
29         if (panicing)
30           panic("stack overflow\n");
31
32         oops_in_progress = 0;
33
34         /* Just let it happen once per task, as otherwise it goes nuts
35          * in printing stack traces.  This means that I need to dump
36          * the stack_overflowed boolean into the task or thread_info
37          * structure.  For now just turn it off all together.
38          */
39
40         /* stack_overflowed = 0; */
41 }