2 * arch/s390/mm/extable.c
5 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Hartmut Penner (hp@de.ibm.com)
8 * Derived from "arch/i386/mm/extable.c"
11 #include <linux/config.h>
12 #include <linux/module.h>
13 #include <linux/spinlock.h>
14 #include <asm/uaccess.h>
16 extern const struct exception_table_entry __start___ex_table[];
17 extern const struct exception_table_entry __stop___ex_table[];
19 static inline unsigned long
20 search_one_table(const struct exception_table_entry *first,
21 const struct exception_table_entry *last,
24 while (first <= last) {
25 const struct exception_table_entry *mid;
28 mid = (last - first) / 2 + first;
29 diff = mid->insn - value;
40 extern spinlock_t modlist_lock;
43 search_exception_table(unsigned long addr)
45 unsigned long ret = 0;
48 #ifndef CONFIG_MODULES
49 /* There is only the kernel to search. */
50 ret = search_one_table(__start___ex_table, __stop___ex_table-1, addr);
53 /* The kernel is the last "module" -- no need to treat it special. */
56 spin_lock_irqsave(&modlist_lock, flags);
57 for (mp = module_list; mp != NULL; mp = mp->next) {
58 if (mp->ex_table_start == NULL || !(mp->flags&(MOD_RUNNING|MOD_INITIALIZING)))
60 ret = search_one_table(mp->ex_table_start,
61 mp->ex_table_end - 1, addr);
65 spin_unlock_irqrestore(&modlist_lock, flags);