2 * linux/arch/frv/mm/extable.c
5 #include <linux/module.h>
6 #include <linux/spinlock.h>
7 #include <asm/uaccess.h>
9 extern const void __memset_end
, __memset_user_error_lr
, __memset_user_error_handler
;
10 extern const void __memcpy_end
, __memcpy_user_error_lr
, __memcpy_user_error_handler
;
11 extern spinlock_t modlist_lock
;
13 /*****************************************************************************/
17 static inline unsigned long search_one_table(const struct exception_table_entry
*first
,
18 const struct exception_table_entry
*last
,
21 while (first
<= last
) {
22 const struct exception_table_entry
__attribute__((aligned(8))) *mid
;
25 mid
= (last
- first
) / 2 + first
;
26 diff
= mid
->insn
- value
;
35 } /* end search_one_table() */
37 /*****************************************************************************/
39 * see if there's a fixup handler available to deal with a kernel fault
41 unsigned long search_exception_table(unsigned long pc
)
43 const struct exception_table_entry
*extab
;
45 /* determine if the fault lay during a memcpy_user or a memset_user */
46 if (__frame
->lr
== (unsigned long) &__memset_user_error_lr
&&
47 (unsigned long) &memset
<= pc
&& pc
< (unsigned long) &__memset_end
49 /* the fault occurred in a protected memset
50 * - we search for the return address (in LR) instead of the program counter
51 * - it was probably during a clear_user()
53 return (unsigned long) &__memset_user_error_handler
;
56 if (__frame
->lr
== (unsigned long) &__memcpy_user_error_lr
&&
57 (unsigned long) &memcpy
<= pc
&& pc
< (unsigned long) &__memcpy_end
59 /* the fault occurred in a protected memset
60 * - we search for the return address (in LR) instead of the program counter
61 * - it was probably during a copy_to/from_user()
63 return (unsigned long) &__memcpy_user_error_handler
;
66 extab
= search_exception_tables(pc
);
72 } /* end search_exception_table() */