2 * linux/arch/mips/mm/extable.c
4 #include <linux/config.h>
5 #include <linux/module.h>
6 #include <linux/spinlock.h>
7 #include <asm/uaccess.h>
9 extern const struct exception_table_entry __start___ex_table[];
10 extern const struct exception_table_entry __stop___ex_table[];
12 static inline unsigned long
13 search_one_table(const struct exception_table_entry *first,
14 const struct exception_table_entry *last,
17 while (first <= last) {
18 const struct exception_table_entry *mid;
21 mid = (last - first) / 2 + first;
22 diff = mid->insn - value;
33 extern spinlock_t modlist_lock;
36 search_exception_table(unsigned long addr)
38 unsigned long ret = 0;
40 #ifndef CONFIG_MODULES
41 /* There is only the kernel to search. */
42 ret = search_one_table(__start___ex_table, __stop___ex_table-1, addr);
46 /* The kernel is the last "module" -- no need to treat it special. */
49 spin_lock_irqsave(&modlist_lock, flags);
50 for (mp = module_list; mp != NULL; mp = mp->next) {
51 if (mp->ex_table_start == NULL || !(mp->flags&(MOD_RUNNING|MOD_INITIALIZING)))
53 ret = search_one_table(mp->ex_table_start,
54 mp->ex_table_end - 1, addr);
58 spin_unlock_irqrestore(&modlist_lock, flags);