Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6
[linux-2.6/openmoko-kernel/knife-kernel.git] / include / linux / unwind.h
blob73e1751d03dd18e2806d4a018c05f9cf05eaf942
1 #ifndef _LINUX_UNWIND_H
2 #define _LINUX_UNWIND_H
4 /*
5 * Copyright (C) 2002-2006 Novell, Inc.
6 * Jan Beulich <jbeulich@novell.com>
7 * This code is released under version 2 of the GNU GPL.
9 * A simple API for unwinding kernel stacks. This is used for
10 * debugging and error reporting purposes. The kernel doesn't need
11 * full-blown stack unwinding with all the bells and whistles, so there
12 * is not much point in implementing the full Dwarf2 unwind API.
15 struct module;
17 #ifdef CONFIG_STACK_UNWIND
19 #include <asm/unwind.h>
21 #ifndef ARCH_UNWIND_SECTION_NAME
22 #define ARCH_UNWIND_SECTION_NAME ".eh_frame"
23 #endif
26 * Initialize unwind support.
28 extern void unwind_init(void);
30 #ifdef CONFIG_MODULES
32 extern void *unwind_add_table(struct module *,
33 const void *table_start,
34 unsigned long table_size);
36 extern void unwind_remove_table(void *handle, int init_only);
38 #endif
40 extern int unwind_init_frame_info(struct unwind_frame_info *,
41 struct task_struct *,
42 /*const*/ struct pt_regs *);
45 * Prepare to unwind a blocked task.
47 extern int unwind_init_blocked(struct unwind_frame_info *,
48 struct task_struct *);
51 * Prepare to unwind the currently running thread.
53 extern int unwind_init_running(struct unwind_frame_info *,
54 asmlinkage int (*callback)(struct unwind_frame_info *,
55 void *arg),
56 void *arg);
59 * Unwind to previous to frame. Returns 0 if successful, negative
60 * number in case of an error.
62 extern int unwind(struct unwind_frame_info *);
65 * Unwind until the return pointer is in user-land (or until an error
66 * occurs). Returns 0 if successful, negative number in case of
67 * error.
69 extern int unwind_to_user(struct unwind_frame_info *);
71 #else
73 struct unwind_frame_info {};
75 static inline void unwind_init(void) {}
77 #ifdef CONFIG_MODULES
79 static inline void *unwind_add_table(struct module *mod,
80 const void *table_start,
81 unsigned long table_size)
83 return NULL;
86 #endif
88 static inline void unwind_remove_table(void *handle, int init_only)
92 static inline int unwind_init_frame_info(struct unwind_frame_info *info,
93 struct task_struct *tsk,
94 const struct pt_regs *regs)
96 return -ENOSYS;
99 static inline int unwind_init_blocked(struct unwind_frame_info *info,
100 struct task_struct *tsk)
102 return -ENOSYS;
105 static inline int unwind_init_running(struct unwind_frame_info *info,
106 asmlinkage int (*cb)(struct unwind_frame_info *,
107 void *arg),
108 void *arg)
110 return -ENOSYS;
113 static inline int unwind(struct unwind_frame_info *info)
115 return -ENOSYS;
118 static inline int unwind_to_user(struct unwind_frame_info *info)
120 return -ENOSYS;
123 #endif
125 #endif /* _LINUX_UNWIND_H */