Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 May 2018 21:11:33 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r334183 - in head/sys: conf i386/i386
Message-ID:  <201805242111.w4OLBXoo009938@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Thu May 24 21:11:33 2018
New Revision: 334183
URL: https://svnweb.freebsd.org/changeset/base/334183

Log:
  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

Modified:
  head/sys/conf/files.i386
  head/sys/i386/i386/support.s

Modified: head/sys/conf/files.i386
==============================================================================
--- head/sys/conf/files.i386	Thu May 24 21:11:28 2018	(r334182)
+++ head/sys/conf/files.i386	Thu May 24 21:11:33 2018	(r334183)
@@ -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

Modified: head/sys/i386/i386/support.s
==============================================================================
--- head/sys/i386/i386/support.s	Thu May 24 21:11:28 2018	(r334182)
+++ head/sys/i386/i386/support.s	Thu May 24 21:11:33 2018	(r334183)
@@ -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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805242111.w4OLBXoo009938>