Browse Source

Add memcpy

tags/v0.9.3
Michael Brown 20 years ago
parent
commit
dc0aa58fb2
1 changed files with 13 additions and 0 deletions
  1. 13
    0
      src/arch/i386/include/bits/string.h

+ 13
- 0
src/arch/i386/include/bits/string.h View File

@@ -18,6 +18,19 @@
18 18
  *		consider these trivial functions to be PD.
19 19
  */
20 20
 
21
+#define __HAVE_ARCH_MEMCPY
22
+static inline void * memcpy(void *dest, const void *src, size_t n)
23
+{
24
+int d0, d1, d2;
25
+__asm__ __volatile__ (
26
+	"cld\n\t"
27
+	"rep\n\t"
28
+	"movsb"
29
+	: "=&c" (d0), "=&S" (d1), "=&D" (d2)
30
+	:"0" (n), "1" (src), "2" (dest)
31
+	: "memory");
32
+return dest; 
33
+}
21 34
 
22 35
 #define __HAVE_ARCH_MEMMOVE
23 36
 static inline void * memmove(void * dest,const void * src, size_t n)

Loading…
Cancel
Save