diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2007-10-11 05:17:24 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2007-10-11 05:17:24 -0400 |
commit | 250c22777fe1ccd7ac588579a6c16db4c0161cc5 (patch) | |
tree | 55c317efb7d792ec6fdae1d1937c67a502c48dec /arch/x86/kernel/stacktrace.c | |
parent | 2db55d344e529492545cb3b755c7e9ba8e4fa94e (diff) |
x86_64: move kernel
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/stacktrace.c')
-rw-r--r-- | arch/x86/kernel/stacktrace.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/arch/x86/kernel/stacktrace.c b/arch/x86/kernel/stacktrace.c new file mode 100644 index 000000000000..cb9109113584 --- /dev/null +++ b/arch/x86/kernel/stacktrace.c | |||
@@ -0,0 +1,54 @@ | |||
1 | /* | ||
2 | * arch/x86_64/kernel/stacktrace.c | ||
3 | * | ||
4 | * Stack trace management functions | ||
5 | * | ||
6 | * Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> | ||
7 | */ | ||
8 | #include <linux/sched.h> | ||
9 | #include <linux/stacktrace.h> | ||
10 | #include <linux/module.h> | ||
11 | #include <asm/stacktrace.h> | ||
12 | |||
13 | static void save_stack_warning(void *data, char *msg) | ||
14 | { | ||
15 | } | ||
16 | |||
17 | static void | ||
18 | save_stack_warning_symbol(void *data, char *msg, unsigned long symbol) | ||
19 | { | ||
20 | } | ||
21 | |||
22 | static int save_stack_stack(void *data, char *name) | ||
23 | { | ||
24 | return -1; | ||
25 | } | ||
26 | |||
27 | static void save_stack_address(void *data, unsigned long addr) | ||
28 | { | ||
29 | struct stack_trace *trace = (struct stack_trace *)data; | ||
30 | if (trace->skip > 0) { | ||
31 | trace->skip--; | ||
32 | return; | ||
33 | } | ||
34 | if (trace->nr_entries < trace->max_entries) | ||
35 | trace->entries[trace->nr_entries++] = addr; | ||
36 | } | ||
37 | |||
38 | static struct stacktrace_ops save_stack_ops = { | ||
39 | .warning = save_stack_warning, | ||
40 | .warning_symbol = save_stack_warning_symbol, | ||
41 | .stack = save_stack_stack, | ||
42 | .address = save_stack_address, | ||
43 | }; | ||
44 | |||
45 | /* | ||
46 | * Save stack-backtrace addresses into a stack_trace buffer. | ||
47 | */ | ||
48 | void save_stack_trace(struct stack_trace *trace) | ||
49 | { | ||
50 | dump_trace(current, NULL, NULL, &save_stack_ops, trace); | ||
51 | if (trace->nr_entries < trace->max_entries) | ||
52 | trace->entries[trace->nr_entries++] = ULONG_MAX; | ||
53 | } | ||
54 | EXPORT_SYMBOL(save_stack_trace); | ||