svn commit: r334182 - in head/sys: conf sparc64/sparc64

Warner Losh imp at FreeBSD.org
Thu May 24 21:11:33 UTC 2018


Author: imp
Date: Thu May 24 21:11:28 2018
New Revision: 334182
URL: https://svnweb.freebsd.org/changeset/base/334182

Log:
  Define memmove and make bcopy alt entry point
  
  Make a memmove entry point just before bcopy and have it swap its args
  before continuing into the body of bcopy. Adjust the returns to return
  dst (original %o0 swapped to %o1) from both entry points. bcopy users
  will ignore them. Since these are in the branch delay slot, it should
  take no additional time. I use %o6 for this rather than just move %o1
  back to %o2 at the end since my sparc64 assembler knowledge is weak.
  Also eliminate wrapper call from memmove to bcopy.
  
  Differential Revision: https://reviews.freebsd.org/D15374

Modified:
  head/sys/conf/files.sparc64
  head/sys/sparc64/sparc64/support.S

Modified: head/sys/conf/files.sparc64
==============================================================================
--- head/sys/conf/files.sparc64	Thu May 24 21:11:24 2018	(r334181)
+++ head/sys/conf/files.sparc64	Thu May 24 21:11:28 2018	(r334182)
@@ -71,7 +71,6 @@ libkern/ffsll.c			standard
 libkern/fls.c			standard
 libkern/flsl.c			standard
 libkern/flsll.c			standard
-libkern/memmove.c		standard
 sparc64/central/central.c	optional	central
 sparc64/ebus/ebus.c		optional	ebus
 sparc64/ebus/epic.c		optional	epic ebus

Modified: head/sys/sparc64/sparc64/support.S
==============================================================================
--- head/sys/sparc64/sparc64/support.S	Thu May 24 21:11:24 2018	(r334181)
+++ head/sys/sparc64/sparc64/support.S	Thu May 24 21:11:28 2018	(r334182)
@@ -265,10 +265,18 @@ ENTRY(bcmp)
 END(bcmp)
 
 /*
+ * void *memmove(void *dst, const void *src, size_t len)
  * void bcopy(const void *src, void *dst, size_t len)
  */
-ENTRY(bcopy)
+ENTRY(memmove)
 	/*
+	 * Swap src/dst for memmove/bcopy differences
+	 */
+	mov	%o0, %o6
+	mov	%o1, %o0
+	mov	%o6, %o1
+ALTENTRY(bcopy)
+	/*
 	 * Check for overlap, and copy backwards if so.
 	 */
 	sub	%o1, %o0, %g1
@@ -290,15 +298,15 @@ ENTRY(bcopy)
 	ba	%xcc, 1b
 	 stb	%g1, [%o1]
 2:	retl
-	 nop
+	 mov	%o6, %o0
 
 	/*
 	 * Do the fast version.
 	 */
 3:	_MEMCPY(%o1, %o0, %o2, EMPTY, EMPTY, EMPTY, EMPTY)
 	retl
-	 nop
-END(bcopy)
+	 mov	%o6, %o0
+END(memmove)
 
 /*
  * void bzero(void *b, size_t len)


More information about the svn-src-all mailing list