bcopy is dead on i386. the one use left in the kernel was in locore.s

itself, and that got replaced with a call to memcpy. Ross deserves
most of the credit.
note that if you've seen bcopy elsewhere in the kernel, systm.h
defines it as a macro...
This commit is contained in:
perry 2001-05-16 22:09:36 +00:00
parent 90cabee3fb
commit 6859233343
1 changed files with 5 additions and 61 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.s,v 1.238 2001/05/16 05:01:28 perry Exp $ */
/* $NetBSD: locore.s,v 1.239 2001/05/16 22:09:36 perry Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@ -280,19 +280,19 @@ start: movw $0x1234,0x472 # warm boot
addl $4, %eax
movl (%eax), %ecx /* address of entry */
pushl %eax
pushl (%ecx) /* len */
pushl (%ecx) /* len */
pushl %ecx
pushl %edx
addl (%ecx), %edx /* update dest pointer */
cmpl $_RELOC(_C_LABEL(bootinfo) + BOOTINFO_MAXSIZE), %edx
jg 2f
pushl %ecx
call _C_LABEL(bcopy)
call _C_LABEL(memcpy)
addl $12, %esp
popl %eax
subl $1, %ebx
jmp 2b
2: /* cleanup for overflow case */
addl $12, %esp
addl $16, %esp
movl $RELOC(bootinfo), %edx
subl %ebx, (%edx) /* correct number of entries */
1:
@ -780,62 +780,6 @@ ENTRY(fillw)
popl %edi
ret
/*
* XXX Note: bcopy was obsoleted some time ago in favor of the mem* functions.
* It seems to only be legitimately called *inside* locore.s given that
* systm.h defines it to memcpy. Perhaps something should be cleaned up here?
* -- Perry Metzger, May 7, 2001
*/
/*
* void bcopy(const void *from, void *to, size_t len);
* Copy len bytes.
* This routine handles overlapping regions, although bcopy
* is not specified to do so (and should not be counted on to do so).
*/
/* LINTSTUB: Func: void bcopy(const void *from, void *to, size_t len) */
ENTRY(bcopy)
pushl %esi
pushl %edi
movl 12(%esp),%esi
movl 16(%esp),%edi
movl 20(%esp),%ecx
movl %edi,%eax
subl %esi,%eax
cmpl %ecx,%eax # overlapping?
jb 1f
cld # nope, copy forward
shrl $2,%ecx # copy by 32-bit words
rep
movsl
movl 20(%esp),%ecx
andl $3,%ecx # any bytes left?
rep
movsb
popl %edi
popl %esi
ret
ALIGN_TEXT
1: addl %ecx,%edi # copy backward
addl %ecx,%esi
std
andl $3,%ecx # any fractional bytes?
decl %edi
decl %esi
rep
movsb
movl 20(%esp),%ecx # copy remainder by 32-bit words
shrl $2,%ecx
subl $3,%esi
subl $3,%edi
rep
movsl
popl %edi
popl %esi
cld
ret
/*
* XXX No section 9 man page for kcopy. IMHO,
* if it is part of the MI/MD interface, it needs documentation.