summaryrefslogtreecommitdiff
path: root/src/string/i386/memcpy.s
diff options
context:
space:
mode:
authorVladimir Azarov <avm@intermediate-node.net>2024-10-01 15:47:05 +0200
committerVladimir Azarov <avm@intermediate-node.net>2024-10-01 15:47:05 +0200
commit4abab5ad6c8465a7528ccdd5f49367da05f78bbd (patch)
treeebf009bf1376a5a223a915bc27cbbd791a1316bc /src/string/i386/memcpy.s
Initial version
Diffstat (limited to 'src/string/i386/memcpy.s')
-rw-r--r--src/string/i386/memcpy.s32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/string/i386/memcpy.s b/src/string/i386/memcpy.s
new file mode 100644
index 0000000..0608dd8
--- /dev/null
+++ b/src/string/i386/memcpy.s
@@ -0,0 +1,32 @@
+.global memcpy
+.global __memcpy_fwd
+.hidden __memcpy_fwd
+.type memcpy,@function
+memcpy:
+__memcpy_fwd:
+ push %esi
+ push %edi
+ mov 12(%esp),%edi
+ mov 16(%esp),%esi
+ mov 20(%esp),%ecx
+ mov %edi,%eax
+ cmp $4,%ecx
+ jc 1f
+ test $3,%edi
+ jz 1f
+2: movsb
+ dec %ecx
+ test $3,%edi
+ jnz 2b
+1: mov %ecx,%edx
+ shr $2,%ecx
+ rep
+ movsl
+ and $3,%edx
+ jz 1f
+2: movsb
+ dec %edx
+ jnz 2b
+1: pop %edi
+ pop %esi
+ ret