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

Subversion Repositories or1k

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

powered by: WebSVN 2.1.0

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