2 * linux/arch/sparc64/mm/extable.c
5 #include <linux/config.h>
6 #include <linux/module.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
[];
13 search_one_table(const struct exception_table_entry
*start
,
14 const struct exception_table_entry
*last
,
15 unsigned long value
, unsigned long *g2
)
17 const struct exception_table_entry
*first
= start
;
18 const struct exception_table_entry
*mid
;
20 while (first
<= last
) {
21 mid
= (last
- first
) / 2 + first
;
22 diff
= mid
->insn
- value
;
26 return (mid
+ 1)->fixup
;
34 if (last
->insn
< value
&& !last
->fixup
&& last
[1].insn
> value
) {
35 *g2
= (value
- last
->insn
)/4;
38 if (first
> start
&& first
[-1].insn
< value
39 && !first
[-1].fixup
&& first
->insn
< value
) {
40 *g2
= (value
- first
[-1].insn
)/4;
47 search_exception_table(unsigned long addr
, unsigned long *g2
)
51 #ifndef CONFIG_MODULES
52 /* There is only the kernel to search. */
53 ret
= search_one_table(__start___ex_table
,
54 __stop___ex_table
-1, addr
, g2
);
57 /* The kernel is the last "module" -- no need to treat it special. */
59 for (mp
= module_list
; mp
!= NULL
; mp
= mp
->next
) {
60 if (mp
->ex_table_start
== NULL
)
62 ret
= search_one_table(mp
->ex_table_start
,
63 mp
->ex_table_end
-1, addr
, g2
);