criu/arch/x86/include/asm/string.h
Cyrill Gorcunov 17f6c36305 asm: Move builtin_memcpy helper into asm/string.h
There will be a couple of more builtin helpers needed
in pie code soon. Thus to unify approach do

 - rename asm/memcpy_64.h to asm/string.h

 - introduce include/asm-generic/string.h file
   where all helpers are implemented if optimized
   variant is not  yet provided

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-23 16:51:06 +04:00

24 lines
564 B
C

#ifndef __CR_ASM_STRING_H__
#define __CR_ASM_STRING_H__
#define HAS_BUILTIN_MEMCPY
#include "compiler.h"
#include "asm-generic/string.h"
static always_inline void *builtin_memcpy(void *to, const void *from, unsigned int n)
{
int d0, d1, d2;
asm volatile("rep ; movsl \n"
"movl %4,%%ecx \n"
"andl $3,%%ecx \n"
"jz 1f \n"
"rep ; movsb \n"
"1:"
: "=&c" (d0), "=&D" (d1), "=&S" (d2)
: "0" (n / 4), "g" (n), "1" ((long)to), "2" ((long)from)
: "memory");
return to;
}
#endif /* __CR_ASM_STRING_H__ */