Make memmove and bcopy share code

Make memmove the primary interface, but have bcopy be an alternative
entry point that jumps into memmove. This will slightly pessimize
bcopy calls, but those are about to get much rarer. Return dst always,
but it will be ignored by bcopy callers. We can remove just the alt
entry point if we ever remove bcopy entirely.

Differential Revision: https://reviews.freebsd.org/D15374
This commit is contained in:
imp 2018-05-24 21:11:33 +00:00
parent c3a9ad4684
commit c98da3edad
2 changed files with 12 additions and 1 deletions

View File

@ -553,7 +553,6 @@ kern/subr_sfbuf.c standard
libkern/divdi3.c standard
libkern/ffsll.c standard
libkern/flsll.c standard
libkern/memmove.c standard
libkern/memset.c standard
libkern/moddi3.c standard
libkern/qdivrem.c standard

View File

@ -146,6 +146,7 @@ ENTRY(fillw)
END(fillw)
/*
* memmove(dst, src, cnt) (return dst)
* bcopy(src, dst, cnt)
* ws@tools.de (Wolfgang Solfrank, TooLs GmbH) +49-228-985800
*/
@ -156,6 +157,15 @@ ENTRY(bcopy)
pushl %edi
movl 8(%ebp),%esi
movl 12(%ebp),%edi
jmp 1f
ALTENTRY(memmove)
pushl %ebp
movl %esp,%ebp
pushl %esi
pushl %edi
movl 8(%ebp),%edi
movl 12(%ebp),%esi
1:
movl 16(%ebp),%ecx
movl %edi,%eax
@ -172,6 +182,7 @@ ENTRY(bcopy)
movsb
popl %edi
popl %esi
movl 8(%ebp),%eax /* return dst for memmove */
popl %ebp
ret
@ -194,6 +205,7 @@ ENTRY(bcopy)
popl %edi
popl %esi
cld
movl 8(%ebp),%eax /* return dst for memmove */
popl %ebp
ret
END(bcopy)