40 #include <linux/list.h>
41 #include <linux/module.h>
42 #include <linux/kernel.h>
44 #include <linux/sched.h>
48 static inline unsigned long bug_addr(
const struct bug_entry *bug)
50 #ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS
53 return (
unsigned long)bug + bug->bug_addr_disp;
60 static const struct bug_entry *module_find_bug(
unsigned long bugaddr)
65 const struct bug_entry *bug = mod->bug_table;
68 for (i = 0; i < mod->num_bugs; ++
i, ++bug)
69 if (bugaddr == bug_addr(bug))
81 mod->bug_table =
NULL;
85 secstrings = (
char *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
86 for (i = 1; i < hdr->e_shnum; i++) {
87 if (
strcmp(secstrings+sechdrs[i].sh_name,
"__bug_table"))
89 mod->bug_table = (
void *) sechdrs[i].sh_addr;
90 mod->num_bugs = sechdrs[
i].sh_size /
sizeof(
struct bug_entry);
99 list_add(&mod->bug_list, &module_bug_list);
102 void module_bug_cleanup(
struct module *mod)
109 static inline const struct bug_entry *module_find_bug(
unsigned long bugaddr)
115 const struct bug_entry *
find_bug(
unsigned long bugaddr)
117 const struct bug_entry *bug;
120 if (bugaddr == bug_addr(bug))
123 return module_find_bug(bugaddr);
128 const struct bug_entry *bug;
142 #ifdef CONFIG_DEBUG_BUGVERBOSE
143 #ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS
146 file = (
const char *)bug + bug->file_disp;
150 warning = (bug->flags & BUGFLAG_WARNING) != 0;
162 "[verbose debug info unavailable]\n",
179 "[verbose debug info unavailable]\n",