[PATCH] Fix swsusp with PNP BIOS
[linux-2.6/linux-mips.git] / include / linux / unwind.h
blobce48e2cd37a28d52c1e15e8497e4b3c74da769ab
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 #include <linux/config.h>
17 struct module;
19 #ifdef CONFIG_STACK_UNWIND
21 #include <asm/unwind.h>
23 #ifndef ARCH_UNWIND_SECTION_NAME
24 #define ARCH_UNWIND_SECTION_NAME ".eh_frame"
25 #endif
28 * Initialize unwind support.
30 extern void unwind_init(void);
32 #ifdef CONFIG_MODULES
34 extern void *unwind_add_table(struct module *,
35 const void *table_start,
36 unsigned long table_size);
38 extern void unwind_remove_table(void *handle, int init_only);
40 #endif
42 extern int unwind_init_frame_info(struct unwind_frame_info *,
43 struct task_struct *,
44 /*const*/ struct pt_regs *);
47 * Prepare to unwind a blocked task.
49 extern int unwind_init_blocked(struct unwind_frame_info *,
50 struct task_struct *);
53 * Prepare to unwind the currently running thread.
55 extern int unwind_init_running(struct unwind_frame_info *,
56 asmlinkage int (*callback)(struct unwind_frame_info *,
57 void *arg),
58 void *arg);
61 * Unwind to previous to frame. Returns 0 if successful, negative
62 * number in case of an error.
64 extern int unwind(struct unwind_frame_info *);
67 * Unwind until the return pointer is in user-land (or until an error
68 * occurs). Returns 0 if successful, negative number in case of
69 * error.
71 extern int unwind_to_user(struct unwind_frame_info *);
73 #else
75 struct unwind_frame_info {};
77 static inline void unwind_init(void) {}
79 #ifdef CONFIG_MODULES
81 static inline void *unwind_add_table(struct module *mod,
82 const void *table_start,
83 unsigned long table_size)
85 return NULL;
88 #endif
90 static inline void unwind_remove_table(void *handle, int init_only)
94 static inline int unwind_init_frame_info(struct unwind_frame_info *info,
95 struct task_struct *tsk,
96 const struct pt_regs *regs)
98 return -ENOSYS;
101 static inline int unwind_init_blocked(struct unwind_frame_info *info,
102 struct task_struct *tsk)
104 return -ENOSYS;
107 static inline int unwind_init_running(struct unwind_frame_info *info,
108 asmlinkage int (*cb)(struct unwind_frame_info *,
109 void *arg),
110 void *arg)
112 return -ENOSYS;
115 static inline int unwind(struct unwind_frame_info *info)
117 return -ENOSYS;
120 static inline int unwind_to_user(struct unwind_frame_info *info)
122 return -ENOSYS;
125 #endif
127 #endif /* _LINUX_UNWIND_H */