From owner-p4-projects@FreeBSD.ORG Mon Nov 5 00:05:29 2012 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 235D6A7E; Mon, 5 Nov 2012 00:05:29 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D7619A71 for ; Mon, 5 Nov 2012 00:05:28 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id A310C8FC08 for ; Mon, 5 Nov 2012 00:05:28 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id qA505Sf6066038 for ; Mon, 5 Nov 2012 00:05:28 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id qA505Sf5066035 for perforce@freebsd.org; Mon, 5 Nov 2012 00:05:28 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Mon, 5 Nov 2012 00:05:28 GMT Message-Id: <201211050005.qA505Sf5066035@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 219580 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, 05 Nov 2012 00:05:29 -0000 http://p4web.freebsd.org/@@219580?ac=10 Change 219580 by rwatson@rwatson_svr_ctsrd_mipsbuild on 2012/11/05 00:05:07 Trim the set of registers printed by "cheritest listregs" to omit kernel-reserved registers (which are no longer accessible), and add a new "overrun" command that intentionally exceeds the length of memory capability during a store operation. Also print out tag information for capabilities when listing them. Affected files ... .. //depot/projects/ctsrd/cheribsd/src/bin/cheritest/cheritest.c#4 edit Differences ... ==== //depot/projects/ctsrd/cheribsd/src/bin/cheritest/cheritest.c#4 (text+ko) ==== @@ -40,13 +40,21 @@ #include #define CHERI_CAPREG_PRINT(crn) do { \ - struct chericap c; \ + register_t c_tag; \ + register_t c_unsealed, c_perms, c_otype, c_base, c_length; \ + \ + CHERI_CGETTAG(c_tag, (crn)); \ + CHERI_CGETUNSEALED(c_unsealed, (crn)); \ + CHERI_CGETPERM(c_perms, (crn)); \ + CHERI_CGETBASE(c_base, (crn)); \ + CHERI_CGETTYPE(c_otype, (crn)); \ + CHERI_CGETLEN(c_length, (crn)); \ \ - CHERI_GETCAPREG((crn), c); \ - printf("C%u perms %04jx type %016jx\n", crn, \ - (uintmax_t)c.c_perms, (uintmax_t)c.c_otype); \ - printf("\tbase %016jx length %016jx\n", (uintmax_t)c.c_base, \ - (uintmax_t)c.c_length); \ + printf("C%u tag %u u %u perms %04jx type %016jx\n", crn, \ + (u_int)c_tag, (u_int)c_unsealed, \ + (uintmax_t)c_perms, (uintmax_t)c_otype); \ + printf("\tbase %016jx length %016jx\n", (uintmax_t)c_base, \ + (uintmax_t)c_length); \ } while (0) static void @@ -55,11 +63,26 @@ fprintf(stderr, "cheritest copyregs\n"); fprintf(stderr, "cheritest listregs\n"); + fprintf(stderr, "cheritest overrun\n"); fprintf(stderr, "cheritest sleep\n"); exit(EX_USAGE); } static void +cheritest_overrun(void) +{ + + /* Move a copy of $c0 into $c1. */ + CHERI_CMOVE(1, 0); + + /* Restrict segment length to 0. */ + CHERI_CSETLEN(1, 1, 0); + + /* Perform a byte store operation via $c1. */ + CHERI_CSB(0, 0, 0, 1); +} + +static void cheritest_copyregs(void) { @@ -108,11 +131,6 @@ CHERI_CAPREG_PRINT(24); CHERI_CAPREG_PRINT(25); CHERI_CAPREG_PRINT(26); - CHERI_CAPREG_PRINT(27); - CHERI_CAPREG_PRINT(28); - CHERI_CAPREG_PRINT(29); - CHERI_CAPREG_PRINT(30); - CHERI_CAPREG_PRINT(31); } int @@ -136,6 +154,8 @@ cheritest_listregs(); else if (strcmp(argv[0], "copyregs") == 0) cheritest_copyregs(); + else if (strcmp(argv[0], "overrun") == 0) + cheritest_overrun(); else if (strcmp(argv[0], "sleep") == 0) sleep(10); else