PERFORCE change 999118 for review

Robert Watson rwatson at FreeBSD.org
Mon Oct 7 22:21:25 UTC 2013


http://p4web.freebsd.org/@@999118?ac=10

Change 999118 by rwatson at rwatson_zenith_cl_cam_ac_uk on 2013/10/07 22:20:34

	Updates to various sandboxed CHERI demonstration elements to bump
	up capability register numbers by 2 to move from $c1... to $c3...
	reflecting ABI changes in the migration to CCall/CReturn and the
	new version of the sandbox_invoke() API.

Affected files ...

.. //depot/projects/ctsrd/cheribsd/src/ctsrd-lib/libimagebox/pngbox.c#11 edit
.. //depot/projects/ctsrd/cheribsd/src/ctsrd/libexec/readpng-cheri/readpng-cheri.c#8 edit
.. //depot/projects/ctsrd/cheribsd/src/ctsrd/minifile/minifile.c#9 edit
.. //depot/projects/ctsrd/cheribsd/src/ctsrd/minifile/minifile.h#5 edit

Differences ...

==== //depot/projects/ctsrd/cheribsd/src/ctsrd-lib/libimagebox/pngbox.c#11 (text+ko) ====

@@ -224,7 +224,7 @@
 /*
  * XXX: rwatson reports that capabilities end up misaligned on the stack.
  */
-static struct chericap c1, c2, c3;
+static struct chericap c3, c4, c5;
 
 static struct iboxstate*
 cheri_png_read_start(char *pngbuffer, size_t pnglen,
@@ -258,20 +258,20 @@
         CHERI_CINCBASE(10, 0, is->buffer);
         CHERI_CSETLEN(10, 10, is->width * is->height * sizeof(uint32_t));
         CHERI_CANDPERM(10, 10, CHERI_PERM_STORE);
-        CHERI_CSC(10, 0, &c1, 0);
+        CHERI_CSC(10, 0, &c3, 0);
 
         CHERI_CINCBASE(10, 0, pngbuffer);
         CHERI_CSETLEN(10, 10, pnglen);
         CHERI_CANDPERM(10, 10, CHERI_PERM_LOAD);
-        CHERI_CSC(10, 0, &c2, 0);
+        CHERI_CSC(10, 0, &c4, 0);
 
         CHERI_CINCBASE(10, 0, is->times + 1);
         CHERI_CSETLEN(10, 10, sizeof(uint32_t) * 2);
         CHERI_CANDPERM(10, 10, CHERI_PERM_STORE);
-        CHERI_CSC(10, 0, &c3, 0);
+        CHERI_CSC(10, 0, &c5, 0);
 
         v = sandbox_invoke(sandbox, width, height, pnglen, 0,
-            &c1, &c2, &c3, NULL, NULL, NULL, NULL);
+            &c3, &c4, &c5, NULL, NULL, NULL, NULL, NULL);
 	if (ibox_verbose)
 		printf("%s: sandbox returned %ju\n", __func__, (uintmax_t)v);
 	is->valid_rows = height;

==== //depot/projects/ctsrd/cheribsd/src/ctsrd/libexec/readpng-cheri/readpng-cheri.c#8 (text+ko) ====

@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2012 Robert N. M. Watson
+ * Copyright (c) 2012-2013 Robert N. M. Watson
  * Copyright (c) 2012 SRI International
  * All rights reserved.
  *
@@ -53,7 +53,7 @@
 	struct ibox_decode_state *ids;
 
 	ids = png_get_io_ptr(png_ptr);
-	memcpy_fromcap(data, 2, ids->offset, length);
+	memcpy_fromcap(data, 4, ids->offset, length);
 	ids->offset += length;
 }
 
@@ -66,7 +66,7 @@
 
 	ids = png_get_io_ptr(png_ptr);
 
-	memcpy_tocap(1, ids->buffer + (pngwidth * (row - 1)),
+	memcpy_tocap(3, ids->buffer + (pngwidth * (row - 1)),
 	    sizeof(uint32_t) * pngwidth * (row - 1),
 	    sizeof(uint32_t) * pngwidth);
 #endif
@@ -107,9 +107,9 @@
 
 	/* Copy the whole image out */
 	if (is.error == 0)
-		memcpy_tocap(1, ids.buffer, 0, sizeof(uint32_t) * a0 * a1);
+		memcpy_tocap(3, ids.buffer, 0, sizeof(uint32_t) * a0 * a1);
 
-	memcpy_tocap(3, is.times + 1, 0, sizeof(uint32_t) * 2);
+	memcpy_tocap(5, is.times + 1, 0, sizeof(uint32_t) * 2);
 
 	return (is.error);
 }

==== //depot/projects/ctsrd/cheribsd/src/ctsrd/minifile/minifile.c#9 (text+ko) ====

@@ -254,7 +254,8 @@
 		preinvoke = sysarch(MIPS_GET_COUNT, NULL);
 
 	v = sandbox_invoke(sandbox, outsize, magicsize, filesize, dotimings,
-	    &out_cap, &magic_cap, &file_cap, &timing_cap, NULL, NULL, NULL);
+	    &out_cap, &magic_cap, &file_cap, &timing_cap, NULL, NULL, NULL,
+	    NULL);
 
 	if (dotimings)
 		postinvoke = sysarch(MIPS_GET_COUNT, NULL);

==== //depot/projects/ctsrd/cheribsd/src/ctsrd/minifile/minifile.h#5 (text+ko) ====

@@ -35,10 +35,10 @@
 #define	MINIFILE_MAGIC_FD	4
 #define	MINIFILE_OUT_FD		5
 
-#define	MINIFILE_OUT_CAP	1
-#define	MINIFILE_MAGIC_CAP	2
-#define	MINIFILE_FILE_CAP	3
-#define	MINIFILE_TIMING_CAP	4
+#define	MINIFILE_OUT_CAP	3
+#define	MINIFILE_MAGIC_CAP	4
+#define	MINIFILE_FILE_CAP	5
+#define	MINIFILE_TIMING_CAP	6
 
 #define	MINIFILE_BUF_MAX	4096
 


More information about the p4-projects mailing list