drm/radeon: fix voltage setup on hawaii
[linux/fpc-iii.git] / arch / frv / mm / extable.c
blob2fb9b3ab57b9d624883fb5dd8d53944b12bb1556
1 /*
2 * linux/arch/frv/mm/extable.c
3 */
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,
19 unsigned long value)
21 while (first <= last) {
22 const struct exception_table_entry __attribute__((aligned(8))) *mid;
23 long diff;
25 mid = (last - first) / 2 + first;
26 diff = mid->insn - value;
27 if (diff == 0)
28 return mid->fixup;
29 else if (diff < 0)
30 first = mid + 1;
31 else
32 last = mid - 1;
34 return 0;
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
48 ) {
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
58 ) {
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);
67 if (extab)
68 return extab->fixup;
70 return 0;
72 } /* end search_exception_table() */