2 * linux/arch/frv/mm/extable.c
5 #include <linux/config.h>
6 #include <linux/module.h>
7 #include <linux/spinlock.h>
8 #include <asm/uaccess.h>
10 extern const struct exception_table_entry
__attribute__((aligned(8))) __start___ex_table
[];
11 extern const struct exception_table_entry
__attribute__((aligned(8))) __stop___ex_table
[];
12 extern const void __memset_end
, __memset_user_error_lr
, __memset_user_error_handler
;
13 extern const void __memcpy_end
, __memcpy_user_error_lr
, __memcpy_user_error_handler
;
14 extern spinlock_t modlist_lock
;
16 /*****************************************************************************/
20 static inline unsigned long 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
__attribute__((aligned(8))) *mid
;
28 mid
= (last
- first
) / 2 + first
;
29 diff
= mid
->insn
- value
;
38 } /* end search_one_table() */
40 /*****************************************************************************/
42 * see if there's a fixup handler available to deal with a kernel fault
44 unsigned long search_exception_table(unsigned long pc
)
46 const struct exception_table_entry
*extab
;
48 /* determine if the fault lay during a memcpy_user or a memset_user */
49 if (__frame
->lr
== (unsigned long) &__memset_user_error_lr
&&
50 (unsigned long) &memset
<= pc
&& pc
< (unsigned long) &__memset_end
52 /* the fault occurred in a protected memset
53 * - we search for the return address (in LR) instead of the program counter
54 * - it was probably during a clear_user()
56 return (unsigned long) &__memset_user_error_handler
;
59 if (__frame
->lr
== (unsigned long) &__memcpy_user_error_lr
&&
60 (unsigned long) &memcpy
<= pc
&& pc
< (unsigned long) &__memcpy_end
62 /* the fault occurred in a protected memset
63 * - we search for the return address (in LR) instead of the program counter
64 * - it was probably during a copy_to/from_user()
66 return (unsigned long) &__memcpy_user_error_handler
;
69 extab
= search_exception_tables(pc
);
75 } /* end search_exception_table() */