[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v6 2/4] x86/asm: group inline string functions



Group the __inline string functions in the same header.

Use <asm/shared/string.h> since __inline_memcmp() must remain there for use
by arch/x86/boot/string.c.

Signed-off-by: Mauricio Faria de Oliveira <mfo@xxxxxxxxxx>
---
 arch/x86/include/asm/shared/string.h | 26 ++++++++++++++++++++++++++
 arch/x86/include/asm/string.h        | 21 ---------------------
 2 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/arch/x86/include/asm/shared/string.h 
b/arch/x86/include/asm/shared/string.h
index 
02b92927553f7b8e1c87e6122bbaa70439e57ea7..b1b9c93f90685c8ec4174ef9e24bc7a0e6ba9b8a
 100644
--- a/arch/x86/include/asm/shared/string.h
+++ b/arch/x86/include/asm/shared/string.h
@@ -2,6 +2,32 @@
 #ifndef _ASM_X86_SHARED_STRING_H
 #define _ASM_X86_SHARED_STRING_H
 
+/*
+ * The __inline string functions are grouped in this file for consistency and
+ * for use by arch/x86/boot code due to limitations on including asm/string.h.
+ */
+
+static __always_inline void *__inline_memcpy(void *to, const void *from, 
size_t len)
+{
+       void *ret = to;
+
+       asm volatile("rep movsb"
+                    : "+D" (to), "+S" (from), "+c" (len)
+                    : : "memory");
+       return ret;
+}
+
+static __always_inline void *__inline_memset(void *s, int v, size_t n)
+{
+       void *ret = s;
+
+       asm volatile("rep stosb"
+                    : "+D" (s), "+c" (n)
+                    : "a" ((uint8_t)v)
+                    : "memory");
+       return ret;
+}
+
 /*
  * This inline memcmp() returns 0 (equal) or 1 (not equal).
  * The regular memcmp() returns <0 (less than), 0 (equal), or >0 (greater than)
diff --git a/arch/x86/include/asm/string.h b/arch/x86/include/asm/string.h
index 
8d271a451721d97f78a84009613381414f91f2a6..dbf59f0d4cca71e2ddce0d8764aeec8782236669
 100644
--- a/arch/x86/include/asm/string.h
+++ b/arch/x86/include/asm/string.h
@@ -10,25 +10,4 @@
 
 #include <asm/shared/string.h>
 
-static __always_inline void *__inline_memcpy(void *to, const void *from, 
size_t len)
-{
-       void *ret = to;
-
-       asm volatile("rep movsb"
-                    : "+D" (to), "+S" (from), "+c" (len)
-                    : : "memory");
-       return ret;
-}
-
-static __always_inline void *__inline_memset(void *s, int v, size_t n)
-{
-       void *ret = s;
-
-       asm volatile("rep stosb"
-                    : "+D" (s), "+c" (n)
-                    : "a" ((uint8_t)v)
-                    : "memory");
-       return ret;
-}
-
 #endif /* _ASM_X86_STRING_H */

-- 
2.47.3




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.