Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Dec 2012 21:27:08 GMT
From:      Brooks Davis <brooks@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 219905 for review
Message-ID:  <201212132127.qBDLR8xu063266@skunkworks.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201212132127.qBDLR8xu063266>