From af24262ac5020eda9da14db3ab2e84f8297fd4a2 Mon Sep 17 00:00:00 2001 From: Claudio Fontana Date: Thu, 12 May 2016 15:00:59 +0200 Subject: [PATCH] core: lib: replace ARM memcpy implementation with generic version Remove the memcpy implementation from the ARM port, and add a generic version to the core library for all architectures. Signed-off-by: Claudio Fontana Signed-off-by: Antonios Motakis [antonios.motakis@huawei.com: removed all signs of weakness!] Signed-off-by: Jan Kiszka --- hypervisor/arch/arm/lib.c | 12 ------------ hypervisor/lib.c | 10 ++++++++++ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/hypervisor/arch/arm/lib.c b/hypervisor/arch/arm/lib.c index cf81117..038bf9a 100644 --- a/hypervisor/arch/arm/lib.c +++ b/hypervisor/arch/arm/lib.c @@ -22,15 +22,3 @@ unsigned long phys_processor_id(void) arm_read_sysreg(MPIDR_EL1, mpidr); return mpidr & MPIDR_CPUID_MASK; } - -void *memcpy(void *dest, const void *src, unsigned long n) -{ - unsigned long i; - const char *csrc = src; - char *cdest = dest; - - for (i = 0; i < n; i++) - cdest[i] = csrc[i]; - - return dest; -} diff --git a/hypervisor/lib.c b/hypervisor/lib.c index f2a27eb..fc9af7a 100644 --- a/hypervisor/lib.c +++ b/hypervisor/lib.c @@ -32,3 +32,13 @@ int strcmp(const char *s1, const char *s2) } return *(unsigned char *)s1 - *(unsigned char *)s2; } + +void *memcpy(void *dest, const void *src, unsigned long n) +{ + const u8 *s = src; + u8 *d = dest; + + while (n-- > 0) + *d++ = *s++; + return dest; +} -- 2.39.2