Merge with 2.5.75.
[linux-2.6/linux-mips.git] / arch / cris / mm / extable.c
blob7992bdb4fea1cd2ac01f7c89fb18e8e693a89125
1 /*
2 * linux/arch/cris/mm/extable.c
4 * $Log: extable.c,v $
5 * Revision 1.4 2003/01/09 14:42:52 starvik
6 * Merge of Linux 2.5.55
8 * Revision 1.3 2002/11/21 07:24:54 starvik
9 * Made search_exception_table similar to implementation for other archs
10 * (now compiles with CONFIG_MODULES)
12 * Revision 1.2 2002/11/18 07:36:55 starvik
13 * Removed warning
15 * Revision 1.1 2001/12/17 13:59:27 bjornw
16 * Initial revision
18 * Revision 1.3 2001/09/27 13:52:40 bjornw
19 * Harmonize underscore-ness with other parts
24 #include <linux/config.h>
25 #include <linux/module.h>
26 #include <asm/uaccess.h>
28 /* Simple binary search */
29 const struct exception_table_entry *
30 search_extable(const struct exception_table_entry *first,
31 const struct exception_table_entry *last,
32 unsigned long value)
34 while (first <= last) {
35 const struct exception_table_entry *mid;
36 long diff;
38 mid = (last - first) / 2 + first;
39 diff = mid->insn - value;
40 if (diff == 0)
41 return mid;
42 else if (diff < 0)
43 first = mid+1;
44 else
45 last = mid-1;
47 return NULL;