Whamcloud - gitweb
landing b_cmobd_merge on HEAD
[fs/lustre-release.git] / lustre / kernel_patches / patches / kernel_text_address-2.4.21-sles8sp3.patch
1 Index: linux-2.4.21/arch/um/kernel/Makefile
2 ===================================================================
3 --- linux-2.4.21.orig/arch/um/kernel/Makefile   2004-04-24 02:37:58.000000000 -0400
4 +++ linux-2.4.21/arch/um/kernel/Makefile        2004-04-24 02:51:03.000000000 -0400
5 @@ -37,7 +37,8 @@
6  export-objs-$(CONFIG_GPROF) += gprof_syms.o
7  export-objs-$(CONFIG_GCOV) += gmon_syms.o
8  
9 -export-objs = ksyms.o process_kern.o signal_kern.o user_syms.o $(export-objs-y)
10 +export-objs = ksyms.o process_kern.o signal_kern.o user_syms.o sysrq.o \
11 +       $(export-objs-y)
12  
13  CFLAGS_user_syms.o = -D__AUTOCONF_INCLUDED__ $(DMODULES-y) $(DMODVERSIONS-y) \
14         -I/usr/include -I../include
15 Index: linux-2.4.21/arch/um/kernel/sysrq.c
16 ===================================================================
17 --- linux-2.4.21.orig/arch/um/kernel/sysrq.c    2004-04-24 02:37:58.000000000 -0400
18 +++ linux-2.4.21/arch/um/kernel/sysrq.c 2004-04-24 02:51:03.000000000 -0400
19 @@ -86,6 +86,37 @@
20         show_trace((unsigned long *)esp);
21  }
22  
23 +#ifdef CONFIG_MODULES
24 +extern struct module *module_list;
25 +extern struct module kernel_module;
26 +#endif
27 +
28 +int is_kernel_text_address(unsigned long addr)
29 +{
30 +       int retval = 0;
31 +#ifdef CONFIG_MODULES
32 +       struct module *mod;
33 +#endif
34 +       if (addr >= (unsigned long) &_stext &&
35 +           addr <= (unsigned long) &_etext)
36 +               return 1;
37 +
38 +#ifdef CONFIG_MODULES
39 +       for (mod = module_list; mod != &kernel_module; mod = mod->next) {
40 +               /* mod_bound tests for addr being inside the vmalloc'ed
41 +                * module area. Of course it'd be better to test only
42 +                * for the .text subset... */
43 +               if (mod_bound(addr, 0, mod)) {
44 +                       retval = 1;
45 +                       break;
46 +               }
47 +       }
48 +#endif
49 +       return retval;
50 +}
51 +
52 +EXPORT_SYMBOL(is_kernel_text_address);
53 +
54  /*
55   * Overrides for Emacs so that we follow Linus's tabbing style.
56   * Emacs will notice this stuff at the end of the file and automatically
57 Index: linux-2.4.21/arch/i386/kernel/Makefile
58 ===================================================================
59 --- linux-2.4.21.orig/arch/i386/kernel/Makefile 2004-04-24 02:39:05.000000000 -0400
60 +++ linux-2.4.21/arch/i386/kernel/Makefile      2004-04-24 02:51:26.000000000 -0400
61 @@ -20,7 +20,7 @@
62  
63  O_TARGET := kernel.o
64  
65 -export-objs     := mca.o mtrr.o msr.o cpuid.o microcode.o i386_ksyms.o time.o traps.o dr_alloc.o
66 +export-objs     := mca.o mtrr.o msr.o cpuid.o microcode.o i386_ksyms.o time.o traps.o dr_alloc.o traps.o
67  
68  ifdef CONFIG_X86_SPEEDSTEP_ICH
69  export-objs    += speedstep-lib.o
70 Index: linux-2.4.21/arch/i386/kernel/traps.c
71 ===================================================================
72 --- linux-2.4.21.orig/arch/i386/kernel/traps.c  2004-04-24 02:42:58.000000000 -0400
73 +++ linux-2.4.21/arch/i386/kernel/traps.c       2004-04-24 02:51:03.000000000 -0400
74 @@ -1339,3 +1339,41 @@
75         cobalt_init();
76  #endif
77  }
78 +
79 +#ifdef CONFIG_MODULES
80 +extern struct module *module_list;
81 +extern struct module kernel_module;
82 +#endif
83 +                                                                                
84 +int is_kernel_text_address(unsigned long addr)
85 +{
86 +       int retval = 0;
87 +#ifdef CONFIG_MODULES
88 +       struct module *mod;
89 +#endif
90 +       if (addr >= (unsigned long) &_stext &&
91 +           addr <= (unsigned long) &_etext);
92 +               return 1;
93 +                                                                                
94 +#ifdef CONFIG_MODULES
95 +       for (mod = module_list; mod != &kernel_module; mod = mod->next) {
96 +               /* mod_bound tests for addr being inside the vmalloc'ed
97 +                * module area. Of course it'd be better to test only
98 +                * for the .text subset... */
99 +               if (mod_bound(addr, 0, mod)) {
100 +                       retval = 1;
101 +                       break;
102 +               }
103 +       }
104 +#endif
105 +                                                                                
106 +       return retval;
107 +}
108 +
109 +int lookup_symbol(unsigned long address, char *buf, int buflen)
110 +{
111 +       return -ENOSYS;
112 +}
113 +
114 +EXPORT_SYMBOL_GPL(is_kernel_text_address);
115 +EXPORT_SYMBOL_GPL(lookup_symbol);