2022-04-15 11:00:55 +02:00
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
void* memcpy(void* _dest, const void* _src, size_t _n)
|
|
|
|
{
|
|
|
|
int d0, d1, d2;
|
|
|
|
__asm__ __volatile__(
|
|
|
|
"rep ; movsl\n\t"
|
|
|
|
"testb $2,%b4\n\t"
|
|
|
|
"je 1f\n\t"
|
|
|
|
"movsw\n"
|
|
|
|
"1:\ttestb $1,%b4\n\t"
|
|
|
|
"je 2f\n\t"
|
|
|
|
"movsb\n"
|
|
|
|
"2:"
|
|
|
|
: "=&c"(d0), "=&D"(d1), "=&S"(d2)
|
|
|
|
: "0"(_n / 4), "q"(_n), "1"((long)_dest), "2"((long)_src)
|
|
|
|
: "memory");
|
|
|
|
return (_dest);
|
2021-04-27 18:33:31 +02:00
|
|
|
}
|