PERFORCE change 93168 for review

Kip Macy kmacy at FreeBSD.org
Sat Mar 11 21:30:54 GMT 2006


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

Change 93168 by kmacy at kmacy_storage:sun4v_work on 2006/03/11 21:30:20

	pass explicit trap type to tsb miss handler

Affected files ...

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

Differences ...

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

@@ -276,7 +276,7 @@
 	ldxa	[%g1 + %g2]ASI_REAL, %g4
 	ldxa	[%g1 + %g3]ASI_REAL, %g5
 	ba,pt	%xcc, tsb_miss_handler
-          mov   VTD_REF, %g3
+          mov   T_INSTRUCTION_MISS, %g3
 	.align	32
 	.endm
 	
@@ -294,7 +294,7 @@
 	ldxa	[%g1 + %g2]ASI_REAL, %g4
 	ldxa	[%g1 + %g3]ASI_REAL, %g5
 	ba,pt	%xcc, tsb_miss_handler
-          mov   VTD_REF, %g3
+          mov   T_DATA_MISS, %g3
 	.align	32
 	.endm
 
@@ -304,7 +304,7 @@
 	mov	MMFSA_D_CTX,  %g7
 	ldxa	[%g1 + %g3]ASI_REAL, %g5
 	ba,pt	%xcc, tsb_miss_handler
-	  mov   VTD_W, %g3
+	  mov   T_DATA_PROTECTION, %g3
 	.align	32
 	.endm
 
@@ -1399,9 +1399,9 @@
 #endif
 16:	
 #endif
+	mov	%g3, %g2			! save fault type
 	srlx    %g6, TTARGET_CTX_SHIFT, %g4	! recover context
         sethi	%hi(trap), %g1
-	mov	T_DATA_MISS, %g2
 	or	%g4, %g7, %g3
 	mov	-1, %g4
 	ba	%xcc, tl0_trap
@@ -1418,18 +1418,22 @@
 	sethi	%hi(PAGE_SIZE), %g7
 	sub	%g7, 1, %g7				! %g7==PAGE_MASK
 
-	andcc	%g5, %g3, %g0			! already set
-	bnz,pt	%xcc, 7f
+	cmp	%g3, T_DATA_MISS		! TSB data miss
+	be,pt	%xcc, 6f
+	  or	%g5, VTD_REF, %g5		! set referenced unconditionally
+	cmp	%g3, T_INSTRUCTION_MISS		! TSB instruction miss
+	be,pt	%xcc, 6f
+	  nop
+	cmp	%g3, T_DATA_PROTECTION		! protection fault
+	bne,pn	%xcc, unsupported_fault_trap	! we don't handle any other fault types currently
 	  nop
-	andcc	%g3, VTD_REF, %g0			! TSB miss
-	bnz,pt	%xcc, 6f
-	  or    %g5, %g3, %g5			! add ref/mod bit unconditionally  
 	andcc	%g5, VTD_SW_W, %g0		! write enabled?
 	bz,pn	%xcc, prot_fault_trap		! write to read only page
-	  or    %g5, %g3, %g5			! add ref/mod bit unconditionally  
+	  nop
+	or	%g5, VTD_W, %g5			! add modifed bit 
 6:		
-	stx	%g5, [%g2 + 8]			! set ref/mod bit
-7:
+	stx	%g5, [%g2 + 8]			! update TTE
+
 	andcc	%g6, %g7, %g0			! kernel context?
 	bz,pn	%xcc, 8f
 	  nop
@@ -1465,7 +1469,7 @@
 	! XXX the following intstruction should be replaced with a
 	! retry on HVs that do auto-demap
 ontario_demap_errata_patch:
-	andcc	%g5, VTD_W, %g0
+	andcc	%g5, VTD_W, %g0			! if write-enabled we know it was a prot fault
 	bnz,pn	%xcc, demap_begin
 	  nop
 	retry
@@ -1494,6 +1498,12 @@
 ENTRY(prot_fault_trap)	
 	MAGIC_TRAP_ON;MAGIC_TRAP_ON;MAGIC_EXIT
 END(prot_fault_trap)
+/*
+ * Programming error
+ */
+ENTRY(unsupported_fault_trap)	
+	MAGIC_TRAP_ON;MAGIC_TRAP_ON;MAGIC_EXIT
+END(unsupported_fault_trap)
 
 
 /*


More information about the p4-projects mailing list