From: Andrew Cooper Date: Mon, 21 Mar 2016 14:51:17 +0000 (+0000) Subject: Add memcpy() to the framework's libc implementation X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=4f047d87a0caf17f633cc769a1b9ab3aa502d011;p=people%2Froyger%2Fxen-test-framework.git Add memcpy() to the framework's libc implementation Signed-off-by: Andrew Cooper --- diff --git a/common/libc/string.c b/common/libc/string.c index 59e087f..b134b6c 100644 --- a/common/libc/string.c +++ b/common/libc/string.c @@ -30,6 +30,17 @@ void *memset(void *s, int c, size_t n) return s; } +void *memcpy(void *_d, const void *_s, size_t n) +{ + char *d = _d; + const char *s = _s; + + for ( ; n; --n ) + *d++ = *s++; + + return _d; +} + int memcmp(const void *s1, const void *s2, size_t n) { const unsigned char *u1 = s1, *u2 = s2; diff --git a/include/xtf/libc.h b/include/xtf/libc.h index dc9256a..65ea6c8 100644 --- a/include/xtf/libc.h +++ b/include/xtf/libc.h @@ -15,11 +15,13 @@ #define strlen(s) __builtin_strlen(s) #define memset(d, c, n) __builtin_memset(d, c, n) +#define memcpy(d, s, n) __builtin_memcpy(d, s, n) #define memcmp(s1, s2, n) __builtin_memcmp(s1, s2, n) size_t strlen(const char *str); size_t strnlen(const char *str, size_t max); void *memset(void *s, int c, size_t n); +void *memcpy(void *dst, const void *src, size_t n); int memcmp(const void *s1, const void *s2, size_t n); int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);