Whamcloud - gitweb
- 2.6 fixes landed
[fs/lustre-release.git] / lustre / kernel_patches / patches / kernel_text_address-2.6.0.patch
1 Index: linux-2.6.0/arch/i386/kernel/traps.c
2 ===================================================================
3 --- linux-2.6.0.orig/arch/i386/kernel/traps.c   2003-12-31 01:59:49.000000000 +0300
4 +++ linux-2.6.0/arch/i386/kernel/traps.c        2003-12-31 16:05:53.000000000 +0300
5 @@ -1032,3 +1032,40 @@
6  
7         trap_init_hook();
8  }
9 +#ifdef CONFIG_MODULES
10 +extern struct module *module_list;
11 +extern struct module kernel_module;
12 +#endif
13 +
14 +int is_kernel_text_address(unsigned long addr)
15 +{
16 +       int retval = 0;
17 +#ifdef CONFIG_MODULES
18 +       struct module *mod;
19 +#endif
20 +       if (addr >= (unsigned long) &_stext &&
21 +           addr <= (unsigned long) &_etext);
22 +               return 1;
23 +
24 +#ifdef CONFIG_MODULES
25 +       for (mod = module_list; mod != &kernel_module; mod = mod->next) {
26 +               /* mod_bound tests for addr being inside the vmalloc'ed
27 +                * module area. Of course it'd be better to test only
28 +                * for the .text subset... */
29 +               if (mod_bound(addr, 0, mod)) {
30 +                       retval = 1;
31 +                       break;
32 +               }
33 +       }
34 +#endif
35 +
36 +       return retval;
37 +}
38 +
39 +int lookup_symbol(unsigned long address, char *buf, int buflen)
40 +{
41 +       return -ENOSYS;
42 +}
43 +
44 +EXPORT_SYMBOL_GPL(is_kernel_text_address);
45 +EXPORT_SYMBOL_GPL(lookup_symbol);