2 * Copyright (C) 2001 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
6 #include "linux/sched.h"
7 #include "linux/kernel.h"
8 #include "linux/module.h"
10 #include "asm/processor.h"
12 #include "user_util.h"
15 * If the address is either in the .text section of the
16 * kernel, or in the vmalloc'ed module regions, it *may*
17 * be the address of a calling routine
22 extern struct module
*module_list
;
23 extern struct module kernel_module
;
25 static inline int kernel_text_address(unsigned long addr
)
30 if (addr
>= (unsigned long) &_stext
&&
31 addr
<= (unsigned long) &_etext
)
34 for (mod
= module_list
; mod
!= &kernel_module
; mod
= mod
->next
) {
35 /* mod_bound tests for addr being inside the vmalloc'ed
36 * module area. Of course it'd be better to test only
37 * for the .text subset... */
38 if (mod_bound(addr
, 0, mod
)) {
49 static inline int kernel_text_address(unsigned long addr
)
51 return (addr
>= (unsigned long) &_stext
&&
52 addr
<= (unsigned long) &_etext
);
57 void show_trace(unsigned long * stack
)
63 stack
= (unsigned long*) &stack
;
65 printk("Call Trace: ");
67 while (((long) stack
& (THREAD_SIZE
-1)) != 0) {
69 if (kernel_text_address(addr
)) {
70 if (i
&& ((i
% 6) == 0))
72 printk("[<%08lx>] ", addr
);
80 * The architecture-independent dump_stack generator
89 void show_trace_task(struct task_struct
*tsk
)
91 unsigned long esp
= PT_REGS_SP(&tsk
->thread
.regs
);
93 /* User space on another CPU? */
94 if ((esp
^ (unsigned long)tsk
) & (PAGE_MASK
<<1))
96 show_trace((unsigned long *)esp
);
100 * Overrides for Emacs so that we follow Linus's tabbing style.
101 * Emacs will notice this stuff at the end of the file and automatically
102 * adjust the settings for this buffer only. This must remain at the end
104 * ---------------------------------------------------------------------------
106 * c-file-style: "linux"