2 * linux/arch/frv/mm/extable.c
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
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;
30 if (regs->lr == (unsigned long) &__memcpy_user_error_lr &&
31 (unsigned long) &memcpy <= pc && pc < (unsigned long) &__memcpy_end
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;
41 extab = search_exception_tables(pc);
43 regs->pc = extab->fixup;