1993-10-07 03:17:24 +03:00
|
|
|
/*
|
1995-04-29 02:53:59 +04:00
|
|
|
* Written by J.T. Conklin <jtc@netbsd.org>.
|
|
|
|
* Public domain.
|
1993-10-07 03:17:24 +03:00
|
|
|
*/
|
|
|
|
|
1994-03-12 04:39:55 +03:00
|
|
|
#include <machine/asm.h>
|
|
|
|
|
1993-10-21 04:39:55 +03:00
|
|
|
#if defined(LIBC_SCCS)
|
1995-04-29 02:57:54 +04:00
|
|
|
RCSID("$NetBSD: strcpy.S,v 1.8 1995/04/28 22:58:12 jtc Exp $")
|
1993-10-21 04:39:55 +03:00
|
|
|
#endif
|
1993-10-07 03:17:24 +03:00
|
|
|
|
|
|
|
/*
|
1995-04-29 02:53:59 +04:00
|
|
|
* NOTE: I've unrolled the loop eight times: large enough to make a
|
1993-10-07 03:17:24 +03:00
|
|
|
* significant difference, and small enough not to totally trash the
|
1994-02-14 20:45:16 +03:00
|
|
|
* cache.
|
1993-10-07 03:17:24 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
ENTRY(strcpy)
|
|
|
|
movl 4(%esp),%ecx /* dst address */
|
|
|
|
movl 8(%esp),%edx /* src address */
|
|
|
|
pushl %ecx /* push dst address */
|
|
|
|
|
|
|
|
.align 2,0x90
|
|
|
|
L1: movb (%edx),%al /* unroll loop, but not too much */
|
|
|
|
movb %al,(%ecx)
|
|
|
|
testb %al,%al
|
1994-02-14 23:05:52 +03:00
|
|
|
jz L2
|
1993-10-07 03:17:24 +03:00
|
|
|
movb 1(%edx),%al
|
|
|
|
movb %al,1(%ecx)
|
|
|
|
testb %al,%al
|
1994-02-14 23:05:52 +03:00
|
|
|
jz L2
|
1993-10-07 03:17:24 +03:00
|
|
|
movb 2(%edx),%al
|
|
|
|
movb %al,2(%ecx)
|
|
|
|
testb %al,%al
|
1994-02-14 23:05:52 +03:00
|
|
|
jz L2
|
1993-10-07 03:17:24 +03:00
|
|
|
movb 3(%edx),%al
|
|
|
|
movb %al,3(%ecx)
|
|
|
|
testb %al,%al
|
1994-02-14 23:05:52 +03:00
|
|
|
jz L2
|
1993-10-07 03:17:24 +03:00
|
|
|
movb 4(%edx),%al
|
|
|
|
movb %al,4(%ecx)
|
|
|
|
testb %al,%al
|
1994-02-14 23:05:52 +03:00
|
|
|
jz L2
|
1993-10-07 03:17:24 +03:00
|
|
|
movb 5(%edx),%al
|
|
|
|
movb %al,5(%ecx)
|
|
|
|
testb %al,%al
|
1994-02-14 23:05:52 +03:00
|
|
|
jz L2
|
1993-10-07 03:17:24 +03:00
|
|
|
movb 6(%edx),%al
|
|
|
|
movb %al,6(%ecx)
|
|
|
|
testb %al,%al
|
1994-02-14 23:05:52 +03:00
|
|
|
jz L2
|
1993-10-07 03:17:24 +03:00
|
|
|
movb 7(%edx),%al
|
|
|
|
movb %al,7(%ecx)
|
|
|
|
addl $8,%edx
|
|
|
|
addl $8,%ecx
|
|
|
|
testb %al,%al
|
1994-02-14 23:05:52 +03:00
|
|
|
jnz L1
|
1993-10-07 03:17:24 +03:00
|
|
|
L2: popl %eax /* pop dst address */
|
|
|
|
ret
|