RT-AC66 3.0.0.4.374.130 core
[tomato.git] / release / src-rt-6.x / linux / linux-2.6 / arch / x86_64 / mm / extable.c
blob79ac6e7100af32675ee00c1177a622e9af583548
1 /*
2 * linux/arch/x86_64/mm/extable.c
3 */
5 #include <linux/module.h>
6 #include <linux/spinlock.h>
7 #include <linux/init.h>
8 #include <asm/uaccess.h>
10 /* Simple binary search */
11 const struct exception_table_entry *
12 search_extable(const struct exception_table_entry *first,
13 const struct exception_table_entry *last,
14 unsigned long value)
16 /* Work around a B stepping K8 bug */
17 if ((value >> 32) == 0)
18 value |= 0xffffffffUL << 32;
20 while (first <= last) {
21 const struct exception_table_entry *mid;
22 long diff;
24 mid = (last - first) / 2 + first;
25 diff = mid->insn - value;
26 if (diff == 0)
27 return mid;
28 else if (diff < 0)
29 first = mid+1;
30 else
31 last = mid-1;
33 return NULL;