patch-2.4.0-test3 linux/arch/mips64/kernel/traps.c

Next file: linux/arch/mips64/ld.script.elf32
Previous file: linux/arch/mips64/kernel/syscall.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test2/linux/arch/mips64/kernel/traps.c linux/arch/mips64/kernel/traps.c
@@ -1,5 +1,4 @@
-/* $Id: traps.c,v 1.4 2000/01/20 23:50:27 ralf Exp $
- *
+/*
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
@@ -41,9 +40,9 @@
 		console_loglevel = 15;
 }
 
-extern asmlinkage void __xtlb_mod_debug(void);
-extern asmlinkage void __xtlb_tlbl_debug(void);
-extern asmlinkage void __xtlb_tlbs_debug(void);
+extern asmlinkage void __xtlb_mod(void);
+extern asmlinkage void __xtlb_tlbl(void);
+extern asmlinkage void __xtlb_tlbs(void);
 extern asmlinkage void handle_adel(void);
 extern asmlinkage void handle_ades(void);
 extern asmlinkage void handle_ibe(void);
@@ -77,10 +76,10 @@
  * This routine abuses get_user()/put_user() to reference pointers
  * with at least a bit of error checking ...
  */
-void show_stack(unsigned int *sp)
+void show_stack(unsigned long *sp)
 {
 	int i;
-	unsigned int *stack;
+	unsigned long *stack;
 
 	stack = sp;
 	i = 0;
@@ -94,22 +93,22 @@
 			break;
 		}
 
-		printk(" %08lx", stackdata);
+		printk(" %016lx", stackdata);
 
 		if (++i > 40) {
 			printk(" ...");
 			break;
 		}
 
-		if (i % 8 == 0)
+		if (i % 4 == 0)
 			printk("\n      ");
 	}
 }
 
-void show_trace(unsigned int *sp)
+void show_trace(unsigned long *sp)
 {
 	int i;
-	unsigned int *stack;
+	unsigned long *stack;
 	unsigned long kernel_start, kernel_end;
 	unsigned long module_start, module_end;
 	extern char _stext, _etext;
@@ -144,7 +143,11 @@
 		if ((addr >= kernel_start && addr < kernel_end) ||
 		    (addr >= module_start && addr < module_end)) { 
 
-			printk(" [<%08lx>]", addr);
+			/* Since our kernel is still at KSEG0,
+			 * truncate the address so that ksymoops
+			 * understands it.
+			 */
+			printk(" [<%08x>]", (unsigned int) addr);
 			if (++i > 40) {
 				printk(" ...");
 				break;
@@ -160,12 +163,12 @@
 	printk("\nCode:");
 
 	for(i = -3 ; i < 6 ; i++) {
-		unsigned long insn;
+		unsigned int insn;
 		if (__get_user(insn, pc + i)) {
 			printk(" (Bad address in epc)\n");
 			break;
 		}
-		printk("%c%08lx%c",(i?' ':'<'),insn,(i?' ':'>'));
+		printk("%c%08x%c",(i?' ':'<'),insn,(i?' ':'>'));
 	}
 }
 
@@ -180,10 +183,10 @@
 	spin_lock_irq(&die_lock);
 	printk("%s: %04lx\n", str, err & 0xffff);
 	show_regs(regs);
-	printk("Process %s (pid: %ld, stackpage=%08lx)\n",
+	printk("Process %s (pid: %d, stackpage=%08lx)\n",
 		current->comm, current->pid, (unsigned long) current);
-	show_stack((unsigned int *) regs->regs[29]);
-	show_trace((unsigned int *) regs->regs[29]);
+	show_stack((unsigned long *) regs->regs[29]);
+	show_trace((unsigned long *) regs->regs[29]);
 	show_code((unsigned int *) regs->cp0_epc);
 	printk("\n");
 	spin_unlock_irq(&die_lock);
@@ -230,6 +233,7 @@
 {
 	unsigned long pc;
 	unsigned int insn;
+	extern void simfp(unsigned int);
 
 #ifdef CONFIG_MIPS_FPE_MODULE
 	if (fpe_handler != NULL) {
@@ -237,7 +241,6 @@
 		return;
 	}
 #endif
-	lock_kernel();
 	if (fcr31 & 0x20000) {
 		/* Retry instruction with flush to zero ...  */
 		if (!(fcr31 & (1<<24))) {
@@ -249,7 +252,7 @@
 				"ctc1\t%0,$31"
 				: /* No outputs */
 				: "r" (fcr31));
-			goto out;
+			return;
 		}
 		pc = regs->cp0_epc + ((regs->cp0_cause & CAUSEF_BD) ? 4 : 0);
 		if (get_user(insn, (unsigned int *)pc)) {
@@ -263,12 +266,9 @@
 	}
 
 	if (compute_return_epc(regs))
-		goto out;
+		return;
 	//force_sig(SIGFPE, current);
 	printk(KERN_DEBUG "Should send SIGFPE to %s\n", current->comm);
-
-out:
-	unlock_kernel();
 }
 
 static inline int get_insn_opcode(struct pt_regs *regs, unsigned int *opcode)
@@ -327,11 +327,9 @@
 
 void do_ri(struct pt_regs *regs)
 {
-	lock_kernel();
-	printk("Cpu%d[%s:%ld] Illegal instruction at %08lx ra=%08lx\n",
+	printk("Cpu%d[%s:%d] Illegal instruction at %08lx ra=%08lx\n",
 	        smp_processor_id(), current->comm, current->pid, regs->cp0_epc, 
 		regs->regs[31]);
-	unlock_kernel();
 	if (compute_return_epc(regs))
 		return;
 	force_sig(SIGILL, current);
@@ -390,7 +388,7 @@
 	 * caused by a new unknown cpu type or after another deadly
 	 * hard/software error.
 	 */
-	panic("Caught reserved exception %d - should not happen.",
+	panic("Caught reserved exception %ld - should not happen.",
 	      (regs->cp0_cause & 0x1f) >> 2);
 }
 
@@ -471,8 +469,8 @@
 
 void __init trap_init(void)
 {
-	extern char __tlb_refill_debug_tramp;
-	extern char __xtlb_refill_debug_tramp;
+	extern char except_vec0;
+	extern char except_vec1_r10k;
 	extern char except_vec2_generic;
 	extern char except_vec3_generic, except_vec3_r4000;
 	extern void bus_error_init(void);
@@ -528,8 +526,8 @@
 	case CPU_NEVADA:
 r4k:
 		/* Debug TLB refill handler.  */
-		memcpy((void *)KSEG0, &__tlb_refill_debug_tramp, 0x80);
-		memcpy((void *)KSEG0 + 0x080, &__xtlb_refill_debug_tramp, 0x80);
+		memcpy((void *)KSEG0, &except_vec0, 0x80);
+		memcpy((void *)KSEG0 + 0x080, &except_vec1_r10k, 0x80);
 
 		/* Cache error vector  */
 		memcpy((void *)(KSEG0 + 0x100), (void *) KSEG0, 0x80);
@@ -542,9 +540,9 @@
 			       0x100);
 		}
 
-		set_except_vector(1, __xtlb_mod_debug);
-		set_except_vector(2, __xtlb_tlbl_debug);
-		set_except_vector(3, __xtlb_tlbs_debug);
+		set_except_vector(1, __xtlb_mod);
+		set_except_vector(2, __xtlb_tlbl);
+		set_except_vector(3, __xtlb_tlbs);
 		set_except_vector(4, handle_adel);
 		set_except_vector(5, handle_ades);
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)