diff --git a/sys/amd64/amd64/support.S b/sys/amd64/amd64/support.S index 32ba9b62896..9dfdfba3b19 100644 --- a/sys/amd64/amd64/support.S +++ b/sys/amd64/amd64/support.S @@ -354,8 +354,8 @@ bcopyw: movl 20(%esp),%ecx cmpl %esi,%edi /* potentially overlapping? */ jnb 1f - cld /* nope, copy forwards */ shrl $1,%ecx /* copy by 16-bit words */ + cld /* nope, copy forwards */ rep movsw adc %ecx,%ecx /* any bytes left? */ @@ -369,10 +369,10 @@ bcopyw: 1: addl %ecx,%edi /* copy backwards */ addl %ecx,%esi - std andl $1,%ecx /* any fractional bytes? */ decl %edi decl %esi + std rep movsb movl 20(%esp),%ecx /* copy remainder by 16-bit words */ @@ -408,8 +408,8 @@ bcopy: movl 20(%esp),%ecx cmpl %esi,%edi /* potentially overlapping? */ jnb 1f - cld /* nope, copy forwards */ shrl $2,%ecx /* copy by 32-bit words */ + cld /* nope, copy forwards */ rep movsl movl 20(%esp),%ecx @@ -424,10 +424,10 @@ bcopy: 1: addl %ecx,%edi /* copy backwards */ addl %ecx,%esi - std andl $3,%ecx /* any fractional bytes? */ decl %edi decl %esi + std rep movsb movl 20(%esp),%ecx /* copy remainder by 32-bit words */ @@ -577,9 +577,9 @@ ENTRY(copyout) /* copyout(from_kernel, to_user, len) */ /* bcopy(%esi, %edi, %ebx) */ 3: - cld movl %ebx,%ecx shrl $2,%ecx + cld rep movsl movb %bl,%cl @@ -857,6 +857,7 @@ ENTRY(copyoutstr) movl 12(%esp),%esi /* %esi = from */ movl 16(%esp),%edi /* %edi = to */ movl 20(%esp),%edx /* %edx = maxlen */ + cld #if defined(I386_CPU) @@ -886,6 +887,7 @@ ENTRY(copyoutstr) pushl %edx pushl %edi call _trapwrite + cld popl %edi popl %edx orl %eax,%eax @@ -990,6 +992,7 @@ ENTRY(copyinstr) movl __udatasel,%eax movl %ax,%gs incl %edx + cld 1: decl %edx jz 2f @@ -1038,7 +1041,7 @@ ENTRY(copystr) movl 16(%esp),%edi /* %edi = to */ movl 20(%esp),%edx /* %edx = maxlen */ incl %edx - + cld 1: decl %edx jz 4f diff --git a/sys/amd64/amd64/support.s b/sys/amd64/amd64/support.s index 32ba9b62896..9dfdfba3b19 100644 --- a/sys/amd64/amd64/support.s +++ b/sys/amd64/amd64/support.s @@ -354,8 +354,8 @@ bcopyw: movl 20(%esp),%ecx cmpl %esi,%edi /* potentially overlapping? */ jnb 1f - cld /* nope, copy forwards */ shrl $1,%ecx /* copy by 16-bit words */ + cld /* nope, copy forwards */ rep movsw adc %ecx,%ecx /* any bytes left? */ @@ -369,10 +369,10 @@ bcopyw: 1: addl %ecx,%edi /* copy backwards */ addl %ecx,%esi - std andl $1,%ecx /* any fractional bytes? */ decl %edi decl %esi + std rep movsb movl 20(%esp),%ecx /* copy remainder by 16-bit words */ @@ -408,8 +408,8 @@ bcopy: movl 20(%esp),%ecx cmpl %esi,%edi /* potentially overlapping? */ jnb 1f - cld /* nope, copy forwards */ shrl $2,%ecx /* copy by 32-bit words */ + cld /* nope, copy forwards */ rep movsl movl 20(%esp),%ecx @@ -424,10 +424,10 @@ bcopy: 1: addl %ecx,%edi /* copy backwards */ addl %ecx,%esi - std andl $3,%ecx /* any fractional bytes? */ decl %edi decl %esi + std rep movsb movl 20(%esp),%ecx /* copy remainder by 32-bit words */ @@ -577,9 +577,9 @@ ENTRY(copyout) /* copyout(from_kernel, to_user, len) */ /* bcopy(%esi, %edi, %ebx) */ 3: - cld movl %ebx,%ecx shrl $2,%ecx + cld rep movsl movb %bl,%cl @@ -857,6 +857,7 @@ ENTRY(copyoutstr) movl 12(%esp),%esi /* %esi = from */ movl 16(%esp),%edi /* %edi = to */ movl 20(%esp),%edx /* %edx = maxlen */ + cld #if defined(I386_CPU) @@ -886,6 +887,7 @@ ENTRY(copyoutstr) pushl %edx pushl %edi call _trapwrite + cld popl %edi popl %edx orl %eax,%eax @@ -990,6 +992,7 @@ ENTRY(copyinstr) movl __udatasel,%eax movl %ax,%gs incl %edx + cld 1: decl %edx jz 2f @@ -1038,7 +1041,7 @@ ENTRY(copystr) movl 16(%esp),%edi /* %edi = to */ movl 20(%esp),%edx /* %edx = maxlen */ incl %edx - + cld 1: decl %edx jz 4f diff --git a/sys/i386/i386/support.s b/sys/i386/i386/support.s index 32ba9b62896..9dfdfba3b19 100644 --- a/sys/i386/i386/support.s +++ b/sys/i386/i386/support.s @@ -354,8 +354,8 @@ bcopyw: movl 20(%esp),%ecx cmpl %esi,%edi /* potentially overlapping? */ jnb 1f - cld /* nope, copy forwards */ shrl $1,%ecx /* copy by 16-bit words */ + cld /* nope, copy forwards */ rep movsw adc %ecx,%ecx /* any bytes left? */ @@ -369,10 +369,10 @@ bcopyw: 1: addl %ecx,%edi /* copy backwards */ addl %ecx,%esi - std andl $1,%ecx /* any fractional bytes? */ decl %edi decl %esi + std rep movsb movl 20(%esp),%ecx /* copy remainder by 16-bit words */ @@ -408,8 +408,8 @@ bcopy: movl 20(%esp),%ecx cmpl %esi,%edi /* potentially overlapping? */ jnb 1f - cld /* nope, copy forwards */ shrl $2,%ecx /* copy by 32-bit words */ + cld /* nope, copy forwards */ rep movsl movl 20(%esp),%ecx @@ -424,10 +424,10 @@ bcopy: 1: addl %ecx,%edi /* copy backwards */ addl %ecx,%esi - std andl $3,%ecx /* any fractional bytes? */ decl %edi decl %esi + std rep movsb movl 20(%esp),%ecx /* copy remainder by 32-bit words */ @@ -577,9 +577,9 @@ ENTRY(copyout) /* copyout(from_kernel, to_user, len) */ /* bcopy(%esi, %edi, %ebx) */ 3: - cld movl %ebx,%ecx shrl $2,%ecx + cld rep movsl movb %bl,%cl @@ -857,6 +857,7 @@ ENTRY(copyoutstr) movl 12(%esp),%esi /* %esi = from */ movl 16(%esp),%edi /* %edi = to */ movl 20(%esp),%edx /* %edx = maxlen */ + cld #if defined(I386_CPU) @@ -886,6 +887,7 @@ ENTRY(copyoutstr) pushl %edx pushl %edi call _trapwrite + cld popl %edi popl %edx orl %eax,%eax @@ -990,6 +992,7 @@ ENTRY(copyinstr) movl __udatasel,%eax movl %ax,%gs incl %edx + cld 1: decl %edx jz 2f @@ -1038,7 +1041,7 @@ ENTRY(copystr) movl 16(%esp),%edi /* %edi = to */ movl 20(%esp),%edx /* %edx = maxlen */ incl %edx - + cld 1: decl %edx jz 4f