PERFORCE change 219955 for review

Brooks Davis brooks at FreeBSD.org
Mon Jan 7 17:27:00 UTC 2013


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

Change 219955 by brooks at brooks_zenith on 2013/01/07 17:26:50

	Checkpoint a slightly less correct, but faster memcpy.  Still
	need to switch to David's version.

Affected files ...

.. //depot/projects/ctsrd/cheribsd/src/ctsrd/minifile/cheri/cmemcpy.h#2 edit

Differences ...

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

@@ -44,9 +44,20 @@
 static inline void
 memcpy_fromcap(void *dst, u_int creg, off_t off, size_t len)
 {
-	size_t count;
+	size_t count, remainder;
 	uint8_t *v;
 
+	/* XXX: assumes the memory in the capability is 8-byte aligned */
+	if (off & 0x7 == 0 && (intptr_t)dst & 0x7 == 0) {
+		remainder = len & 0x7;
+		len -= remainder;
+
+		for (v = dst, count = 0; (count * 8) < len; v += 8, count++)
+			CHERI_CLD(*v, off + (count * 8), 0, creg);
+		len = remainder;
+		off += count * 8;
+	}
+
 	for (v = dst, count = 0; count < len; v++, count++)
 		CHERI_CLB(*v, off + count, 0, creg);
 }


More information about the p4-projects mailing list