blob: 42aa0a54b6f4d919a1568a881aeaabb9469640d7 [file] [log] [blame]
Jeremy Fitzhardinge7664c5a2006-12-08 02:36:19 -08001#ifndef _LINUX_BUG_H
2#define _LINUX_BUG_H
3
4#include <linux/module.h>
5#include <asm/bug.h>
6
7enum bug_trap_type {
8 BUG_TRAP_TYPE_NONE = 0,
9 BUG_TRAP_TYPE_WARN = 1,
10 BUG_TRAP_TYPE_BUG = 2,
11};
12
13#ifdef CONFIG_GENERIC_BUG
14#include <asm-generic/bug.h>
15
16static inline int is_warning_bug(const struct bug_entry *bug)
17{
18 return bug->flags & BUGFLAG_WARNING;
19}
20
21const struct bug_entry *find_bug(unsigned long bugaddr);
22
23enum bug_trap_type report_bug(unsigned long bug_addr);
24
25int module_bug_finalize(const Elf_Ehdr *, const Elf_Shdr *,
26 struct module *);
27void module_bug_cleanup(struct module *);
28
29/* These are defined by the architecture */
30int is_valid_bugaddr(unsigned long addr);
31
32#else /* !CONFIG_GENERIC_BUG */
33
34static inline enum bug_trap_type report_bug(unsigned long bug_addr)
35{
36 return BUG_TRAP_TYPE_BUG;
37}
38static inline int module_bug_finalize(const Elf_Ehdr *hdr,
39 const Elf_Shdr *sechdrs,
40 struct module *mod)
41{
42 return 0;
43}
44static inline void module_bug_cleanup(struct module *mod) {}
45
46#endif /* CONFIG_GENERIC_BUG */
47#endif /* _LINUX_BUG_H */