mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
lib: move memset()
By moving the function into an archive, x86 doesn't need to announce anymore that is has its own implementation - symbol resolution by the linker will now guarantee that the generic function remains unused, and the forwarding to the compiler built-in gets done by the common header anyway. Allow the function to be individually linkable, discardable, and overridable. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Julien Grall <jgrall@amazon.com>
This commit is contained in:
1 parent
540d911c28
commit
8bd9c8d503
4 files changed
+34
-23
No files matched your search
@@ -311,26 +311,6 @@ char *(strstr)(const char *s1, const char *s2)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_MEMSET
|
||||
/**
|
||||
* memset - Fill a region of memory with the given value
|
||||
* @s: Pointer to the start of the area.
|
||||
* @c: The byte to fill the area with
|
||||
* @count: The size of the area.
|
||||
*
|
||||
* Do not use memset() to access IO space, use memset_io() instead.
|
||||
*/
|
||||
void *(memset)(void *s, int c, size_t count)
|
||||
{
|
||||
char *xs = (char *) s;
|
||||
|
||||
while (count--)
|
||||
*xs++ = c;
|
||||
|
||||
return s;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_MEMCPY
|
||||
/**
|
||||
* memcpy - Copy one area of memory to another
|
||||
|
||||
@@ -7,9 +7,6 @@
|
||||
#define __HAVE_ARCH_MEMMOVE
|
||||
#define memmove(d, s, n) __builtin_memmove(d, s, n)
|
||||
|
||||
#define __HAVE_ARCH_MEMSET
|
||||
#define memset(s, c, n) __builtin_memset(s, c, n)
|
||||
|
||||
#endif /* __X86_STRING_H__ */
|
||||
/*
|
||||
* Local variables:
|
||||
|
||||
@@ -4,6 +4,7 @@ lib-y += bsearch.o
|
||||
lib-y += ctors.o
|
||||
lib-y += ctype.o
|
||||
lib-y += list-sort.o
|
||||
lib-y += memset.o
|
||||
lib-y += muldiv64.o
|
||||
lib-y += parse-size.o
|
||||
lib-y += rbtree.o
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 1991, 1992 Linus Torvalds
|
||||
*/
|
||||
|
||||
#include <xen/string.h>
|
||||
|
||||
/**
|
||||
* memset - Fill a region of memory with the given value
|
||||
* @s: Pointer to the start of the area.
|
||||
* @c: The byte to fill the area with
|
||||
* @count: The size of the area.
|
||||
*
|
||||
* Do not use memset() to access IO space, use memset_io() instead.
|
||||
*/
|
||||
void *(memset)(void *s, int c, size_t count)
|
||||
{
|
||||
char *xs = (char *) s;
|
||||
|
||||
while (count--)
|
||||
*xs++ = c;
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* mode: C
|
||||
* c-file-style: "BSD"
|
||||
* c-basic-offset: 8
|
||||
* tab-width: 8
|
||||
* indent-tabs-mode: t
|
||||
* End:
|
||||
*/
|
||||