summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2002-07-08 15:20:16 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2002-07-08 15:20:16 +0000
commit50ed485ee90e432e7b61ef4ba5439790c4cc70b8 (patch)
tree871689cf364b04f7ad530b0f46fa55cf45bfeab1 /lib/libc
parent182ee8990a76610179be5713e65f4d84db249ba9 (diff)
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