PERFORCE change 94828 for review

Kip Macy kmacy at FreeBSD.org
Sun Apr 9 00:32:50 UTC 2006


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

Change 94828 by kmacy at kmacy_storage:sun4v_rwbuf on 2006/04/09 00:31:52

	save the pil the intr interrupted
	track resumable and non-resumable errors
	track the trap type in reserved traps

Affected files ...

.. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/exception.S#41 edit

Differences ...

==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/exception.S#41 (text+ko) ====

@@ -34,6 +34,7 @@
 
 #include "opt_compat.h"
 #include "opt_ddb.h"
+#include "opt_simulator.h"
 
 #include <machine/asi.h>
 #include <machine/asmacros.h>
@@ -211,7 +212,7 @@
 	.endm
 
 	.macro	tl0_setup	type
-	clr	%g3
+	rdpr	%tt, %g3
 	sub	%g0, 1, %g4
 	set	trap, %g1
 	ba	%xcc, tl0_trap
@@ -233,11 +234,7 @@
 
 	.macro	tl0_reserved	count
 	.rept	\count
-#if 0
 	tl0_gen	T_RESERVED
-#else
-	MAGIC_TRAP_ON;MAGIC_TRAP_ON;MAGIC_EXIT
-#endif
 	.align	32
 	.endr
 	.endm
@@ -272,9 +269,7 @@
 	.endm
 
 	.macro	insn_excptn
-	MAGIC_TRAP_ON
-	MAGIC_TRAP_ON
-	MAGIC_TRAP_ON;MAGIC_TRAP_ON;MAGIC_EXIT
+	tl0_gen	T_RESERVED
 	.align	32
 	.endm
 
@@ -291,8 +286,13 @@
 	.endm
 	
 	.macro	data_excptn
-	MAGIC_TRAP_ON
-	MAGIC_TRAP_ON;MAGIC_TRAP_ON;MAGIC_EXIT
+	GET_MMFSA_SCRATCH(%g1)			
+	mov	MMFSA_D_ADDR, %g2
+	ldxa	[%g1 + %g2]ASI_REAL, %g3
+	sub	%g0, 1, %g4
+	set	trap, %g1
+	ba	%xcc, tl0_trap 
+	  mov	T_DATA_EXCEPTION, %g2
 	.align	32
 	.endm
 
@@ -319,7 +319,15 @@
 	.endm
 
 	.macro	tl0_align
-	MAGIC_TRAP_ON;MAGIC_TRAP_ON;MAGIC_EXIT
+	tl0_gen	T_RESERVED
+#if 0
+	GET_MMFSA_SCRATCH(%g1)		
+	mov	MMFSA_D_ADDR, %g3
+	mov	MMFSA_D_CTX,  %g7
+	ldxa	[%g1 + %g3]ASI_REAL, %g5
+	ba,pt	%xcc, tsb_miss_handler
+	  mov   T_DATA_PROTECTION, %g3
+#endif
 	.align	32
 	.endm
 	
@@ -334,14 +342,20 @@
 	.endm
 
 	.macro	resumable_error
-	MAGIC_TRAP_ON
-	MAGIC_EXIT
+	clr	%g3
+	sub	%g0, 1, %g4
+	set	trap, %g1
+	ba	%xcc, tl0_trap
+	  mov	T_RESUMABLE_ERROR, %g2
 	.align	32
 	.endm
 
 	.macro	nonresumable_error
-	MAGIC_TRAP_ON
-	MAGIC_EXIT
+	clr	%g3
+	sub	%g0, 1, %g4
+	set	trap, %g1
+	ba	%xcc, tl0_trap
+	  mov	T_NONRESUMABLE_ERROR, %g2
 	.align	32
 	.endm
 
@@ -493,7 +507,6 @@
 	ba,a,pt %xcc, fault_64bit_so1
 	  nop
 	.align 128
-
 	.endm
 
 	.macro	spill_mixed
@@ -509,9 +522,7 @@
 	.endm
 
 	.macro	tl1_align
-	MAGIC_TRAP_ON
-	MAGIC_TRAP_ON
-	MAGIC_EXIT
+	ba,a,pt	%xcc, tl1_trap
 	.align	32
 	.endm		
 		
@@ -1071,7 +1082,6 @@
 	wrpr	%g0, %g1, %cleanwin
 	rdpr	%cwp, %g1
 	wrpr	%g1, %g6, %tstate
-!	MAGIC_TRAP_ON
 	retry
 END(user_rtt)
 END(utl0)		
@@ -1122,7 +1132,6 @@
 	wrpr	%g0, %l0, %pil
 #endif
 	GET_PCPU_SCRATCH
-	/* simulator incorrectly exits if tl != gl */
 	ldx	[PCPU(CURTHREAD)], %l0
 	ldx	[%l0 + TD_MD + MD_SAVED_PIL], %l0
 	wrpr	%g0, %l0, %pil
@@ -1166,7 +1175,7 @@
 	GET_PCPU_SCRATCH
         set     ktl0, %g6
 	save	%sp, -(CCFSZ + TF_SIZEOF), %sp
-
+	
 	or	%g2, T_KERNEL, %g2	
 		
 	! if the kwbuf is full we need to save to the stack now
@@ -1186,13 +1195,14 @@
 	! %g2=level %g1=mask
 	
 ENTRY(tl0_intr)
-	wrpr	%g4, 0, %pil
 	wr	%g1, 0, %clear_softint
 	SET(intr_handlers, %g7, %g6)
 	sllx	%g4, IH_SHIFT, %g7
 	ldx	[%g6 + %g7], %g1	! pointer to interrupt handler
-	
-			
+	rdpr	%pil, %g5	! interrupted pil
+	wrpr	%g4, 0, %pil
+	mov	%g5, %g4
+				
 	! %g1		pc of trap handler
 	! %g2, %g3	args of trap handler
 	! %g4		desired pil
@@ -1284,6 +1294,7 @@
 	wrpr	%g0, %g4, %pil
 1:		
 	wrpr	%g0, %g6, %tnpc
+	MAGIC_TRAP_OFF
 	rdpr	%cwp, %l0
 	set	TSTATE_KERNEL, %l1
 	wrpr	%l1, %l0, %tstate
@@ -1328,7 +1339,6 @@
 	ba,pt	%xcc, 4f
 	  nop
 2:
-!	MAGIC_TRAP_ON
 	cmp	%g6, %g0			! kernel?
 	be,pn	%xcc, 3f
 	  nop
@@ -1348,13 +1358,6 @@
 
 	! %g4 == fault type %g5 == fault addr %g6 == tag
 	! XXX only handle normal miss for now (look at fault type in the future)
-#ifdef PMAP_DEBUG
-	cmp	%g3, T_INSTRUCTION_MISS
-	bne,pn	%xcc, 17f
-	  nop
-!	MAGIC_TRAP_ON				! enable debugging for instruction misses
-17:
-#endif
 	
 tsb_miss_compute_hash_addr:
 	sethi	%hi(PAGE_SIZE), %g7


More information about the p4-projects mailing list