coreboot-kgpe-d16/src/arch/x86/memcpy.c
Patrick Georgi 11f0079c5a src/arch/x86: Convert to SPDX license header
This also drops individual copyright notices, all mentioned authors in
that part of the tree are listed in AUTHORS.

Change-Id: Ib5a92bb46ff2b9d2928aae3763daec71747044c2
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/39284
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr>
2020-03-06 07:48:24 +00:00

25 lines
472 B
C

/* SPDX-License-Identifier: GPL-2.0-only */
/* This file is part of the coreboot project. */
#include <string.h>
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"
#else
"rep ; movsl\n\t"
"movl %4,%%ecx\n\t"
#endif
"rep ; movsb\n\t"
: "=&c" (d0), "=&D" (d1), "=&S" (d2)
: "0" (n >> 2), "g" (n & 3), "1" (dest), "2" (src)
: "memory"
);
return dest;
}