瀏覽代碼

Add memcpy

tags/v0.9.3
Michael Brown 20 年之前
父節點
當前提交
dc0aa58fb2
共有 1 個檔案被更改,包括 13 行新增0 行删除
  1. 13
    0
      src/arch/i386/include/bits/string.h

+ 13
- 0
src/arch/i386/include/bits/string.h 查看文件

@@ -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…
取消
儲存