1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_X86_STRING_H
3 #define _ASM_X86_STRING_H
4
5 #ifdef CONFIG_X86_32
6 # include <asm/string_32.h>
7 #else
8 # include <asm/string_64.h>
9 #endif
10
__inline_memcpy(void * to,const void * from,size_t len)11 static __always_inline void *__inline_memcpy(void *to, const void *from, size_t len)
12 {
13 void *ret = to;
14
15 asm volatile("rep movsb"
16 : "+D" (to), "+S" (from), "+c" (len)
17 : : "memory");
18 return ret;
19 }
20
__inline_memset(void * s,int v,size_t n)21 static __always_inline void *__inline_memset(void *s, int v, size_t n)
22 {
23 void *ret = s;
24
25 asm volatile("rep stosb"
26 : "+D" (s), "+c" (n)
27 : "a" ((uint8_t)v)
28 : "memory");
29 return ret;
30 }
31
32 #endif /* _ASM_X86_STRING_H */
33