1 diff -urNp linux-700/arch/i386/config.in linux-720/arch/i386/config.in
2 --- linux-700/arch/i386/config.in
3 +++ linux-720/arch/i386/config.in
4 @@ -9,8 +9,6 @@ define_bool CONFIG_SBUS n
6 define_bool CONFIG_UID16 y
8 +define_bool CONFIG_KALLSYMS y
10 mainmenu_option next_comment
11 comment 'Code maturity level options'
12 bool 'Prompt for development and/or incomplete code/drivers' CONFIG_EXPERIMENTAL
13 diff -urNp linux-700/arch/i386/kernel/process.c linux-720/arch/i386/kernel/process.c
14 --- linux-700/arch/i386/kernel/process.c
15 +++ linux-720/arch/i386/kernel/process.c
17 #include <linux/reboot.h>
18 #include <linux/init.h>
19 #include <linux/mc146818rtc.h>
20 +#include <linux/version.h>
22 #include <asm/uaccess.h>
23 #include <asm/pgtable.h>
24 @@ -437,10 +438,14 @@ extern void show_trace(unsigned long* es
25 void show_regs(struct pt_regs * regs)
27 unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L;
28 + static char buffer[512];
30 + lookup_symbol(regs->eip,buffer,512);
33 printk("Pid: %d, comm: %20s\n", current->pid, current->comm);
34 printk("EIP: %04x:[<%08lx>] CPU: %d",0xffff & regs->xcs,regs->eip, smp_processor_id());
35 + printk("\nEIP is at %s (" UTS_RELEASE ")\n",buffer);
37 printk(" ESP: %04x:%08lx",0xffff & regs->xss,regs->esp);
38 printk(" EFLAGS: %08lx %s\n",regs->eflags, print_tainted());
39 diff -urNp linux-700/arch/i386/kernel/traps.c linux-720/arch/i386/kernel/traps.c
40 --- linux-700/arch/i386/kernel/traps.c
41 +++ linux-720/arch/i386/kernel/traps.c
43 #include <linux/spinlock.h>
44 #include <linux/interrupt.h>
45 #include <linux/highmem.h>
46 +#include <linux/version.h>
49 #include <linux/mca.h>
50 @@ -135,6 +136,8 @@ void show_trace(unsigned long * stack)
54 + /* static to not take up stackspace; if we race here too bad */
55 + static char buffer[512];
58 stack = (unsigned long*)&stack;
59 @@ -144,9 +147,8 @@ void show_trace(unsigned long * stack)
60 while (((long) stack & (THREAD_SIZE-1)) != 0) {
62 if (kernel_text_address(addr)) {
63 - if (i && ((i % 6) == 0))
65 - printk(" [<%08lx>]", addr);
66 + lookup_symbol(addr, buffer, 512);
67 + printk("[<%08lx>] %s (0x%x))\n", addr,buffer,stack-1);
71 @@ -194,12 +196,17 @@ void dump_stack(void)
76 +void print_modules(void);
79 void show_registers(struct pt_regs *regs)
85 + static char buffer[512];
87 esp = (unsigned long) (®s->esp);
89 @@ -208,8 +215,12 @@ void show_registers(struct pt_regs *regs
91 ss = regs->xss & 0xffff;
95 + lookup_symbol(regs->eip, buffer, 512);
96 printk("CPU: %d\nEIP: %04x:[<%08lx>] %s\nEFLAGS: %08lx\n",
97 smp_processor_id(), 0xffff & regs->xcs, regs->eip, print_tainted(), regs->eflags);
98 + printk("\nEIP is at %s (" UTS_RELEASE ")\n",buffer);
99 printk("eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n",
100 regs->eax, regs->ebx, regs->ecx, regs->edx);
101 printk("esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n",
102 @@ -269,7 +280,7 @@ static void handle_BUG(struct pt_regs *r
103 if (__get_user(file, (char **)(eip + 4)) ||
104 (unsigned long)file < PAGE_OFFSET || __get_user(c, file))
105 file = "<bad filename>";
107 + printk("------------[ cut here ]------------\n");
108 printk("kernel BUG at %s:%d!\n", file, line);
111 diff -urNp linux-700/include/linux/kernel.h linux-720/include/linux/kernel.h
112 --- linux-700/include/linux/kernel.h
113 +++ linux-720/include/linux/kernel.h
114 @@ -110,6 +110,8 @@ extern const char *print_tainted(void);
116 extern void dump_stack(void);
118 +extern int lookup_symbol(unsigned long address, char *buffer, int buflen);
121 #define pr_debug(fmt,arg...) \
122 printk(KERN_DEBUG fmt,##arg)
123 diff -urNp linux-700/kernel/kksymoops.c linux-720/kernel/kksymoops.c
124 --- linux-700/kernel/kksymoops.c 1970-01-01 01:00:00.000000000 +0100
125 +++ linux-720/kernel/kksymoops.c
127 +#include <linux/module.h>
128 +#include <linux/string.h>
129 +#include <linux/errno.h>
130 +#include <linux/kernel.h>
131 +#include <linux/config.h>
132 +#ifdef CONFIG_KALLSYMS
133 +#include <linux/kallsyms.h>
138 +int lookup_symbol(unsigned long address, char *buffer, int buflen)
140 + struct module *this_mod;
141 + unsigned long bestsofar;
143 + const char *mod_name = NULL, *sec_name = NULL, *sym_name = NULL;
144 + unsigned long mod_start,mod_end,sec_start,sec_end,sym_start,sym_end;
152 + memset(buffer,0,buflen);
154 +#ifdef CONFIG_KALLSYMS
155 + if (!kallsyms_address_to_symbol(address,&mod_name,&mod_start,&mod_end,&sec_name,
156 + &sec_start, &sec_end, &sym_name, &sym_start, &sym_end)) {
157 + /* kallsyms doesn't have a clue; lets try harder */
159 + snprintf(buffer,buflen-1,"[unresolved]");
161 + this_mod = module_list;
163 + while (this_mod != NULL) {
165 + /* walk the symbol list of this module. Only symbols
166 + who's address is smaller than the searched for address
167 + are relevant; and only if it's better than the best so far */
168 + for (i=0; i< this_mod->nsyms; i++)
169 + if ((this_mod->syms[i].value<=address) &&
170 + (bestsofar<this_mod->syms[i].value)) {
171 + snprintf(buffer,buflen-1,"%s [%s] 0x%x",
172 + this_mod->syms[i].name,
174 + (unsigned int)(address - this_mod->syms[i].value));
175 + bestsofar = this_mod->syms[i].value;
177 + this_mod = this_mod->next;
180 + } else { /* kallsyms success */
181 + snprintf(buffer,buflen-1,"%s [%s] 0x%x",sym_name,mod_name,(unsigned int)(address-sym_start));
184 + return strlen(buffer);
187 +static char modlist[4096];
188 +/* this function isn't smp safe but that's not really a problem; it's called from
189 + * oops context only and any locking could actually prevent the oops from going out;
190 + * the line that is generated is informational only and should NEVER prevent the real oops
193 +void print_modules(void)
195 + struct module *this_mod;
197 + memset(modlist,0,4096);
199 +#ifdef CONFIG_KALLSYMS
200 + this_mod = module_list;
201 + while (this_mod != NULL) {
202 + if (this_mod->name != NULL)
203 + pos +=snprintf(modlist+pos,160-pos-1,"%s ",this_mod->name);
204 + this_mod = this_mod->next;
206 + printk("%s\n",modlist);
209 diff -urNp linux-700/kernel/Makefile linux-720/kernel/Makefile
210 --- linux-700/kernel/Makefile 2001-09-17 06:22:40.000000000 +0200
211 +++ linux-720/kernel/Makefile
212 @@ -14,7 +14,7 @@ export-objs = signal.o sys.o kmod.o cont
213 obj-y = sched.o dma.o fork.o exec_domain.o panic.o printk.o \
214 module.o exit.o itimer.o info.o time.o softirq.o resource.o \
215 sysctl.o acct.o capability.o ptrace.o timer.o user.o \
216 - signal.o sys.o kmod.o context.o
217 + signal.o sys.o kmod.o context.o kksymoops.o
219 obj-$(CONFIG_UID16) += uid16.o
220 obj-$(CONFIG_MODULES) += ksyms.o