-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaml --- r: 143027 b: refs/heads/master c: 65bc609 h: refs/heads/master i: 143025: 754e21e 143023: 1640b9e v: v3
- Loading branch information
Michal Simek
committed
Mar 27, 2009
1 parent
ab4481a
commit d352611
Showing
2 changed files
with
108 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: 7dcbbb2b17d4ef0d0541708eddfb720e2e422c3b | ||
refs/heads/master: 65bc60930c32b4831800056c8e0a0571c9b6a0bf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
/* | ||
* Copyright (C) 2007-2009 Michal Simek <monstr@monstr.eu> | ||
* Copyright (C) 2007-2009 PetaLogix | ||
* Copyright (C) 2006 Atmark Techno, Inc. | ||
* | ||
* This file is subject to the terms and conditions of the GNU General Public | ||
* License. See the file "COPYING" in the main directory of this archive | ||
* for more details. | ||
*/ | ||
|
||
#include <linux/kernel.h> | ||
#include <linux/kallsyms.h> | ||
#include <linux/module.h> | ||
#include <linux/sched.h> | ||
#include <linux/debug_locks.h> | ||
|
||
#include <asm/exceptions.h> | ||
#include <asm/system.h> | ||
|
||
void trap_init(void) | ||
{ | ||
__enable_hw_exceptions(); | ||
} | ||
|
||
void __bad_xchg(volatile void *ptr, int size) | ||
{ | ||
printk(KERN_INFO "xchg: bad data size: pc 0x%p, ptr 0x%p, size %d\n", | ||
__builtin_return_address(0), ptr, size); | ||
BUG(); | ||
} | ||
EXPORT_SYMBOL(__bad_xchg); | ||
|
||
static int kstack_depth_to_print = 24; | ||
|
||
static int __init kstack_setup(char *s) | ||
{ | ||
kstack_depth_to_print = strict_strtoul(s, 0, 0); | ||
|
||
return 1; | ||
} | ||
__setup("kstack=", kstack_setup); | ||
|
||
void show_trace(struct task_struct *task, unsigned long *stack) | ||
{ | ||
unsigned long addr; | ||
|
||
if (!stack) | ||
stack = (unsigned long *)&stack; | ||
|
||
printk(KERN_NOTICE "Call Trace: "); | ||
#ifdef CONFIG_KALLSYMS | ||
printk(KERN_NOTICE "\n"); | ||
#endif | ||
while (!kstack_end(stack)) { | ||
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 (kernel_text_address(addr)) | ||
print_ip_sym(addr); | ||
} | ||
printk(KERN_NOTICE "\n"); | ||
|
||
if (!task) | ||
task = current; | ||
|
||
debug_show_held_locks(task); | ||
} | ||
|
||
void show_stack(struct task_struct *task, unsigned long *sp) | ||
{ | ||
unsigned long *stack; | ||
int i; | ||
|
||
if (sp == NULL) { | ||
if (task) | ||
sp = (unsigned long *) ((struct thread_info *) | ||
(task->stack))->cpu_context.r1; | ||
else | ||
sp = (unsigned long *)&sp; | ||
} | ||
|
||
stack = sp; | ||
|
||
printk(KERN_INFO "\nStack:\n "); | ||
|
||
for (i = 0; i < kstack_depth_to_print; i++) { | ||
if (kstack_end(sp)) | ||
break; | ||
if (i && ((i % 8) == 0)) | ||
printk("\n "); | ||
printk("%08lx ", *sp++); | ||
} | ||
printk("\n"); | ||
show_trace(task, stack); | ||
} | ||
|
||
void dump_stack(void) | ||
{ | ||
show_stack(NULL, NULL); | ||
} | ||
EXPORT_SYMBOL(dump_stack); |