OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [arch/] [or32/] [mm/] [extable.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/*
2
 *  linux/arch/or32/mm/extable.c
3
 *
4
 *  or32 version
5
 *
6
 * taken from: linux/arch/cris/mm/extable.c
7
 *
8
 */
9
 
10
#include <linux/config.h>
11
#include <linux/module.h>
12
#include <asm/uaccess.h>
13
 
14
extern const struct exception_table_entry __start___ex_table[];
15
extern const struct exception_table_entry __stop___ex_table[];
16
 
17
static inline unsigned long
18
search_one_table(const struct exception_table_entry *first,
19
                 const struct exception_table_entry *last,
20
                 unsigned long value)
21
{
22
        while (first <= last) {
23
                const struct exception_table_entry *mid;
24
                long diff;
25
 
26
                mid = (last - first) / 2 + first;
27
                diff = mid->insn - value;
28
                if (diff == 0)
29
                        return mid->fixup;
30
                else if (diff < 0)
31
                        first = mid+1;
32
                else
33
                        last = mid-1;
34
        }
35
        return 0;
36
}
37
 
38
unsigned long
39
search_exception_table(unsigned long addr)
40
{
41
#ifndef CONFIG_MODULES
42
        /* There is only the kernel to search.  */
43
        return search_one_table(__start___ex_table, __stop___ex_table-1, addr);
44
#else
45
        /* The kernel is the last "module" -- no need to treat it special.  */
46
        unsigned long ret;
47
        struct module *mp;
48
        for (mp = module_list; mp != NULL; mp = mp->next) {
49
                if (mp->ex_table_start == NULL)
50
                        continue;
51
                ret = search_one_table(mp->ex_table_start,
52
                                       mp->ex_table_end - 1, addr);
53
                if (ret) return ret;
54
        }
55
#endif
56
 
57
        return 0;
58
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.