2017-11-01 15:07:57 +01:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2025-11-18 10:29:05 -08:00
|
|
|
#ifndef _ASM_X86_STRING_H
|
|
|
|
|
#define _ASM_X86_STRING_H
|
|
|
|
|
|
2007-10-11 11:20:03 +02:00
|
|
|
#ifdef CONFIG_X86_32
|
2012-10-02 18:01:25 +01:00
|
|
|
# include <asm/string_32.h>
|
2007-10-11 11:20:03 +02:00
|
|
|
#else
|
2012-10-02 18:01:25 +01:00
|
|
|
# include <asm/string_64.h>
|
2007-10-11 11:20:03 +02:00
|
|
|
#endif
|
2025-11-18 10:29:05 -08:00
|
|
|
|
|
|
|
|
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 */
|