Commit 998cb619 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

Add builtin_memcpy helper

We will need it in parasite code where we can't use libc functions.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 2c112391
#ifndef __MEMCPY_64_H__
#define __MEMCPY_64_H__
#include "compiler.h"
#include "types.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 /* __MEMCPY_64_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment