PERFORCE change 724674 for review

Robert Watson rwatson at FreeBSD.org
Mon Sep 16 07:54:34 UTC 2013


http://p4web.freebsd.org/@@724674?ac=10

Change 724674 by rwatson at rwatson_zenith_cl_cam_ac_uk on 2013/09/16 07:54:32

	In the CCall/CReturn exception-handler stub, use k1 rather than k0
	for the CCall/CReturn determination, which we will then leak to
	userspace to make debugging easier.  Add an XXXRW that we might want
	to clear them here (and in other exception handlers) in the future.
	Letting code know you just returned from CCall/CReturn is not really
	a problem, however.
	
	Shift the capability cause register before testing its value;
	although neither CCall nor CReturn exceptions are triggered by a
	specific register, there appears to be garbage in the field.  This
	is fine(ish): we should have been shifting, but undefined bits are
	also undesirable here.
	
	The CCall/CReturn NOP implementations now appear to correspond to
	the instruction used to trigger the exception.

Affected files ...

.. //depot/projects/ctsrd/cheribsd/src/sys/mips/cheri/ccall.S#5 edit

Differences ...

==== //depot/projects/ctsrd/cheribsd/src/sys/mips/cheri/ccall.S#5 (text+ko) ====

@@ -72,10 +72,14 @@
 	 * XXXRW: Panic if CGetCause returns something other than CALL/RETURN.
 	 *
 	 * XXXRW: Panic if not entering from userspace.
+	 *
+	 * XXXRW: Should we be clearing $k0 and $k1 before returning to
+	 * userspace?  Should other exception handlers be doing it?
 	 */
-	CGetCause	k0
-	andi		k0, k0, 0x1	/* CALL is odd; RETURN is even. */
-	beqz		k0, CReturn_label
+	CGetCause	k1
+	REG_SRL		k1, 8
+	andi		k1, k1, 0x1	/* CALL is odd; RETURN is even. */
+	beqz		k1, CReturn_label
 	nop		/* Branch-delay slot. */
 
 	j		CHERICCall


More information about the p4-projects mailing list