Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Sep 2018 21:46:27 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r338702 - head/sys/amd64/amd64
Message-ID:  <201809162146.w8GLkRoj093290@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Sun Sep 16 21:46:27 2018
New Revision: 338702
URL: https://svnweb.freebsd.org/changeset/base/338702

Log:
  Revert amd64: tidy up kernel memmove
  
  There is a braino in the non-erms variant which breaks the
  functionality.
  
  Will be fixed at a later time with a different patch.
  
  Reported by:	Manfred Antar
  Approved by:	re (implicit)

Modified:
  head/sys/amd64/amd64/support.S

Modified: head/sys/amd64/amd64/support.S
==============================================================================
--- head/sys/amd64/amd64/support.S	Sun Sep 16 21:44:36 2018	(r338701)
+++ head/sys/amd64/amd64/support.S	Sun Sep 16 21:46:27 2018	(r338702)
@@ -108,12 +108,12 @@ END(sse2_pagezero)
  */
 ENTRY(memmove_std)
 	PUSH_FRAME_POINTER
-	movq	%rdi,%rax
+	movq	%rdi,%r9
 	movq	%rdx,%rcx
 
-	movq	%rdi,%r8
-	subq	%rsi,%r8
-	cmpq	%rcx,%r8			/* overlapping && src < dst? */
+	movq	%rdi,%rax
+	subq	%rsi,%rax
+	cmpq	%rcx,%rax			/* overlapping && src < dst? */
 	jb	1f
 
 	shrq	$3,%rcx				/* copy by 64-bit words */
@@ -128,6 +128,7 @@ ENTRY(memmove_std)
 2:
 	rep
 	movsb
+	movq	%r9,%rax
 	POP_FRAME_POINTER
 	ret
 
@@ -139,10 +140,8 @@ ENTRY(memmove_std)
 	decq	%rsi
 	andq	$7,%rcx				/* any fractional bytes? */
 	std
-	jne	3f
 	rep
 	movsb
-3:
 	movq	%rdx,%rcx			/* copy remainder by 32-bit words */
 	shrq	$3,%rcx
 	subq	$7,%rsi
@@ -150,22 +149,24 @@ ENTRY(memmove_std)
 	rep
 	movsq
 	cld
+	movq	%r9,%rax
 	POP_FRAME_POINTER
 	ret
 END(memmove_std)
 
 ENTRY(memmove_erms)
 	PUSH_FRAME_POINTER
-	movq	%rdi,%rax
+	movq	%rdi,%r9
 	movq	%rdx,%rcx
 
-	movq	%rdi,%r8
-	subq	%rsi,%r8
-	cmpq	%rcx,%r8			/* overlapping && src < dst? */
+	movq	%rdi,%rax
+	subq	%rsi,%rax
+	cmpq	%rcx,%rax			/* overlapping && src < dst? */
 	jb	1f
 
 	rep
 	movsb
+	movq	%r9,%rax
 	POP_FRAME_POINTER
 	ret
 
@@ -178,6 +179,7 @@ ENTRY(memmove_erms)
 	rep
 	movsb
 	cld
+	movq	%r9,%rax
 	POP_FRAME_POINTER
 	ret
 END(memmove_erms)



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