in kernel/traps.c [60:106]
void show_stack(struct task_struct *task, unsigned long *stack,
const char *loglvl)
{
unsigned long *endstack, addr;
int i;
if (!stack) {
if (task)
stack = (unsigned long *)task->thread.ksp;
else
stack = (unsigned long *)&stack;
}
addr = (unsigned long) stack;
endstack = (unsigned long *) PAGE_ALIGN(addr);
printk("%sStack from %08lx:", loglvl, (unsigned long)stack);
for (i = 0; i < kstack_depth_to_print; i++) {
if (stack + 1 > endstack)
break;
if (i % 8 == 0)
printk("%s\n ", loglvl);
printk("%s %08lx", loglvl, *stack++);
}
printk("%s\nCall Trace:", loglvl);
i = 0;
while (stack + 1 <= endstack) {
addr = *stack++;
/*
* If the address is either in the text segment of the
* kernel, or in the region which contains vmalloc'ed
* memory, it *may* be the address of a calling
* routine; if so, print it so that someone tracing
* down the cause of the crash will be able to figure
* out the call path that was taken.
*/
if (((addr >= (unsigned long) _stext) &&
(addr <= (unsigned long) _etext))) {
if (i % 4 == 0)
pr_emerg("\n ");
printk("%s [<%08lx>]", loglvl, addr);
i++;
}
}
printk("%s\n", loglvl);
}