patch-2.1.9 linux/arch/sparc/kernel/traps.c

Next file: linux/arch/sparc/kernel/unaligned.c
Previous file: linux/arch/sparc/kernel/trampoline.S
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.8/linux/arch/sparc/kernel/traps.c linux/arch/sparc/kernel/traps.c
@@ -1,4 +1,4 @@
-/* $Id: traps.c,v 1.43 1996/04/24 09:09:42 davem Exp $
+/* $Id: traps.c,v 1.47 1996/10/27 08:36:17 davem Exp $
  * arch/sparc/kernel/traps.c
  *
  * Copyright 1995 David S. Miller (davem@caip.rutgers.edu)
@@ -62,11 +62,20 @@
 	prom_halt();
 }
 
-void die_if_kernel(char *str, struct pt_regs *regs)
+void instruction_dump (unsigned long *pc)
 {
-	unsigned long i;
-	unsigned long *pc;
+	int i;
+	
+	if((((unsigned long) pc) & 3))
+                return;
+
+	for(i = -3; i < 6; i++)
+		printk("%c%08lx%c",i?' ':'<',pc[i],i?' ':'>');
+	printk("\n");
+}
 
+void die_if_kernel(char *str, struct pt_regs *regs)
+{
 	/* Amuse the user. */
 	printk(
 "              \\|/ ____ \\|/\n"
@@ -80,10 +89,7 @@
 	ap_panic();
 #endif
 	printk("Instruction DUMP:");
-	pc = (unsigned long *) regs->pc;
-	for(i = -3; i < 6; i++)
-		printk("%c%08lx%c",i?' ':'<',pc[i],i?' ':'>');
-	printk("\n");
+	instruction_dump ((unsigned long *) regs->pc);
 	if(regs->psr & PSR_PS)
 		do_exit(SIGKILL);
 	do_exit(SIGSEGV);
@@ -96,10 +102,15 @@
 		printk("Unimplemented Sparc TRAP, type = %02lx\n", type);
 		die_if_kernel("Whee... Hello Mr. Penguin", current->tss.kregs);
 	}	
+
 	if(type == SP_TRAP_SBPT) {
 		send_sig(SIGTRAP, current, 1);
 		return;
 	}
+
+	if(psr & PSR_PS)
+		die_if_kernel("Kernel bad trap", current->tss.kregs);
+
 	current->tss.sig_desc = SUBSIG_BADTRAP(type - 0x80);
 	current->tss.sig_address = pc;
 	send_sig(SIGILL, current, 1);
@@ -142,6 +153,11 @@
 	}
 	current->tss.sig_address = pc;
 	current->tss.sig_desc = SUBSIG_PRIVINST;
+#if 0
+	show_regs (regs);
+	instruction_dump ((unsigned long *) regs->pc);
+	printk ("do_MNA!\n");
+#endif
 	send_sig(SIGBUS, current, 1);
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov