Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jan 2018 13:22:13 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r327820 - in head/sys: amd64/amd64 i386/i386
Message-ID:  <201801111322.w0BDMDvk028230@repo.freebsd.org>

Next in thread | Raw E-Mail | Index | Archive | Help
Author: kib
Date: Thu Jan 11 13:22:13 2018
New Revision: 327820
URL: https://svnweb.freebsd.org/changeset/base/327820

Log:
  Remove redundand CLD instructions.
  
  We already clear %RFLAGS.DF on the kernel entry due to the compiler's
  ABI requirements.
  
  Suggested by:	jhb
  Sponsored by:	The FreeBSD Foundation
  MFC after:	2 weeks

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

Modified: head/sys/amd64/amd64/support.S
==============================================================================
--- head/sys/amd64/amd64/support.S	Thu Jan 11 12:54:33 2018	(r327819)
+++ head/sys/amd64/amd64/support.S	Thu Jan 11 13:22:13 2018	(r327820)
@@ -50,7 +50,6 @@ ENTRY(bzero)
 	movq	%rsi,%rcx
 	xorl	%eax,%eax
 	shrq	$3,%rcx
-	cld
 	rep
 	stosq
 	movq	%rsi,%rcx
@@ -100,7 +99,6 @@ ENTRY(bcmp)
 	PUSH_FRAME_POINTER
 	movq	%rdx,%rcx
 	shrq	$3,%rcx
-	cld					/* compare forwards */
 	repe
 	cmpsq
 	jne	1f
@@ -132,7 +130,6 @@ ENTRY(bcopy)
 	jb	1f
 
 	shrq	$3,%rcx				/* copy by 64-bit words */
-	cld					/* nope, copy forwards */
 	rep
 	movsq
 	movq	%rdx,%rcx
@@ -171,7 +168,6 @@ ENTRY(memcpy)
 	movq	%rdi,%rax
 	movq	%rdx,%rcx
 	shrq	$3,%rcx				/* copy by 64-bit words */
-	cld					/* copy forwards */
 	rep
 	movsq
 	movq	%rdx,%rcx
@@ -218,7 +214,6 @@ ENTRY(fillw)
 	movq	%rdi,%rax
 	movq	%rsi,%rdi
 	movq	%rdx,%rcx
-	cld
 	rep
 	stosw
 	POP_FRAME_POINTER
@@ -274,7 +269,6 @@ ENTRY(copyout)
 	movq	%rdx,%rcx
 
 	shrq	$3,%rcx
-	cld
 	rep
 	movsq
 	movb	%dl,%cl
@@ -323,7 +317,6 @@ ENTRY(copyin)
 	movq	%rdx,%rcx
 	movb	%cl,%al
 	shrq	$3,%rcx				/* copy longword-wise */
-	cld
 	rep
 	movsq
 	movb	%al,%cl
@@ -620,7 +613,6 @@ ENTRY(copyinstr)
 	movq	%rax,%r8
 1:
 	incq	%rdx
-	cld
 
 2:
 	decq	%rdx
@@ -671,7 +663,6 @@ ENTRY(copystr)
 
 	xchgq	%rdi,%rsi
 	incq	%rdx
-	cld
 1:
 	decq	%rdx
 	jz	4f

Modified: head/sys/i386/i386/support.s
==============================================================================
--- head/sys/i386/i386/support.s	Thu Jan 11 12:54:33 2018	(r327819)
+++ head/sys/i386/i386/support.s	Thu Jan 11 13:22:13 2018	(r327820)
@@ -50,7 +50,6 @@ ENTRY(bzero)
 	movl	12(%esp),%ecx
 	xorl	%eax,%eax
 	shrl	$2,%ecx
-	cld
 	rep
 	stosl
 	movl	12(%esp),%ecx
@@ -90,7 +89,6 @@ ENTRY(i686_pagezero)
 
 	movl	12(%esp),%edi
 	movl	$1024,%ecx
-	cld
 
 	ALIGN_TEXT
 1:
@@ -141,7 +139,6 @@ ENTRY(fillw)
 	movl	8(%esp),%eax
 	movl	12(%esp),%edi
 	movl	16(%esp),%ecx
-	cld
 	rep
 	stosw
 	popl	%edi
@@ -158,7 +155,6 @@ ENTRY(bcopyb)
 	subl	%esi,%eax
 	cmpl	%ecx,%eax			/* overlapping && src < dst? */
 	jb	1f
-	cld					/* nope, copy forwards */
 	rep
 	movsb
 	popl	%edi
@@ -199,7 +195,6 @@ ENTRY(bcopy)
 	jb	1f
 
 	shrl	$2,%ecx				/* copy by 32-bit words */
-	cld					/* nope, copy forwards */
 	rep
 	movsl
 	movl	16(%ebp),%ecx
@@ -245,7 +240,6 @@ ENTRY(memcpy)
 	movl	20(%esp),%ecx
 	movl	%edi,%eax
 	shrl	$2,%ecx				/* copy by 32-bit words */
-	cld					/* nope, copy forwards */
 	rep
 	movsl
 	movl	20(%esp),%ecx
@@ -314,7 +308,6 @@ ENTRY(copyout)
 	movl	%ebx,%ecx
 
 	shrl	$2,%ecx
-	cld
 	rep
 	movsl
 	movb	%bl,%cl
@@ -365,7 +358,6 @@ ENTRY(copyin)
 
 	movb	%cl,%al
 	shrl	$2,%ecx				/* copy longword-wise */
-	cld
 	rep
 	movsl
 	movb	%al,%cl
@@ -582,7 +574,6 @@ ENTRY(copyinstr)
 	movl	%eax,20(%esp)
 1:
 	incl	%edx
-	cld
 
 2:
 	decl	%edx
@@ -635,7 +626,6 @@ ENTRY(copystr)
 	movl	16(%esp),%edi			/* %edi = to */
 	movl	20(%esp),%edx			/* %edx = maxlen */
 	incl	%edx
-	cld
 1:
 	decl	%edx
 	jz	4f
@@ -675,7 +665,6 @@ ENTRY(bcmp)
 
 	movl	%edx,%ecx
 	shrl	$2,%ecx
-	cld					/* compare forwards */
 	repe
 	cmpsl
 	jne	1f



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?201801111322.w0BDMDvk028230>