From owner-p4-projects@FreeBSD.ORG Mon Sep 16 07:54:34 2013 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7FB8EA31; Mon, 16 Sep 2013 07:54:34 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 2FECAA2F for ; Mon, 16 Sep 2013 07:54:34 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [8.8.178.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1AB89249D for ; Mon, 16 Sep 2013 07:54:34 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.7/8.14.7) with ESMTP id r8G7sX9x080273 for ; Mon, 16 Sep 2013 07:54:33 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.7/8.14.6/Submit) id r8G7sX0g080270 for perforce@freebsd.org; Mon, 16 Sep 2013 07:54:33 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Mon, 16 Sep 2013 07:54:33 GMT Message-Id: <201309160754.r8G7sX0g080270@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson Subject: PERFORCE change 724674 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Sep 2013 07:54:34 -0000 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