ld-tool portability fix: MacOS build experience
[lunaix-os.git] / lunaix-os / arch / i386 / klib / fast_str.c
1 #include <klibc/string.h>
2
3 void*
4 memcpy(void* dest, const void* src, unsigned long num)
5 {
6     if (!num)
7         return dest;
8         
9     asm volatile("movl %1, %%edi\n"
10                  "rep movsb\n" ::"S"(src),
11                  "r"(dest),
12                  "c"(num)
13                  : "edi", "memory");
14     return dest;
15 }
16
17 void*
18 memset(void* ptr, int value, unsigned long num)
19 {
20     asm volatile("movl %1, %%edi\n"
21                  "rep stosb\n" ::"c"(num),
22                  "r"(ptr),
23                  "a"(value)
24                  : "edi", "memory");
25     return ptr;
26 }