Merge tag 'chrome-platform-for-linus-4.13' of git://git.kernel.org/pub/scm/linux...
[linux/fpc-iii.git] / arch / frv / mm / extable.c
blob9198ddd16092107e98aa2a94d89fade42fe41dd4
1 /*
2 * linux/arch/frv/mm/extable.c
3 */
5 #include <linux/extable.h>
6 #include <linux/spinlock.h>
7 #include <linux/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 int fixup_exception(struct pt_regs *regs)
15 const struct exception_table_entry *extab;
16 unsigned long pc = regs->pc;
18 /* determine if the fault lay during a memcpy_user or a memset_user */
19 if (regs->lr == (unsigned long) &__memset_user_error_lr &&
20 (unsigned long) &memset <= pc && pc < (unsigned long) &__memset_end
21 ) {
22 /* the fault occurred in a protected memset
23 * - we search for the return address (in LR) instead of the program counter
24 * - it was probably during a clear_user()
26 regs->pc = (unsigned long) &__memset_user_error_handler;
27 return 1;
30 if (regs->lr == (unsigned long) &__memcpy_user_error_lr &&
31 (unsigned long) &memcpy <= pc && pc < (unsigned long) &__memcpy_end
32 ) {
33 /* the fault occurred in a protected memset
34 * - we search for the return address (in LR) instead of the program counter
35 * - it was probably during a copy_to/from_user()
37 regs->pc = (unsigned long) &__memcpy_user_error_handler;
38 return 1;
41 extab = search_exception_tables(pc);
42 if (extab) {
43 regs->pc = extab->fixup;
44 return 1;
47 return 0;