PERFORCE change 97528 for review

Kip Macy kmacy at FreeBSD.org
Sat May 20 19:14:24 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=97528

Change 97528 by kmacy at kmacy_storage:sun4v_rwbuf on 2006/05/20 19:12:50

	minor updates for new traps
	and some added debug output

Affected files ...

.. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/trap.c#9 edit

Differences ...

==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/trap.c#9 (text+ko) ====

@@ -170,6 +170,8 @@
 	"restore physical watchpoint",
 	"restore virtual watchpoint",
 	"kernel stack fault",
+	"resumable error",
+	"nonresumable error"
 };
 
 const int trap_sig[] = {
@@ -207,7 +209,8 @@
 	SIGILL,			/* trap instruction 29 */
 	SIGILL,			/* trap instruction 30 */
 	SIGILL,			/* trap instruction 31 */
-	SIGSEGV,		/* fast instruction access mmu miss */
+	SIGSEGV,		/* floating point not implemented */
+                                /* should be SIGFPE but other signals currently cause problems */
 	SIGSEGV,		/* fast data access mmu miss */
 	-1,			/* interrupt */
 	-1,			/* physical address watchpoint */
@@ -245,12 +248,14 @@
 	set_wstate(WSTATE_KERN);
 	set_mmfsa_scratchpad(mmfsa);
 
+	init_mondo_queue();
 	OF_set_mmfsa_traptable(&tl0_base, mmfsa);
 	for (i = 0; i < 128; i++)
 		trap_conversion[i] = i;
 	for (i = 128; i < 256; i++)
 		trap_conversion[i] = 0;
 	trap_conversion[0x31] = 35;
+	trap_conversion[0x34] = 15;
 	trap_conversion[0x9] = 34;
 	trap_conversion[0x6c] = 14;
 
@@ -263,6 +268,7 @@
 	struct proc *p;
 	int error;
 	int sig;
+	register_t addr;
 	ksiginfo_t ksi;
 
 	td = PCPU_GET(curthread);
@@ -280,12 +286,14 @@
 		p = td->td_proc;
 		td->td_pticks = 0;
 		td->td_frame = tf;
+		addr = tf->tf_tpc;
 		if (td->td_ucred != p->p_ucred)
 			cred_update_thread(td);
 
 		switch (type) {
 		case T_DATA_MISS:
 		case T_DATA_PROTECTION:
+			addr = TLB_TAR_VA(data);
 		case T_INSTRUCTION_MISS:
 			sig = trap_pfault(td, tf, type, data);
 			break;
@@ -315,11 +323,17 @@
 			if (debugger_on_signal &&
 			    (sig == 4 || sig == 10 || sig == 11))
 				kdb_enter("trapsig");
+			if (sig == 4 || sig == 10 || sig == 11)
+				printf("trap: %ld:%s: 0x%lx at 0x%lx on cpu=%d sig=%d\n", type, 
+				       trap_msg[trap_conversion[type]], data, tf->tf_tpc, curcpu, sig);
+			/* XXX I've renumbered the traps to largely reflect what the hardware uses
+			 * so this will need to be re-visited
+			 */
 			ksiginfo_init_trap(&ksi);
 			ksi.ksi_signo = sig;
-			ksi.ksi_code = (int)type; /* XXX not POSIX */
-			/* ksi.ksi_addr = ? */
-			ksi.ksi_trapno = (int)type;
+			ksi.ksi_code = (int)trap_conversion[type]; /* XXX not POSIX */
+			ksi.ksi_addr = (void *)addr;
+			ksi.ksi_trapno = (int)trap_conversion[type];
 			trapsignal(td, &ksi);
 		}
 
@@ -350,6 +364,10 @@
 			error = trap_pfault(td, tf, type, data);
 			break;
 		case T_DATA_EXCEPTION:
+			printf("data exception on 0x%lx at 0x%lx\n", data, tf->tf_tpc);
+			printf("trap: %ld=%s: 0x%lx at 0x%lx:0x%lx\n", type & ~T_KERNEL, trap_msg[trap_conversion[type & ~T_KERNEL]], data, tf->tf_tpc, tf->tf_tnpc);
+			error = 1;
+			break;
 		case T_MEM_ADDRESS_NOT_ALIGNED:
 #ifdef notyet
 			if ((tf->tf_sfsr & MMU_SFSR_FV) != 0 &&
@@ -388,7 +406,7 @@
 		}
 
 		if (error != 0)
-			panic("trap: %s at 0x%lx", trap_msg[trap_conversion[type & ~T_KERNEL]], tf->tf_tpc);
+			panic("trap: %ld=%s: 0x%lx at 0x%lx:0x%lx error=%d", type & ~T_KERNEL, trap_msg[trap_conversion[type & ~T_KERNEL]], data, tf->tf_tpc, tf->tf_tnpc, error);
 	}
 	CTR1(KTR_TRAP, "trap: td=%p return", td);
 }


More information about the p4-projects mailing list