trivial amd64 implementation of memcpy32
authorJavier S. Pedro <maemo@javispedro.com>
Wed, 22 Dec 2010 02:36:57 +0000 (03:36 +0100)
committerJavier S. Pedro <maemo@javispedro.com>
Wed, 22 Dec 2010 02:36:57 +0000 (03:36 +0100)
misc_amd64.s [new file with mode: 0644]

diff --git a/misc_amd64.s b/misc_amd64.s
new file mode 100644 (file)
index 0000000..c963818
--- /dev/null
@@ -0,0 +1,25 @@
+
+.text
+.global memset32 # int *dest, int c, int count
+
+# rdi = dest, rsi = c, rdx = count
+# stosl: src = eax, dest = es:rdi, rcx = count
+
+memset32:
+       movl %esi, %eax
+       movl %edx, %ecx
+       cld
+       rep stosl
+       ret
+
+.global memcpy32 # int *dest, int *src, int count
+
+# rdi = dest, rsi = src, rdx = count
+# stosl: src = rsi, dest = es:rdi, ecx = count
+
+memcpy32:
+       movl %edx, %ecx
+       cld
+       rep movsl
+       ret
+