Date: Mon, 16 Sep 2013 07:54:33 GMT From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 724674 for review Message-ID: <201309160754.r8G7sX0g080270@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@724674?ac=10 Change 724674 by rwatson@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201309160754.r8G7sX0g080270>