summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authormickey <mickey@openbsd.org>2002-07-08 15:20:15 +0000
committermickey <mickey@openbsd.org>2002-07-08 15:20:15 +0000
commitd6d5f5aba5b0c81b20c6203a96d57d6d22fbaf99 (patch)
treeb4c3bf3658c309d354408825f2d7d778e97d2cd3 /lib/libc
parentlem and buran (diff)
downloadwireguard-openbsd-d6d5f5aba5b0c81b20c6203a96d57d6d22fbaf99.tar.xz
wireguard-openbsd-d6d5f5aba5b0c81b20c6203a96d57d6d22fbaf99.zip
offload the arguments from the stack before performing
the copying, initial idea is from freebsd (not fully implemented there, apparently). this also makes bcopy/memcpy a tiny little bit faster.
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/arch/i386/string/bcopy.S16
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/libc/arch/i386/string/bcopy.S b/lib/libc/arch/i386/string/bcopy.S
index 0008daea4bb..c66a4223321 100644
--- a/lib/libc/arch/i386/string/bcopy.S
+++ b/lib/libc/arch/i386/string/bcopy.S
@@ -1,3 +1,5 @@
+/* $OpenBSD: bcopy.S,v 1.3 2002/07/08 15:20:15 mickey Exp $ */
+
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -37,7 +39,7 @@
#if defined(LIBC_SCCS)
.text
- .asciz "$OpenBSD: bcopy.S,v 1.2 1996/08/19 08:12:54 tholo Exp $"
+ .asciz "$OpenBSD: bcopy.S,v 1.3 2002/07/08 15:20:15 mickey Exp $"
#endif
/*
@@ -59,24 +61,23 @@ ENTRY(bcopy)
#if defined(MEMCOPY) || defined(MEMMOVE)
movl 12(%esp),%edi
movl 16(%esp),%esi
+ movl %edi, %eax
#else
movl 12(%esp),%esi
movl 16(%esp),%edi
#endif
movl 20(%esp),%ecx
+ movl %ecx,%edx
cmpl %esi,%edi /* potentially overlapping? */
jnb 1f
cld /* nope, copy forwards. */
shrl $2,%ecx /* copy by words */
rep
movsl
- movl 20(%esp),%ecx
+ movl %edx,%ecx
andl $3,%ecx /* any bytes left? */
rep
movsb
-#if defined(MEMCOPY) || defined(MEMMOVE)
- movl 12(%esp),%eax
-#endif
popl %edi
popl %esi
ret
@@ -89,15 +90,12 @@ ENTRY(bcopy)
decl %esi
rep
movsb
- movl 20(%esp),%ecx /* copy remainder by words */
+ movl %edx,%ecx
shrl $2,%ecx
subl $3,%esi
subl $3,%edi
rep
movsl
-#if defined(MEMCOPY) || defined(MEMMOVE)
- movl 12(%esp),%eax
-#endif
popl %edi
popl %esi
cld