From owner-p4-projects@FreeBSD.ORG Thu Dec 13 21:27:09 2012 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 63F856E0; Thu, 13 Dec 2012 21:27:09 +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 1FC166DE for ; Thu, 13 Dec 2012 21:27:09 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id 03E778FC0A for ; Thu, 13 Dec 2012 21:27:09 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.5/8.14.5) with ESMTP id qBDLR8Do063269 for ; Thu, 13 Dec 2012 21:27:08 GMT (envelope-from brooks@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.5/8.14.5/Submit) id qBDLR8xu063266 for perforce@freebsd.org; Thu, 13 Dec 2012 21:27:08 GMT (envelope-from brooks@freebsd.org) Date: Thu, 13 Dec 2012 21:27:08 GMT Message-Id: <201212132127.qBDLR8xu063266@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to brooks@freebsd.org using -f From: Brooks Davis Subject: PERFORCE change 219905 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: Thu, 13 Dec 2012 21:27:09 -0000 http://p4web.freebsd.org/@@219905?ac=10 Change 219905 by brooks@brooks_zenith on 2012/12/13 21:26:30 Reuse the CHERI sandbox rather than invoking a new one each time. Affected files ... .. //depot/projects/ctsrd/cheribsd/src/ctsrd-lib/libimagebox/pngbox.c#9 edit Differences ... ==== //depot/projects/ctsrd/cheribsd/src/ctsrd-lib/libimagebox/pngbox.c#9 (text+ko) ==== @@ -225,7 +225,7 @@ cheri_png_read_start(char *pngbuffer, size_t pnglen, uint32_t width, uint32_t height, enum sbtype sb) { - struct sandbox *sandbox; + static struct sandbox *sandbox = NULL; struct iboxstate *is = NULL; register_t v; @@ -244,17 +244,11 @@ if (ibox_verbose) sb_verbose = ibox_verbose; - if (sandbox_setup("/usr/libexec/readpng-cheri.bin", 4*1024*1024, - &sandbox) < 0) - goto error; + if (sandbox == NULL) + if (sandbox_setup("/usr/libexec/readpng-cheri.bin", 4*1024*1024, + &sandbox) < 0) + goto error; -#if 0 - CHERI_CINCBASE(10, 0, is); - CHERI_CSETLEN(10, 10, sizeof(*is)); - CHERI_CANDPERM(10, 10, CHERI_PERM_LOAD|CHERI_PERM_STORE); - CHERI_CSC(10, 0, &c1, 0); -#endif - CHERI_CINCBASE(10, 0, is->buffer); CHERI_CSETLEN(10, 10, is->width * is->height * sizeof(uint32_t)); CHERI_CANDPERM(10, 10, CHERI_PERM_STORE); @@ -269,7 +263,6 @@ &c1, &c2, NULL, NULL, NULL, NULL, NULL); if (ibox_verbose) printf("%s: sandbox returned %ju\n", __func__, (uintmax_t)v); - sandbox_destroy(sandbox); is->valid_rows = height; is->passes_remaining = 0; return (is);