forked from KolibriOS/kolibrios
cde4fa851d
- Formatted by clang-format (WebKit-style). - Removed unnecessary errno linux. - Added KOS error codes. - String functions have been replaced with more optimal ones for x86. - Changed wrappers for 70 sysfunction. git-svn-id: svn://kolibrios.org@9765 a494cfbc-eb01-0410-851d-a64ba20cac60
19 lines
465 B
C
19 lines
465 B
C
#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);
|
|
} |