[coreboot-gerrit] New patch to review for coreboot: x86: make memcpy 64bit safe

Stefan Reinauer (stefan.reinauer@coreboot.org) gerrit at coreboot.org
Thu Jun 18 10:24:40 CEST 2015

Stefan Reinauer (stefan.reinauer at coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10575


commit 7ca2837203fa1184219307de4b280f116d5bcdda
Author: Stefan Reinauer <stefan.reinauer at coreboot.org>
Date:   Wed Jun 17 16:09:10 2015 -0700

    x86: make memcpy 64bit safe
    This does not optimize memcpy for 64bit, it merely makes it compile.
    Change-Id: I69ad6bd0c3d5f617d9222643abf7a2ba7c2a0359
    Signed-off-by: Stefan Reinauer <stefan.reinauer at coreboot.org>
    Signed-off-by: Scott Duplichan <scott at notabs.org>
 src/arch/x86/lib/memcpy.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/arch/x86/lib/memcpy.c b/src/arch/x86/lib/memcpy.c
index 7f079ce..4915a9e 100644
--- a/src/arch/x86/lib/memcpy.c
+++ b/src/arch/x86/lib/memcpy.c
@@ -5,8 +5,13 @@ void *memcpy(void *dest, const void *src, size_t n)
 	unsigned long d0, d1, d2;
 	asm volatile(
+#ifdef __x86_64__
+		"rep ; movsd\n\t"
+		"mov %4,%%rcx\n\t"
 		"rep ; movsl\n\t"
 		"movl %4,%%ecx\n\t"
 		"rep ; movsb\n\t"
 		: "=&c" (d0), "=&D" (d1), "=&S" (d2)
 		: "0" (n >> 2), "g" (n & 3), "1" (dest), "2" (src)

More information about the coreboot-gerrit mailing list