[CRIU] [PATCH 04/11] compel: plugins, std -- Implement generic std_memcpy

Cyrill Gorcunov gorcunov at openvz.org
Fri Nov 11 10:52:01 PST 2016


Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 compel/plugins/std/string.c | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/compel/plugins/std/string.c b/compel/plugins/std/string.c
index 6e5d42ed1ea7..e987e408ec8b 100644
--- a/compel/plugins/std/string.c
+++ b/compel/plugins/std/string.c
@@ -222,19 +222,11 @@ fin:
 
 void *std_memcpy(void *to, const void *from, unsigned int n)
 {
-	/* FIXME: Per-arch support */
-#if 0
-	int d0, d1, d2;
-	asm volatile("rep ; movsl		\n"
-		     "movl %4,%%ecx		\n"
-		     "andl $3,%%ecx		\n"
-		     "jz 1f			\n"
-		     "rep ; movsb		\n"
-		     "1:"
-		     : "=&c" (d0), "=&D" (d1), "=&S" (d2)
-		     : "0" (n / 4), "g" (n), "1" ((long)to), "2" ((long)from)
-		     : "memory");
-#endif
+	char *tmp = to;
+	const char *s = from;
+
+	while (n--)
+		*tmp++ = *s++;
 	return to;
 }
 
-- 
2.7.4



More information about the CRIU mailing list