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