x86/string: Clean up x86/string.h

* None of the GCC docs mention memmove() in its list of builtins even today,
   but 4.1 does have the builtin, meaning that all currently supported
   compilers have it.
 * Consistently use Xen style, matching the common code, and introduce symbol
   definitions for function pointer use.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <JBeulich@suse.com>
This commit is contained in:
Andrew Cooper committed 2017-05-31 14:05:25 +01:00
1 parent b9088aa7e8
commit 78825e1c60
2 files changed
+18 -11

No files matched your search

+4 -7
View File
@@ -1,14 +1,13 @@
/******************************************************************************
* string.c
*
*
* These provide something for compiler-emitted string operations to link
* against.
*/
#include <xen/lib.h>
#undef memcpy
void *memcpy(void *dest, const void *src, size_t n)
void *(memcpy)(void *dest, const void *src, size_t n)
{
long d0, d1, d2;
@@ -23,8 +22,7 @@ void *memcpy(void *dest, const void *src, size_t n)
return dest;
}
#undef memset
void *memset(void *s, int c, size_t n)
void *(memset)(void *s, int c, size_t n)
{
long d0, d1;
@@ -37,8 +35,7 @@ void *memset(void *s, int c, size_t n)
return s;
}
#undef memmove
void *memmove(void *dest, const void *src, size_t n)
void *(memmove)(void *dest, const void *src, size_t n)
{
long d0, d1, d2;
+14 -4
View File
@@ -2,13 +2,23 @@
#define __X86_STRING_H__
#define __HAVE_ARCH_MEMCPY
#define memcpy(t,f,n) (__builtin_memcpy((t),(f),(n)))
void *memcpy(void *dest, const void *src, size_t n);
#define memcpy(d, s, n) __builtin_memcpy(d, s, n)
/* Some versions of gcc don't have this builtin. It's non-critical anyway. */
#define __HAVE_ARCH_MEMMOVE
extern void *memmove(void *dest, const void *src, size_t n);
void *memmove(void *dest, const void *src, size_t n);
#define memmove(d, s, n) __builtin_memmove(d, s, n)
#define __HAVE_ARCH_MEMSET
#define memset(s,c,n) (__builtin_memset((s),(c),(n)))
void *memset(void *dest, int c, size_t n);
#define memset(s, c, n) __builtin_memset(s, c, n)
#endif /* __X86_STRING_H__ */
/*
* Local variables:
* mode: C
* c-file-style: "BSD"
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*/
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.