ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / arch / um / sys-i386 / extable.c
1 /*
2  * linux/arch/i386/mm/extable.c
3  */
4
5 #include <linux/config.h>
6 #include <linux/module.h>
7 #include <linux/spinlock.h>
8 #include <asm/uaccess.h>
9
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)
15 {
16         while (first <= last) {
17                 const struct exception_table_entry *mid;
18                 long diff;
19
20                 mid = (last - first) / 2 + first;
21                 diff = mid->insn - value;
22                 if (diff == 0)
23                         return mid;
24                 else if (diff < 0)
25                         first = mid+1;
26                 else
27                         last = mid-1;
28         }
29         return NULL;
30 }