1 // SPDX-License-Identifier: GPL-2.0
3 * linux/arch/frv/mm/extable.c
6 #include <linux/extable.h>
7 #include <linux/spinlock.h>
8 #include <linux/uaccess.h>
10 extern const void __memset_end
, __memset_user_error_lr
, __memset_user_error_handler
;
11 extern const void __memcpy_end
, __memcpy_user_error_lr
, __memcpy_user_error_handler
;
12 extern spinlock_t modlist_lock
;
14 int fixup_exception(struct pt_regs
*regs
)
16 const struct exception_table_entry
*extab
;
17 unsigned long pc
= regs
->pc
;
19 /* determine if the fault lay during a memcpy_user or a memset_user */
20 if (regs
->lr
== (unsigned long) &__memset_user_error_lr
&&
21 (unsigned long) &memset
<= pc
&& pc
< (unsigned long) &__memset_end
23 /* the fault occurred in a protected memset
24 * - we search for the return address (in LR) instead of the program counter
25 * - it was probably during a clear_user()
27 regs
->pc
= (unsigned long) &__memset_user_error_handler
;
31 if (regs
->lr
== (unsigned long) &__memcpy_user_error_lr
&&
32 (unsigned long) &memcpy
<= pc
&& pc
< (unsigned long) &__memcpy_end
34 /* the fault occurred in a protected memset
35 * - we search for the return address (in LR) instead of the program counter
36 * - it was probably during a copy_to/from_user()
38 regs
->pc
= (unsigned long) &__memcpy_user_error_handler
;
42 extab
= search_exception_tables(pc
);
44 regs
->pc
= extab
->fixup
;