From fb3bfdf1862ea5ef6ddeec1d44d355a064f6be08 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Thu, 24 May 2018 21:11:33 +0000 Subject: [PATCH] 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 --- sys/conf/files.i386 | 1 - sys/i386/i386/support.s | 12 ++++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/conf/files.i386 b/sys/conf/files.i386 index 9fe32a20eb6..e06c4f6fb57 100644 --- a/sys/conf/files.i386 +++ b/sys/conf/files.i386 @@ -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 diff --git a/sys/i386/i386/support.s b/sys/i386/i386/support.s index ca4ce8abcda..5fa2aa7131f 100644 --- a/sys/i386/i386/support.s +++ b/sys/i386/i386/support.s @@ -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)